@font-face {
    font-family: 'IosevkaTerm Nerd Font';
    src: url('fonts/IosevkaTermNerdFontPropo-Regular.woff2') format('woff2'),
         url('fonts/IosevkaTermNerdFontPropo-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IosevkaTerm Nerd Font';
    src: url('fonts/IosevkaTermNerdFontPropo-Bold.woff2') format('woff2'),
         url('fonts/IosevkaTermNerdFontPropo-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {

    --bg: #282828;
    --bg-dim: #1d2021;
    --bg1: #32302f;
    --bg2: #3c3836;
    --fg: #fbf1c7;
    --fg-dim: #ebdbb2;
    --red: #ea6962;
    --green: #a9b665;
    --yellow: #d8a657;
    --blue: #7daea3;
    --purple: #d3869b;
    --aqua: #89b482;
    --orange: #e78a4e;
    --border: var(--bg2);
    --border-width:2px;
    --border-color:var(--border);
}

:root[data-theme="light"] {

    --bg: #fbf1c7;
    --bg-dim: #f9f5d7;
    --bg1: #ebdbb2;
    --bg2: #d5c4a1;
    --fg: #4f3829;
    --fg-dim: #4f3829;
    --red: #c14a4a;
    --green: #6c782e;
    --yellow: #b47109;
    --blue: #45707a;
    --purple: #945e80;
    --aqua: #4c7a5d;
    --orange: #c35e0a;
    --border: var(--bg2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-dim);
    color: var(--fg);
    font-family: 'IosevkaTerm Nerd Font', 'JetBrains Mono', monospace;
    font-size: 19px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    padding: 4px 2px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg);
    border:var(--border-width) solid var(--border-color);
    padding: 8px 12px 32px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    font-family: inherit;
    font-size: 18px;
    padding: 4px 8px;
    border:var(--border-width) solid var(--border-color);
    background: var(--bg1);
    color: var(--fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.12s;
}
.dropdown-toggle:hover {
    border-color: var(--aqua);
}
.dropdown-arrow {
    font-size: 12px;
    color: var(--fg-dim);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg);
    border:var(--border-width) solid var(--border-color);
    min-width: 120px;
    z-index: 10;
    flex-direction: column;
    padding: 4px 0;
}
.dropdown-menu.open {
    display: flex;
}

.dropdown-item {
    font-family: inherit;
    font-size: 14px;
    background: transparent;
    border: none;
    color: var(--fg) !important;
    padding: 6px 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.dropdown-item:hover {
    background: var(--bg2);
}
.dropdown-item.active {
    background: var(--bg2);
    color: var(--aqua);
}

.dropdown-toggle,
.key-hint {
    box-sizing: border-box;
    width: 40px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

.key-hint {
    font-family: inherit;
    font-size: 18px;
    color: var(--fg-dim);
    border: var(--border-width) solid var(--border-color);
    background: var(--bg1);
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.key-hint:hover {
    border-color: var(--aqua);
    color: var(--aqua);
}

.main-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px 40px;
    align-items: start;
}

.col-left {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.avatar-wrap,
.project-card,
.timeline-item {
    border:var(--border-width) solid var(--border-color);
}

.avatar-wrap {
    background: var(--bg1);
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.name-title h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: 0.3px;
    line-height: 1.2;
}
.name-title .title {
    font-size: 18px;
    color: var(--orange);
    font-weight: 500;
    margin-top: 2px;
}
.name-title .location {
    font-size: 15px;
    color: var(--fg-dim);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.contact-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border:var(--border-width) solid var(--border-color);
    color: var(--fg-dim);
    text-decoration: none;
    font-size: 22px;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
    position: relative;
}
.contact-links a:hover {
    border-color: var(--aqua);
    color: var(--aqua);
    background: var(--bg1);
}
.contact-links a .label {
    display: none;
}
.contact-links .protected-hidden {
    opacity: 0.3;
    pointer-events: none;
    filter: blur(2px);
}
.contact-links .protected-hidden .tooltip-bot {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg2);
    color: var(--fg-dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 8px;
    border:var(--border-width) solid var(--border-color);
    white-space: nowrap;
    opacity: 1;
    filter: none;
}

.section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding-bottom: 0;
    margin-bottom: 12px;
}

.about-text {
    font-size: 16px;
    color: var(--fg-dim);
    line-height: 1.7;
}
.about-text p + p {
    margin-top: 8px;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border:var(--border-width) solid var(--border-color);
    background: var(--bg1);
    color: var(--fg-dim);
    font-size: 24px;
    font-family: 'IosevkaTerm Nerd Font', monospace;
    cursor: default;
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.skill-item:hover {
    border-color: var(--aqua);
    color: var(--aqua);
    background: var(--bg);
}

.skill-item .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.92);
    background: var(--bg2);
    color: var(--fg);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 3px 10px;
    border:var(--border-width) solid var(--border-color);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}
.skill-item:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}
.skill-item .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border:var(--border-width) solid var(--border-color);
    border-top-color: var(--border);
}

