/* ==========================================================================
   TUI — terminal-inspired portfolio theme
   Palette: Tokyo Night (dark) / Tokyo Night Day-ish (light)
   ========================================================================== */

:root,
:root[data-theme="dark"] {
    --bg: #16161e;
    --bg-alt: #1a1b26;
    --panel: #1f2335;
    --panel-bar: #24283b;
    --border: #3b4261;
    --fg: #c0caf5;
    --fg-strong: #e4ecff;
    --muted: #787fa8;
    --green: #9ece6a;
    --cyan: #7dcfff;
    --blue: #7aa2f7;
    --magenta: #bb9af7;
    --red: #f7768e;
    --yellow: #e0af68;
    --orange: #ff9e64;
    --accent: var(--green);
    --shadow: 0 12px 40px rgba(0, 0, 0, .45);
    --sel-bg: #33467c;
}

:root[data-theme="light"] {
    --bg: #e6e8ef;
    --bg-alt: #eff1f5;
    --panel: #fbfcfe;
    --panel-bar: #e3e6f0;
    --border: #b6bdd4;
    --fg: #373f5c;
    --fg-strong: #1a2140;
    --muted: #71789b;
    --green: #587539;
    --cyan: #007197;
    --blue: #2e5de9;
    --magenta: #7847bd;
    --red: #d0295c;
    --yellow: #8f6c2c;
    --orange: #b15c00;
    --accent: var(--green);
    --shadow: 0 10px 30px rgba(40, 50, 90, .15);
    --sel-bg: #c3d0f0;
}

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

::selection { background: var(--sel-bg); }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--bg);
    color: var(--fg);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* subtle scanline texture, dark mode only */
:root[data-theme="dark"] body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .12) 2px 4px);
    opacity: .25;
    z-index: 9999;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

main { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

.muted { color: var(--muted); }
.k { color: var(--magenta); }

/* ==========================================================================
   tmux status bar
   ========================================================================== */
.tmux-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--panel-bar);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.tmux-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .45rem 1rem;
}

.tmux-session {
    color: var(--bg);
    background: var(--green);
    padding: 0 .5rem;
    font-weight: 700;
    white-space: nowrap;
}

.tmux-windows {
    display: flex;
    list-style: none;
    gap: .1rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tmux-windows::-webkit-scrollbar { display: none; }

.tmux-windows a {
    display: block;
    padding: .1rem .5rem;
    color: var(--muted);
    white-space: nowrap;
}

.tmux-windows a:hover { color: var(--fg-strong); text-decoration: none; }

.tmux-windows a.active {
    background: var(--panel);
    color: var(--accent);
    font-weight: 700;
}
.tmux-windows a.active::after { content: "*"; }

.tmux-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.tmux-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    background: transparent;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}
.tmux-btn:hover { border-color: var(--accent); color: var(--accent); }

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline; }
:root[data-theme="light"] .icon-moon { display: inline; }
:root[data-theme="light"] .icon-sun { display: none; }

.tmux-clock { color: var(--muted); white-space: nowrap; min-width: 6.5ch; text-align: right; }

.tmux-toggle { display: none; }

@media (max-width: 720px) {
    .tmux-toggle {
        display: inline-flex;
        background: none;
        border: 1px solid var(--border);
        border-radius: 4px;
        color: var(--fg);
        padding: .1rem .5rem;
        cursor: pointer;
        font-size: 1rem;
    }
    .tmux-windows {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--panel-bar);
        border-bottom: 1px solid var(--border);
        padding: .5rem 1rem;
    }
    .tmux-windows.open { display: flex; }
    .tmux-windows a { padding: .45rem .5rem; }
    .tmux-clock { display: none; }
}

/* ==========================================================================
   Windows (cards with titlebar)
   ========================================================================== */
.window {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.window-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    background: var(--panel-bar);
    border-bottom: 1px solid var(--border);
    padding: .4rem .75rem;
    font-size: 12px;
    color: var(--muted);
}

.dots { display: inline-flex; gap: .35rem; }
.dots i {
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    background: var(--red);
}
.dots i:nth-child(2) { background: var(--yellow); }
.dots i:nth-child(3) { background: var(--green); }

.window-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.window-body { padding: 1.1rem 1.25rem; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 3rem 0 1rem; }

