/*-----------------------------------*\
  #style.css v4 — Editorial magazine
  Minimalist: black/white/grey + one accent
  Light / Dark auto-adapt + manual toggle
\*-----------------------------------*/

/* ====================================
   1. SHARED TOKENS
==================================== */
:root {
    /* typography */
    --ff-serif: 'Noto Serif SC', 'Songti SC', 'STSong', Georgia, 'Times New Roman', serif;
    --ff-sans: 'Noto Sans Display', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ff-mono: 'Noto Sans Mono', 'Noto Sans SC', ui-monospace, 'Cascadia Code', Consolas, monospace;

    /* fluid type */
    --fs-hero: clamp(2.6rem, 6.5vw, 4.6rem);
    --fs-h2: clamp(1.55rem, 3vw, 2.3rem);
    --fs-h3: 1.05rem;
    --fs-h4: 1rem;
    --fs-body: clamp(0.95rem, 0.5vw + 0.85rem, 1.02rem);
    --fs-sm: 0.85rem;
    --fs-xs: 0.78rem;

    /* radii — editorial, slightly squared */
    --r-lg: 14px;
    --r-md: 10px;
    --r-sm: 6px;
    --r-pill: 999px;

    /* shadows — none in print style */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-2: 0 6px 24px rgba(0, 0, 0, 0.1);

    /* motion */
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --t-fast: 0.18s var(--ease);
    --t-med: 0.32s var(--ease);

    /* layout */
    --max-w: 1080px;
    --nav-h: 56px;
}

/* ====================================
   2. DARK THEME (default)
==================================== */
:root {
    --bg: #0b0b0c;
    --surface-1: #121215;
    --surface-2: #17171b;
    --surface-3: #1e1e23;
    --border: rgba(242, 241, 236, 0.12);
    --border-strong: rgba(242, 241, 236, 0.22);

    --accent: #d9553a;
    --accent-2: #e0694f;
    --accent-soft: rgba(217, 85, 58, 0.12);
    --accent-faint: rgba(217, 85, 58, 0.06);

    --text-1: #f2f1ec;
    --text-2: #a6a59d;
    --text-3: #82827a;

    --theme-icon: '\f186'; /* fa-moon */
}

/* Light theme: auto (no-JS fallback) */
@media (prefers-color-scheme: light) {
    :root:not([data-theme='dark']) {
        --bg: #f6f5f1;
        --surface-1: #ffffff;
        --surface-2: #efeee9;
        --surface-3: #e5e4de;
        --border: rgba(20, 20, 18, 0.12);
        --border-strong: rgba(20, 20, 18, 0.2);

        --accent: #b03420;
        --accent-2: #c23f29;
        --accent-soft: rgba(176, 52, 32, 0.08);
        --accent-faint: rgba(176, 52, 32, 0.04);

        --text-1: #1a1a17;
        --text-2: #4d4d47;
        --text-3: #76766e;

        --theme-icon: '\f185'; /* fa-sun */
    }
}

/* Light theme: forced via toggle */
:root[data-theme='light'] {
    --bg: #f6f5f1;
    --surface-1: #ffffff;
    --surface-2: #efeee9;
    --surface-3: #e5e4de;
    --border: rgba(20, 20, 18, 0.12);
    --border-strong: rgba(20, 20, 18, 0.2);

    --accent: #b03420;
    --accent-2: #c23f29;
    --accent-soft: rgba(176, 52, 32, 0.08);
    --accent-faint: rgba(176, 52, 32, 0.04);

    --text-1: #1a1a17;
    --text-2: #4d4d47;
    --text-3: #76766e;

    --theme-icon: '\f185'; /* fa-sun */
}

/* ====================================
   3. RESET & BASE
==================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--ff-sans);
    font-size: var(--fs-body);
    font-weight: 400;
    line-height: 1.85;
    color: var(--text-1);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    transition: background var(--t-med), color var(--t-med);
}

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

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--t-fast);
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* anchor offset below sticky nav */
section {
    scroll-margin-top: calc(var(--nav-h) + 16px);
}

/* long tokens / urls never break the layout */
a, p, span, h1, h2, h3, h4, li {
    overflow-wrap: anywhere;
}

.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 100;
    padding: 10px 16px;
    border-radius: 0 0 var(--r-md) var(--r-md);
    background: var(--accent);
    color: var(--bg);
    font-size: var(--fs-sm);
}

.skip-link:focus {
    top: 0;
}

/* ====================================
   4. TOP NAV
==================================== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--nav-h);
    padding: 0 max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
    border-bottom: 1px solid var(--border);
    transition: background var(--t-med);
}

/* mobile-first order: logo | theme-toggle | nav (scrollable) */
.logo {
    order: 1;
    font-family: var(--ff-serif);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-1);
    flex-shrink: 0;
}

.logo:hover {
    color: var(--accent);
}

.theme-toggle {
    order: 2;
    margin-left: auto;
}

.nav {
    order: 3;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-left: auto;
}

.nav::-webkit-scrollbar {
    display: none;
}

