/* -------------------------------------------------------------------- */
/* Tokens                                                                */
/* -------------------------------------------------------------------- */

:root {
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

    --accent: #0284c7;
    --accent-strong: #0369a1;

    --bg: #f7f8fa;
    --bg-alt: #eef0f3;
    --surface: #ffffff;
    --border: #dde1e6;
    --text: #12161c;
    --text-muted: #565d68;

    --shadow: 0 1px 2px rgba(20, 24, 30, 0.06), 0 8px 24px rgba(20, 24, 30, 0.06);
    --radius: 10px;
    --transition: 160ms ease;
    --max-width: 960px;
}

/* Dark by default (system preference) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --accent: #38bdf8;
        --accent-strong: #7dd3fc;

        --bg: #0a0e14;
        --bg-alt: #0f141c;
        --surface: #121824;
        --border: #232b38;
        --text: #e6e9ef;
        --text-muted: #8b93a3;

        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    }
}

/* Manual override wins either direction */
:root[data-theme="dark"] {
    --accent: #38bdf8;
    --accent-strong: #7dd3fc;

    --bg: #0a0e14;
    --bg-alt: #0f141c;
    --surface: #121824;
    --border: #232b38;
    --text: #e6e9ef;
    --text-muted: #8b93a3;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
    --accent: #0284c7;
    --accent-strong: #0369a1;

    --bg: #f7f8fa;
    --bg-alt: #eef0f3;
    --surface: #ffffff;
    --border: #dde1e6;
    --text: #12161c;
    --text-muted: #565d68;

    --shadow: 0 1px 2px rgba(20, 24, 30, 0.06), 0 8px 24px rgba(20, 24, 30, 0.06);
}

/* -------------------------------------------------------------------- */
/* Reset & base                                                          */
/* -------------------------------------------------------------------- */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

/* Subtle CRT scanline texture, dark mode only */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 1px,
        transparent 3px
    );
}