.hero-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.hero-shell .window-body { font-size: 15px; }

.shellline { color: var(--muted); margin-top: .9rem; }
.shellline:first-child { margin-top: 0; }

.prompt { color: var(--accent); font-weight: 700; }

.shellout { margin: .35rem 0 0 0; }

.hero-name {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--fg-strong);
    letter-spacing: -.02em;
}

.role-tag {
    display: inline-block;
    margin: .25rem .35rem .25rem 0;
    padding: .1rem .55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
}
.role-phd { color: var(--magenta); border-color: var(--magenta); }
.role-devops { color: var(--cyan); border-color: var(--cyan); }
.role-edu { color: var(--yellow); border-color: var(--yellow); }

.caret {
    display: inline-block;
    width: .6em;
    height: 1.1em;
    background: var(--accent);
    vertical-align: text-bottom;
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-alt);
    color: var(--fg);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.1); color: var(--bg); }

.btn-ghost { background: transparent; }

.hero-photo {
    max-width: 280px;
    width: 100%;
    margin-top: 7rem;
    justify-self: end;
}

.hero-photo .photo-body { padding: 0; }
.hero-photo img {
    display: block;
    width: 100%;
    height: auto;
    filter: saturate(.9);
}

@media (max-width: 800px) {
    .hero-grid { grid-template-columns: 1fr; }
    .hero-photo { max-width: 280px; margin-top: 0; justify-self: start; }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: 3.25rem 0 0; }

.section-head {
    font-size: 15px;
    font-weight: 400;
    border-bottom: 1px dashed var(--border);
    padding-bottom: .55rem;
    margin-bottom: 1.4rem;
}

.ps1 { color: var(--muted); }
.cmd { color: var(--fg-strong); font-weight: 700; }
.cmd::before { content: ""; }

.prose p { margin-bottom: 1rem; }
.prose strong { color: var(--fg-strong); }
.prose a { text-decoration: underline; text-decoration-color: var(--border); }

/* ==========================================================================
   git log timeline (experience)
   ========================================================================== */
.log-group {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    margin: 1.75rem 0 1rem;
}
.log-group:first-child { margin-top: 0; }

.gitlog {
    list-style: none;
    border-left: 2px solid var(--border);
    margin-left: .4rem;
    padding-left: 1.4rem;
}

.commit { position: relative; padding-bottom: 1.6rem; }
.commit:last-child { padding-bottom: .5rem; }

.commit::before {
    content: "";
    position: absolute;
    left: calc(-1.4rem - 6px);
    top: .45rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--yellow);
}

.commit-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }

.commit-hash { color: var(--yellow); font-size: 13px; }

.commit-role { color: var(--fg-strong); font-weight: 700; }

.commit-head { color: var(--cyan); font-size: 13px; }

.commit-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: 13px;
    margin-top: .15rem;
}

.commit-org { color: var(--blue); }
.commit-date { color: var(--muted); }

.commit-points {
    margin: .55rem 0 0;
    padding-left: 1.1rem;
    list-style: none;
}
.commit-points li { margin-bottom: .25rem; }
.commit-points li::before { content: "-"; color: var(--accent); margin-right: .55rem; margin-left: -1.1rem; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }

.tag {
    font-size: 12px;
    color: var(--magenta);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 .45rem;
    background: var(--bg-alt);
}

/* ==========================================================================
   Cards (education, projects)
   ========================================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
}

.card-title { font-size: 16px; color: var(--fg-strong); margin: .35rem 0 .2rem; }

.card-sub { color: var(--blue); font-size: 14px; margin-bottom: .5rem; }

.card-thesis { font-size: 13.5px; margin-bottom: .5rem; }

.card-detail { font-size: 13.5px; color: var(--muted); margin-bottom: .5rem; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: .1rem .55rem;
    border-radius: 4px;
    margin-bottom: .35rem;
}
.badge-gold { background: var(--yellow); color: var(--bg); }
.badge-progress { background: var(--cyan); color: var(--bg); }

.proj-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: 13px;
    margin-bottom: .35rem;
}

/* ==========================================================================
   Publications
   ========================================================================== */