.nav-link {
    position: relative;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-3);
    white-space: nowrap;
    transition: color var(--t-fast), background var(--t-fast);
}

.nav-link:hover {
    color: var(--text-1);
    background: var(--surface-2);
}

.nav-link.active {
    color: var(--accent);
}

.nav-link.active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 3px;
    height: 2px;
    background: var(--accent);
}

/* separator between tabs and toggle (desktop only) */
.theme-toggle {
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    color: var(--text-3);
    transition: color var(--t-fast), background var(--t-fast);
}

.theme-toggle:hover {
    color: var(--text-1);
    background: var(--surface-2);
}

.theme-toggle::before {
    content: "";
    display: none;
    width: 1px;
    height: 16px;
    margin-right: 12px;
    vertical-align: -3px;
    background: var(--border-strong);
}

/* theme icon via CSS var (syncs with JS) */
.theme-toggle i::before {
    content: var(--theme-icon);
}

/* ====================================
   5. MAIN LAYOUT
==================================== */
main {
    width: min(100%, var(--max-w));
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 72px 0;
    border-bottom: 1px solid var(--border);
}

.section:last-child {
    border-bottom: none;
}

/* ====================================
   6. HERO
==================================== */
.hero {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 40px 0 8px;
}

.avatar {
    flex-shrink: 0;
    border-radius: var(--r-pill);
    padding: 3px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
}

.avatar img {
    width: 96px;
    height: 96px;
    border-radius: var(--r-pill);
    object-fit: cover;
}

.hero-body {
    min-width: 0;
}

.hero-meta {
    margin-bottom: 10px;
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-3);
}

.hero-name {
    font-family: var(--ff-serif);
    font-size: var(--fs-hero);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: var(--text-1);
}

.hero-intro {
    margin-top: 18px;
    color: var(--text-2);
    font-size: 1.02rem;
    line-height: 1.9;
}

.hero-love {
    display: inline-block;
    margin-left: 6px;
    color: var(--accent);
}

/* fingerprint block */
.fingerprint {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin-top: 22px;
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
    line-height: 1.8;
}

.fingerprint a {
    color: var(--text-3);
}

.fingerprint a:hover {
    color: var(--accent-2);
}

/* ====================================
   7. SECTION HEADING
==================================== */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin: 40px 0 32px;
}

.sec-num {
    font-family: var(--ff-mono);
    font-size: 0.85rem;
    color: var(--accent);
    flex-shrink: 0;
}

.sec-title {
    font-family: var(--ff-serif);
    font-size: var(--fs-h2);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-1);
    flex-shrink: 0;
}

.sec-rule {
    flex: 1;
    min-width: 24px;
    border-bottom: 1px solid var(--border-strong);
    transform: translateY(-6px);
}

/* ====================================
   8. SERVICE GRID
==================================== */
.service-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.service-item {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    padding: 22px 24px;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.service-item:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
    transform: translateY(-1px);
}

.service-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    font-size: 1.6rem;
    line-height: 40px;
    text-align: center;
    color: var(--text-3);
    transition: color var(--t-fast);
}

.service-item:hover .service-icon {
    color: var(--accent);
}

.service-body {
    min-width: 0;
}

.service-title {
    font-size: var(--fs-h4);
    font-weight: 600;
    color: var(--text-1);
}

.service-text {
    margin-top: 4px;
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1.8;
}

/* ====================================
   9. RESUME
==================================== */
.resume-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
}

.resume-col {
    min-width: 0;
}

.resume-col.downloads {
    margin-top: 48px;
}

.col-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-3);
}

/* My Friends heading — clear separation from the My Love block above */
.friend-list + .col-title {
    margin-top: 28px;
}

.col-title i {
    color: var(--accent);
}

.timeline-item {
    position: relative;
    padding: 0 0 26px 22px;
    border-left: 1px solid var(--border-strong);
}

.timeline-item:last-child {
    padding-bottom: 4px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -4.5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}

.timeline-date {
    display: block;
    margin-bottom: 4px;
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--accent-2);
}

.timeline-title {
    font-size: var(--fs-h4);
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-1);
}

.now-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: var(--r-pill);
    font-family: var(--ff-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bg);
    background: var(--accent);
    vertical-align: 2px;
}

.timeline-title a {
    color: inherit;
}

.timeline-title a:hover,
.timeline-title a:hover .timeline-text {
    color: var(--accent-2);
}

.timeline-text {
    margin-top: 4px;
    color: var(--text-2);
    font-size: var(--fs-sm);
    line-height: 1.8;
}

.timeline-text.note {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
}

/* ====================================
   10. FRIENDS
==================================== */
.friend-list {
    display: flex;
    flex-direction: column;
}

.friends-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.friend-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}

.friend-item:first-child {
    border-top: 1px solid var(--border);
}

.friend-name {
    font-size: var(--fs-h4);
    font-weight: 600;
    color: var(--text-1);
}

.friend-link {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
}

.friend-item:hover .friend-name {
    color: var(--accent);
}

.friend-item:hover .friend-link {
    color: var(--accent-2);
}