:root[data-theme="dark"] body::before {
    opacity: 1;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body::before {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-family: var(--font-mono);
    letter-spacing: -0.01em;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.text-center {
    text-align: center;
}

.skip-link {
    position: absolute;
    left: -999px;
    top: auto;
    background: var(--accent);
    color: #06131f;
    padding: 10px 16px;
    border-radius: 6px;
    z-index: 100;
}

.skip-link:focus {
    left: 16px;
    top: 16px;
}

/* -------------------------------------------------------------------- */
/* Header / nav                                                          */
/* -------------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
    color: var(--text);
}

.brand .accent {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    position: relative;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    padding-bottom: 2px;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 200ms ease;
}

.nav-links a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.82rem;
    gap: 6px;
}

.btn-sm .icon {
    width: 15px;
    height: 15px;
}

.icon-download {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-right: 2px;
}

.resume-btn-inline {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 640px) {
    #resume-btn span,
    #resume-btn {
        white-space: nowrap;
    }
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle .icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.icon-sun { display: block; }
.icon-moon { display: none; }

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

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: none; }
    :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* -------------------------------------------------------------------- */
/* Hero                                                                   */
/* -------------------------------------------------------------------- */

.hero {
    padding: 120px 0 96px;
}

.hero-prompt {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 18px;
}

.prompt-user {
    color: var(--accent);
}

.prompt-sep {
    color: var(--text-muted);
}

.cursor {
    display: inline-block;
    color: var(--accent);
    animation: blink 1.1s steps(1) infinite;
}

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

.hero-title {
    font-size: clamp(2.4rem, 6vw, 4rem);
    line-height: 1.05;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1.1rem;
    margin: 0 0 24px;
}

.hero-lead {
    max-width: 560px;
    color: var(--text-muted);
    font-size: 1.05rem;
    margin: 0 0 36px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

/* -------------------------------------------------------------------- */
/* Buttons                                                                */
/* -------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: #06131f;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* -------------------------------------------------------------------- */
/* Sections                                                               */
/* -------------------------------------------------------------------- */

.section {
    padding: 88px 0;
}

.section-alt {
    background: var(--bg-alt);
}

/* Highlight: hovering a card/window/tag/entry dims every OTHER one on the
   page (not the section around it, and never headings/body text/nav —
   those stay untouched and clear at all times). JS toggles .is-focused
   on the hovered item and .has-focus on <main> (see script.js). */
main.has-focus .term-window:not(.is-focused),
main.has-focus .project-card:not(.is-focused),
main.has-focus .skill-tags li:not(.is-focused),
main.has-focus .experience-entry:not(.is-focused) {
    opacity: 0.5;
}

/* Hovering a tool tag or an experience entry is a more specific target than
   the term-window that contains it — don't dim the tag/entry's own
   container. */
main.has-focus .term-window:has(.skill-tags li.is-focused, .experience-entry.is-focused) {
    opacity: 1;
}

.section-command {
    font-family: var(--font-mono);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 16px;
}

/* -------------------------------------------------------------------- */
/* Terminal window chrome                                                */
/* -------------------------------------------------------------------- */

.term-dots {
    display: inline-flex;
    gap: 6px;
    vertical-align: middle;
}

.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.term-dot.red { background: #ff5f56; }
.term-dot.yellow { background: #ffbd2e; }
.term-dot.green { background: #27c93f; }

.term-window {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: opacity 300ms ease, border-color var(--transition);
}

.term-window:hover {
    border-color: var(--accent);
}

/* Don't highlight the about/experience term-window's own border when the
   cursor is over a more specific nested target (a tool tag, an experience
   entry) — the nested item shows its own highlight instead. */
.term-window:has(.skill-tags li:hover, .experience-entry:hover) {
    border-color: var(--border);
}

.term-titlebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}

.term-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.term-body {
    padding: 32px;
}

@media (max-width: 640px) {
    .term-body {
        padding: 22px;
    }
}

/* -------------------------------------------------------------------- */
/* About                                                                  */
/* -------------------------------------------------------------------- */

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 48px;
}

.about-bio p {
    color: var(--text-muted);
    margin: 0 0 18px;
}

.skills-heading {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0 0 16px;
}

.skill-tags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tags li {
    position: relative;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    background: var(--surface);
    cursor: pointer;
    transition: opacity 300ms ease, border-color var(--transition), color var(--transition), background var(--transition);
}

.skill-tags li:hover {
    border-color: var(--accent);
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

@media (max-width: 720px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

/* -------------------------------------------------------------------- */
/* Experience                                                            */
/* -------------------------------------------------------------------- */

.experience-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.experience-entry {
    position: relative;
    padding: 20px 16px;
    margin: 0 -16px;
    border-radius: 8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: opacity 300ms ease, border-color var(--transition), background var(--transition);
}

.experience-entry:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.experience-entry:first-child {
    padding-top: 0;
}

.experience-entry:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.experience-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.experience-head h3 {
    margin: 0;
    font-size: 1rem;
}

.experience-dates {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.experience-role {
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
}

.experience-blurb {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    max-width: 640px;
}

/* -------------------------------------------------------------------- */
/* Portfolio                                                             */
/* -------------------------------------------------------------------- */

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.project-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: opacity 300ms ease, transform 220ms ease, border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.project-trigger {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.project-trigger img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.project-info {
    padding: 16px 18px;
}

.project-info h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}

.prefix {
    color: var(--accent);
    font-weight: 400;
}

.project-stack {
    margin: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.5;
}

.project-details {
    padding: 0 18px 20px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.project-details p {
    margin: 0 0 12px;
}

.project-details ul {
    margin: 0 0 12px;
    padding-left: 18px;
}

.project-details li {
    margin-bottom: 6px;
}

.project-detail-img {
    border-radius: 6px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.project-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* -------------------------------------------------------------------- */
/* Contact                                                                */
/* -------------------------------------------------------------------- */

.contact-window {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

.contact-window .term-titlebar {
    text-align: left;
}

.contact-lead {
    color: var(--text-muted);
    max-width: 440px;
    margin: 0 auto 32px;
}

.contact-email {
    font-family: var(--font-mono);
}

/* -------------------------------------------------------------------- */
/* Footer                                                                 */
/* -------------------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.copyright {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.social-links a {
    color: var(--text-muted);
    display: inline-flex;
}

.social-links a:hover {
    color: var(--accent);
}

.social-links .icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* -------------------------------------------------------------------- */
/* Responsive                                                            */
/* -------------------------------------------------------------------- */

@media (max-width: 640px) {
    .nav-links {
        display: none;
    }

    .hero {
        padding: 88px 0 64px;
    }
}

/* -------------------------------------------------------------------- */
/* Resume PDF (window.print output)                                     */
/* -------------------------------------------------------------------- */

.resume-print {
    display: none;
    font-family: var(--font-body);
    color: #111;
    max-width: 7.5in;
    margin: 0 auto;
}

@page {
    margin: 0.6in;
}

@media print {
    /* Force light rendering for print regardless of the site's own
       dark/light toggle or the OS/browser's dark mode. Without this,
       `color-scheme: dark light` (declared for the on-screen page) can
       lead the browser to paint its default canvas/background dark when
       the system is in dark mode, leaving dark text on a dark page. */
    html {
        color-scheme: light;
        background: #fff !important;
    }

    body.print-resume > *:not(#resume-print) {
        display: none !important;
    }

    body.print-resume::before {
        content: none !important;
        display: none !important;
    }

    body.print-resume #resume-print {
        display: block;
    }

    body.print-resume {
        background: #fff;
        color: #111;
    }
}

.resume-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 2px solid #111;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.resume-name {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    margin: 0;
    color: #111;
}

.resume-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #444;
    margin: 4px 0 0;
}

.resume-contact {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #444;
    line-height: 1.6;
}

.resume-section {
    margin-bottom: 22px;
}

.resume-section h2 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #444;
    border-bottom: 1px solid #ccc;
    padding-bottom: 6px;
    margin: 0 0 12px;
}

.resume-skills {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.7;
    color: #222;
}

.resume-job {
    margin-bottom: 16px;
}

.resume-job-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.resume-job-head h3 {
    font-family: var(--font-body);
    font-size: 0.98rem;
    margin: 0;
    color: #111;
}

.resume-job-dates {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: #555;
    white-space: nowrap;
}

.resume-job-role {
    font-style: italic;
    font-size: 0.85rem;
    margin: 2px 0 6px;
    color: #333;
}

.resume-job-blurb {
    margin: 0;
    font-size: 0.85rem;
    color: #222;
}