.bibtex {
    font-size: 13.5px;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
}
.bib-at { color: var(--magenta); }
.bib-key { color: var(--yellow); }
.bibtex .k { color: var(--cyan); }

.talks { list-style: none; }
.talks li {
    display: flex;
    flex-direction: column;
    padding: .55rem 0;
    border-bottom: 1px dashed var(--border);
}
.talks li::before { content: "▸ "; color: var(--accent); position: absolute; margin-left: -1.1rem; }
.talks { padding-left: 1.1rem; }
.talk-title { color: var(--fg-strong); }
.talk-meta { color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Skills
   ========================================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.5rem 2.5rem;
}

.skill-title { color: var(--blue); font-size: 14px; margin-bottom: .5rem; }

.pkg-list { list-style: none; font-size: 14px; }
.pkg-list li { padding: .12rem 0; }
.pkg-list li::before { content: "✓ "; color: var(--accent); }

.pkg-name { color: var(--fg); }
.pkg-note { color: var(--muted); font-size: 12.5px; margin-left: .45rem; }

.locale-line {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    font-size: 14px;
}

/* ==========================================================================
   Achievements
   ========================================================================== */
.ach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.25rem;
}

.ach-card {
    display: flex;
    gap: .9rem;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.1rem;
}

.ach-icon { color: var(--yellow); flex-shrink: 0; margin-top: .15rem; }

.ach-title { font-size: 15px; color: var(--fg-strong); }
.ach-sub { font-size: 13.5px; color: var(--cyan); margin: .1rem 0; }
.ach-where { font-size: 12.5px; color: var(--muted); margin-bottom: .3rem; }

/* ==========================================================================
   Contact & footer
   ========================================================================== */
.contact-motd { margin-bottom: 1rem; }

.contact-list { list-style: none; }
.contact-list li { padding: .3rem 0; overflow-wrap: anywhere; }

.footer {
    margin: 4rem 0 0;
    padding: 1.5rem 0 2.5rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.exit-ok { color: var(--green); }

/* ==========================================================================
   Terminal overlay
   ========================================================================== */
.term-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 10, 16, .6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.term-overlay[hidden] { display: none; }

.term-window {
    width: min(860px, 100%);
    height: min(560px, 90vh);
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.term-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
}
.term-close:hover { color: var(--red); }

.term-body {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.1rem;
    font-size: 14px;
    cursor: text;
}

.term-input-line { display: flex; gap: .5rem; align-items: baseline; }

.term-prompt { color: var(--accent); font-weight: 700; white-space: nowrap; }

#term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font: inherit;
    caret-color: var(--accent);
}

.t-line { white-space: pre-wrap; overflow-wrap: anywhere; }
.t-cmd { color: var(--fg-strong); }
.t-cmd::before { content: "hamza@portfolio:~$ "; color: var(--accent); font-weight: 700; }
.t-err { color: var(--red); }
.t-ok { color: var(--green); }
.t-muted { color: var(--muted); }
.t-hl { color: var(--yellow); }
.t-ascii { color: var(--accent); font-size: 11.5px; line-height: 1.25; }
.t-love { color: #ff69b4; text-shadow: 0 0 8px #ff1493; }

.lyna-egg {
    color: #ff69b4;
    font-weight: 700;
    text-shadow: 0 0 10px #ff69b4, 0 0 20px #ff1493;
    display: inline-block;
    animation: nerdy-pulse 1.5s infinite alternate;
}

@keyframes nerdy-pulse {
    from { opacity: .8; transform: scale(1); }
    to { opacity: 1; transform: scale(1.1); }
}

.pixel-heart {
    position: absolute;
    font-size: 24px;
    pointer-events: none;
    z-index: 1000;
    animation: heart-float 2s ease-out forwards;
    filter: drop-shadow(0 0 5px #ff69b4);
}

@keyframes heart-float {
    0% { transform: translateY(0) scale(.5) rotate(0deg); opacity: 0; }
    20% { opacity: 1; transform: translateY(-20px) scale(1.2) rotate(15deg); }
    100% { transform: translateY(-150px) scale(1) rotate(-15deg); opacity: 0; }
}

/* ==========================================================================
   Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .caret { animation: none; }
    *, *::before, *::after { transition: none !important; animation-duration: .001s !important; }
}