/* love-item keeps a subtle emphasis without breaking the list rhythm */
.love-item .friend-name {
    font-size: 1.15rem;
    font-weight: 700;
}

/* ====================================
   11. SITES
==================================== */
.mapbox {
    position: relative;
    height: 240px;
    margin-bottom: 48px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface-1);
}

.mapbox iframe {
    width: 100%;
    height: 1100px;
    border: none;
    display: block;
    overflow: hidden;
}

.ext-link {
    color: var(--text-3);
    font-size: 0.85rem;
}

.ext-link:hover {
    color: var(--accent-2);
}

.link-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 48px;
}

.link-item {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 14px;
    padding: 15px 4px;
    border-bottom: 1px solid var(--border);
}

.link-item:first-child {
    border-top: 1px solid var(--border);
}

.link-name {
    font-size: var(--fs-h4);
    font-weight: 600;
    color: var(--text-1);
}

.link-name a:hover {
    color: var(--accent-2);
}

.link-name.dead {
    color: var(--text-3);
    font-weight: 400;
}

.link-sep {
    color: var(--border-strong);
}

.link-note {
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
    margin-left: auto;
    text-align: right;
}

.link-note ins {
    text-decoration: none;
    color: var(--text-2);
}

/* ====================================
   12. BACK TO TOP
==================================== */
.to-top {
    position: fixed;
    right: 22px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 55;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-2);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast), transform var(--t-fast);
}

.to-top:hover {
    color: var(--bg);
    background: var(--accent);
    border-color: var(--accent);
}

.to-top[hidden] {
    display: none;
}

.to-top:active {
    transform: scale(0.94);
}

/* ====================================
   13. FOOTER
==================================== */
.site-footer {
    padding: 28px 20px calc(32px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
}

.footer-text {
    width: min(100%, var(--max-w));
    margin: 0 auto;
    font-family: var(--ff-mono);
    font-size: var(--fs-xs);
    color: var(--text-3);
    text-align: center;
    line-height: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 0;
}

.footer-text .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--text-3);
    transition: color var(--t-fast);
}

/* automatic slash separators between adjacent badges */
.footer-text .badge + .badge::before {
    content: "/";
    color: var(--border-strong);
    margin: 0 10px;
}

/* whole badge (icon + text) acts as one hover / click target */
.footer-text .badge a {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
}

.footer-text .badge:hover,
.footer-text .badge:hover a {
    color: var(--accent-2);
}

.footer-text a {
    color: var(--text-3);
}

.footer-text a:hover {
    color: var(--accent-2);
}

.hide {
    display: none !important;
}

/* ====================================
   13. SCROLL REVEAL
   Editorial tone favours immediate readability.
   The class is kept as a semantic marker for future motion work.
==================================== */

/* ====================================
   14. SCROLLBAR (desktop)
==================================== */
@media (min-width: 1024px) {
    body::-webkit-scrollbar {
        width: 12px;
    }

    body::-webkit-scrollbar-track {
        background: var(--bg);
    }

    body::-webkit-scrollbar-thumb {
        border: 3px solid var(--bg);
        border-radius: 12px;
        background: var(--border-strong);
    }

    body::-webkit-scrollbar-thumb:hover {
        background: var(--text-3);
    }
}

/* ====================================
   15. RESPONSIVE
==================================== */
/* >= 480px: hero inline */
@media (min-width: 480px) {
    .nav-link {
        padding: 8px 16px;
    }
}

/* >= 768px: two columns kick in */
@media (min-width: 768px) {
    .section {
        padding: 96px 0;
    }

    /* desktop order: logo | links | theme-toggle */
    .nav {
        order: 2;
        margin-left: 0;
    }

    .theme-toggle {
        order: 3;
        margin-left: auto;
    }

    .theme-toggle::before {
        display: inline-block;
    }

    .hero {
        flex-direction: row;
        align-items: flex-start;
        gap: 28px;
        padding-top: 76px;
    }

    .service-list {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .resume-grid {
        grid-template-columns: 1fr 1fr;
        gap: 56px;
    }

    .friends-grid,
    .link-grid {
        grid-template-columns: 1fr 1fr;
        column-gap: 48px;
    }

    .link-item .link-note {
        margin-left: 0;
        text-align: left;
    }
}

/* >= 1024px: breathe more */
@media (min-width: 1024px) {
    main {
        padding-inline: 32px;
    }

    .section {
        padding: 120px 0;
    }

    .hero {
        padding-top: 96px;
    }

    .section-head {
        margin: 56px 0 40px;
    }
}

/* ====================================
   16. REDUCED MOTION
==================================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ====================================
   17. PRINT
==================================== */
@media print {
    .site-nav, .to-top {
        display: none !important;
    }

    body {
        background: #ffffff;
        color: #1a1a17;
    }

    .section {
        padding: 24px 0;
        border-bottom: 1px solid #ddd;
        page-break-inside: avoid;
    }

    main {
        max-width: 100%;
        padding: 0;
    }

    a {
        color: #1a1a17;
    }

    .mapbox {
        display: none;
    }

    .resume-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}