.col-right {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.projects-grid {
    background: var(--bg);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    border: none;
}

.project-card {
    background: var(--bg1);
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: none;
}
.project-card:not(:last-child) {
    border-bottom: var(--border-width) solid var(--border-color);
}

.projects-grid .project-card {
    border: var(--border-width) solid var(--border-color);
}

.project-card .p-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--blue);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.12s;
    width: fit-content;
}
.project-card .p-title:hover {
    color: var(--aqua);
}

.project-card .p-desc {
    font-size: 15px;
    color: var(--fg-dim);
    line-height: 1.5;
}

.project-card .p-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}
.project-card .p-tags span {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: var(--bg);
    border:var(--border-width) solid var(--border-color);
    padding: 1px 10px;
    color: var(--fg-dim);
}

.experience-section .section-label {
    margin-bottom: 12px;
}

.timeline {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-item {
    background: var(--bg1);
    padding: 16px 20px 18px;
    position: relative;
    border: var(--border-width) solid var(--border-color);
}
.timeline-item:not(:last-child) {
    border-bottom: var(--border-width) solid var(--border-color);
}

.timeline-item .dot {
    position: absolute;
    left: -6px;
    top: 22px;
    width: 10px;
    height: 10px;
    background: var(--bg2);
    border:var(--border-width) solid var(--border-color);
    border-radius: 0;
}

.timeline-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 2px;
    margin-left: 16px;
}
.timeline-header .title {
    font-size: 19px;
    font-weight: 600;
    color: var(--fg);
}
.timeline-header .year {
    font-size: 14px;
    color: var(--yellow);
    font-weight: 500;
    letter-spacing: 0.3px;
}
.timeline-meta {
    font-size: 14px;
    color: var(--fg-dim);
    margin-bottom: 8px;
    margin-left: 16px;
}

.timeline-details {
    font-size: 15px;
    color: var(--fg-dim);
    line-height: 1.7;
    margin-left: 16px;
}
.timeline-details ul {
    list-style: square;
    padding-left: 20px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.timeline-details ul li {
    font-size: 15px;
    color: var(--fg-dim);
}
.timeline-details .course-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 6px;
}
.timeline-details .course-list span {
    font-size: 13px;
    background: var(--bg);
    border:var(--border-width) solid var(--border-color);
    padding: 2px 12px;
    color: var(--fg-dim);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.modal-box {
    background: var(--bg);
    border: var(--border-width) solid var(--border-color);
    padding: 0;
    max-width: 580px;
    width: 90%;
    animation: tty-slide-in 0.14s ease-out;
}

@keyframes tty-slide-in {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.tty-box {
    overflow: hidden;
}

.tty-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 14px;
    background: var(--bg1);
    border-bottom: var(--border-width) solid var(--border-color);
    user-select: none;
}
.tty-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tty-close {
    width: 12px;
    height: 12px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ea6962;
    cursor: pointer;
    font-size: 0;
    line-height: 0;
    opacity: 0.85;
    transition: opacity 0.12s, transform 0.12s, background 0.12s;
}

.tty-close:hover {
    opacity: 1;
    transform: scale(1.08);
}

.tty-close:active {
    transform: scale(0.95);
}

.tty-body {
    padding: 16px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tty-output {
    background: var(--bg-dim);
    border: var(--border-width) solid var(--border-color);
    padding: 14px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--fg-dim);
    max-height: 320px;
    overflow-y: auto;
    font-family: inherit;
    white-space: pre-wrap;
}
.tty-output .man-header {
    color: var(--fg);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--bg2);
    padding-bottom: 4px;
    margin-bottom: 8px;
}
.tty-output .man-section {
    color: var(--yellow);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 12px;
    margin-bottom: 2px;
}
.tty-output .man-body {
    padding-left: 16px;
    color: var(--fg-dim);
    font-size: 14px;
}
.tty-output .man-skill-list {
    padding-left: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}
.tty-output .man-skill-list span {
    color: var(--aqua);
    font-size: 13px;
}
.tty-output .man-skill-list span::before { content: '• '; color: var(--bg2); }
.tty-output .man-err {
    color: var(--red);
}
.tty-output .man-hint {
    color: var(--fg-dim);
    opacity: 0.6;
    font-size: 13px;
}
.tty-output .man-name {
    color: var(--green);
    font-weight: 700;
}
.tty-output .char-typed {
    opacity: 0;
    animation: char-fade 0.01s forwards;
}
@keyframes char-fade { to { opacity: 1; } }

.tty-prompt-line {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 12px;
    background: var(--bg-dim);
    border: var(--border-width) solid var(--border-color);
    padding: 6px 10px;
}
.tty-ps1 {
    font-size: 15px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}
.tty-ps1-user   { color: var(--green); font-weight: 700; }
.tty-ps1-sep    { color: var(--fg-dim); }
.tty-ps1-host   { color: var(--blue); font-weight: 700; }
.tty-ps1-colon  { color: var(--fg-dim); }
.tty-ps1-path   { color: var(--purple); }
.tty-ps1-dollar { color: var(--fg); }

.tty-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.tty-input {
    flex: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--fg);
    font-family: inherit;
    font-size: 15px;
    padding: 0 0 0 8px;
    outline: none;
    min-width: 0;
    caret-color: transparent;
}

.tty-caret {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    width: 9px;
    height: 1.15em;
    background: var(--aqua);
    opacity: 0;
    pointer-events: none;
}
.tty-caret.active {
    opacity: 0.85;
    animation: blink 1s step-end infinite;
}

.tty-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.tty-action {
    font-family: inherit;
    font-size: 15px;
    background: var(--bg1);
    border: var(--border-width) solid var(--border-color);
    color: var(--fg);
    padding: 7px 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tty-action .action-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}
.tty-action .action-shortcut {
    margin-left: auto;
    font-size: 12px;
    color: var(--fg-dim);
    opacity: 0.5;
    font-family: inherit;
}
.tty-action:hover, .tty-action.tty-action-focused {
    background: var(--bg2);
    border-color: var(--aqua);
    color: var(--aqua);
}
.tty-action:hover .action-shortcut,
.tty-action.tty-action-focused .action-shortcut {
    opacity: 0.9;
}
.tty-action:active {
    background: var(--bg);
}
.tty-action.hidden {
    display: none;
}
.tty-no-results {
    font-size: 14px;
    color: var(--fg-dim);
    opacity: 0.5;
    padding: 8px 4px;
    font-style: italic;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-width: 820px) {
    .container {
        padding: 8px 8px 24px;
    }
    .main-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .col-left {
        max-width: 340px;
    }
    .avatar-wrap {
        max-width: 160px;
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px 16px;
    }
    .topbar-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    #langDropdown .dropdown-menu {
        left: 0;
        transform: none;
    }

    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    body {
        padding: 4px 2px;
    }
    .container {
        padding: 6px 4px 18px;
    }
    .avatar-wrap {
        max-width: 120px;
    }
    .name-title h1 {
        font-size: 24px;
    }
    .skill-item {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    .project-card {
        padding: 14px 14px 16px;
    }
    .contact-links a {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
    .timeline-item .dot {
        display: none;
    }
    .timeline-header, .timeline-meta, .timeline-details {
        margin-left: 0;
    }
    .tty-body {
        padding: 16px;
    }
}

@media print {
    body {
        padding: 0;
        background: #fff;
    }
    .container {
        border: none;
        padding: 20px;
        background: #fff;
    }

    .about-text p,
    .name-title,
    .contact-links,
    .skills-grid,
    .skill-item,
    .project-card,
    .timeline-item,
    .timeline-header,
    .timeline-meta,
    .course-list span,
    .p-tags span {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .section-label,
    .name-title h1,
    .timeline-header,
    .timeline-meta {
        break-after: avoid;
        page-break-after: avoid;
    }
    .about-text,
    .timeline,
    .projects-grid,
    .col-left > div {
        break-inside: avoid-page;
    }
    p, li {
        orphans: 3;
        widows: 3;
    }

    .topbar {
        border-bottom-color: #ccc;
    }
    .topbar-controls .dropdown,
    .topbar-controls .key-hint {
        display: none;
    }
    .modal-overlay {
        display: none !important;
    }
    .avatar-wrap {
        border-color: #ccc;
        background: #f5f5f5;
    }
    .skill-item .tooltip {
        display: none;
    }
    .project-card {
        border-color: #ccc;
        background: #fafafa;
    }
    .timeline-item {
        border-color: #ccc;
        background: #fafafa;
    }
    .projects-grid {
        border-color: #ccc;
    }
    .section-label {
        border-bottom-color: #ccc;
    }
    .contact-links a {
        border-color: #ccc;
    }
    .skill-item {
        border-color: #ccc;
        background: #f5f5f5;
    }
    .skill-item:hover {
        border-color: #ccc;
        background: #f5f5f5;
        color: #333;
    }
    .project-card .p-title {
        color: #0066cc;
    }
    .project-card .p-title:hover {
        color: #0066cc;
    }
    .timeline-header .year {
        color: #cc6600;
    }
    .name-title .title {
        color: #cc6600;
    }
    .contact-links .protected-hidden {
        opacity: 1;
        filter: none;
        pointer-events: auto;
    }
    .contact-links .protected-hidden .tooltip-bot {
        display: none;
    }
}
