/* ==========================================================================
   GetAns — WatchOS Equation Solver Design System
   Editorial · Minimal · Warm Humanist · Built in Public
   Aligned with kryptongao.github.io
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Surface & ink */
    --bg:            #FAFAF7;   /* warm off-white / alabaster */
    --bg-2:          #F3F1EA;   /* alt section cream */
    --surface:       #FFFFFF;
    --surface-soft:  #F6F4EE;
    --text:          #14161A;   /* near-charcoal */
    --text-2:        #3C3F46;   /* body text */
    --muted:         #6B6F76;   /* secondary copy */
    --faint:         #9AA0A8;   /* captions & subtle lines */
    --line:          #E6E2D9;   /* warm hairline */
    --line-strong:   #D6D1C6;

    /* Accent — refined teal & warm terracotta */
    --accent:        #2E8F86;
    --accent-hover:  #24766E;
    --accent-2:      #D7765A;   /* warm clay, for numerals & kickers */
    --accent-soft:   rgba(46, 143, 134, 0.08);
    --accent-line:   rgba(46, 143, 134, 0.22);

    /* Links */
    --link:          #2E8F86;
    --link-hover:    #24766E;

    /* Typography */
    --font-serif: "Lora", Georgia, "Times New Roman", "Songti SC", serif;
    --font-sans:  "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono:  ui-monospace, SFMono-Regular, Menlo, "SF Mono", monospace;

    /* Spacing scale */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  24px;
    --space-6:  32px;
    --space-7:  48px;
    --space-8:  64px;
    --space-9:  96px;
    --space-10: 128px;

    /* Radius */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 18px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgb(20 22 26 / 0.04);
    --shadow-md: 0 6px 24px -10px rgb(20 22 26 / 0.12);
    --shadow-lg: 0 24px 60px -24px rgb(20 22 26 / 0.16);

    /* Layout */
    --shell:        min(calc(100% - 48px), 1120px);
    --shell-narrow: min(calc(100% - 48px), 860px);
    --masthead-h:   64px;

    /* Motion */
    --ease:     cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --dur-fast: 0.18s;
    --dur:      0.32s;
    --dur-slow: 0.6s;
}

html[data-theme="dark"] {
    --bg:            #0E1014;   /* obsidian deep dark */
    --bg-2:          #14171D;   /* alt panel dark */
    --surface:       #181C23;
    --surface-soft:  #14171D;
    --text:          #ECEAE4;
    --text-2:        #C0BDB6;
    --muted:         #8A8E96;
    --faint:         #5C616B;
    --line:          #262A32;
    --line-strong:   #333943;

    --accent:        #4FB0A4;
    --accent-hover:  #6BC4B8;
    --accent-2:      #E8917A;
    --accent-soft:   rgba(79, 176, 164, 0.10);
    --accent-line:   rgba(79, 176, 164, 0.28);

    --link:          #4FB0A4;
    --link-hover:    #6BC4B8;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-md: 0 6px 24px -10px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 24px 60px -24px rgb(0 0 0 / 0.6);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--masthead-h) + 20px);
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    letter-spacing: -0.01em;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
    overflow-x: hidden;
}

a {
    color: var(--link);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--dur-fast) ease;
}
a:hover { color: var(--link-hover); }

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

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

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

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

/* --------------------------------------------------------------------------
   3. Icon sprite & basic icons
   -------------------------------------------------------------------------- */
.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   4. Layout shells
   -------------------------------------------------------------------------- */
.shell {
    width: var(--shell);
    max-width: 100%;
    margin: 0 auto;
}

.shell-narrow {
    width: var(--shell-narrow);
    max-width: 100%;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   5. Masthead + navigation
   -------------------------------------------------------------------------- */
.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    flex: 0 0 auto;
    transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.masthead-inner {
    width: var(--shell);
    max-width: 100%;
    margin: 0 auto;
}

.site-nav {
    min-height: var(--masthead-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* Wordmark */
.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 2px;
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-decoration: none;
    line-height: 1;
}
.wordmark:hover { color: var(--text); }
.wordmark img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}
.wordmark b { color: var(--accent); font-weight: 700; }
.wordmark span {
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: stretch;
    min-height: var(--masthead-h);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--masthead-h);
    padding: 0 14px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--dur-fast) ease;
}
.nav-links a:hover,
.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active { font-weight: 600; }

.nav-links a::after {
    position: absolute;
    right: 14px;
    bottom: 14px;
    left: 14px;
    height: 2px;
    background: var(--accent);
    content: "";
    opacity: 0;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform var(--dur) var(--ease), opacity var(--dur-fast) ease;
}
.nav-links a:hover::after,
.nav-links a.is-active::after { opacity: 1; transform: scaleX(1); }

.control-buttons { display: flex; align-items: center; gap: 8px; }

.header-ext-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--dur-fast) ease;
}
.header-ext-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface-soft);
}
.header-ext-link .icon { width: 11px; height: 11px; }

.control-btn,
.nav-toggle {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background-color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.control-btn:hover,
.nav-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.control-btn:active { transform: scale(0.94); }
.nav-toggle { display: none; }

/* Scroll progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: 0 0;
    z-index: 60;
    pointer-events: none;
    transition: transform 0.08s linear;
}

/* --------------------------------------------------------------------------
   6. Typography primitives
   -------------------------------------------------------------------------- */
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 var(--space-3);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.kicker::before {
    content: "";
    width: 20px;
    height: 1px;
    background: var(--accent);
}

.eyebrow {
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.display {
    margin: 0;
    color: var(--text);
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.lead {
    margin: 0;
    color: var(--text-2);
    font-family: var(--font-serif);
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.005em;
}

.lede {
    margin: 0;
    color: var(--text-2);
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 62ch;
}

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

/* --------------------------------------------------------------------------
   7. Section primitives
   -------------------------------------------------------------------------- */
.section {
    padding: var(--space-9) 0;
    border-top: 1px solid var(--line);
    position: relative;
}
.section:first-of-type { border-top: 0; }
.section--alt { background: var(--bg-2); }
.section--tight { padding: var(--space-7) 0; }

.section-head {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: var(--space-6);
    align-items: baseline;
    margin-bottom: var(--space-7);
}

.section-index {
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.section-title {
    margin: 0;
    color: var(--text);
    font-family: var(--font-serif);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.section-sub {
    margin: var(--space-3) 0 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.65;
    max-width: 62ch;
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1px solid var(--text);
    border-radius: var(--radius-pill);
    background: var(--text);
    color: var(--bg);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.btn:hover {
    color: var(--bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); }

.btn .arrow { transition: transform var(--dur) var(--ease); width: 13px; height: 13px; }
.btn:hover .arrow { transform: translate(3px, -3px); }

.btn--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line-strong);
}
.btn--ghost:hover {
    color: var(--text);
    border-color: var(--text);
    background: var(--surface-soft);
    box-shadow: var(--shadow-sm);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

/* --------------------------------------------------------------------------
   9. Hero
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    padding: clamp(64px, 12vh, 120px) 0 var(--space-8);
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 35%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 35%, #000 30%, transparent 75%);
    opacity: 0.45;
}

.hero-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    width: 70vw;
    height: 70vw;
    max-width: 900px;
    max-height: 900px;
    transform: translateX(-50%);
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 60%);
    filter: blur(20px);
}

.hero-inner {
    position: relative;
    z-index: 2;
    width: var(--shell);
    max-width: 100%;
    margin: 0 auto;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}
.hero-top .eyebrow { white-space: nowrap; }

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}
.hero-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-line);
    animation: pulse 2.4s var(--ease) infinite;
}

.hero-name {
    font-size: clamp(2.8rem, 7vw, 5.2rem);
    letter-spacing: -0.04em;
    line-height: 1.02;
    margin-bottom: var(--space-4);
}
.hero-name em { font-style: normal; color: var(--accent); }

.hero-tagline-cn {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: var(--space-4);
    letter-spacing: -0.01em;
}

.hero-sub {
    margin: 0 0 var(--space-5);
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.7;
    max-width: 64ch;
}

.hero-actions {
    margin-bottom: var(--space-8);
}

/* Hero Showcase Container */
.hero-showcase {
    position: relative;
    margin: 0 auto var(--space-8);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: var(--space-6);
    align-items: center;
}

.showcase-frame {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: var(--space-5);
    overflow: hidden;
}

.showcase-frame img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
}

.showcase-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.showcase-note-card {
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) ease;
}
.showcase-note-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-line);
}
.showcase-note-card .note-tag {
    display: inline-block;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.showcase-note-card h4 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.showcase-note-card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-7);
    padding-top: var(--space-6);
    border-top: 1px solid var(--line);
}
.hero-meta-item { min-width: 0; }
.hero-meta-item .eyebrow { display: block; margin-bottom: 4px; }
.hero-meta-item p { margin: 0; color: var(--text-2); font-size: 0.92rem; line-height: 1.5; }

/* --------------------------------------------------------------------------
   10. Stats strip
   -------------------------------------------------------------------------- */
.stats-strip {
    position: relative;
    z-index: 2;
    margin-bottom: var(--space-8);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-item {
    background: var(--surface);
    padding: var(--space-5) var(--space-4);
    text-align: center;
    transition: background-color var(--dur-fast) ease;
}
.stat-item:hover { background: var(--surface-soft); }

.stat-value {
    color: var(--accent-2);
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3.6vw, 2.6rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.03em;
}
.stat-label {
    margin-top: 6px;
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 600;
}
.stat-detail {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.45;
}

/* --------------------------------------------------------------------------
   11. Solvers Grid (01 / Solvers)
   -------------------------------------------------------------------------- */
.solvers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-4);
}

.solver-card {
    display: flex;
    flex-direction: column;
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease;
    position: relative;
}
.solver-card:hover {
    border-color: var(--accent-line);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.solver-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: var(--space-3);
}

.solver-card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.solver-card:hover .solver-card-icon {
    transform: scale(1.06);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}
.solver-card-icon .icon {
    width: 20px;
    height: 20px;
}

.solver-card-num {
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.solver-card-title {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.solver-card-title span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--faint);
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.solver-card-formula {
    display: inline-block;
    padding: 3px 8px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent);
    margin-bottom: var(--space-3);
    word-break: break-all;
}

.solver-card-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 0.88rem;
    line-height: 1.6;
    flex-grow: 1;
}

.solver-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
}

.tag {
    padding: 3px 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: var(--surface-soft);
}

/* --------------------------------------------------------------------------
   12. Feature rows (02 / Derivations & Charts)
   -------------------------------------------------------------------------- */
.feature-row {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: var(--space-7);
    align-items: center;
    padding: var(--space-7) 0;
    border-top: 1px solid var(--line);
}
.feature-row:first-of-type { border-top: 0; }
.feature-row.is-reversed {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.feature-text { min-width: 0; }
.feature-tag {
    display: inline-block;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

.feature-title {
    margin: 0 0 var(--space-3);
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
}

.feature-desc {
    margin: 0 0 var(--space-4);
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.7;
}

.feature-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-2);
    font-size: 0.9rem;
    line-height: 1.7;
}
.feature-list li + li { margin-top: 6px; }
.feature-list li::marker { color: var(--accent); font-weight: 700; }

.feature-media {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease);
}
.feature-media:hover {
    transform: scale(1.015);
    box-shadow: var(--shadow-lg);
}
.feature-media img {
    width: 100%;
    height: auto;
    display: block;
}

/* --------------------------------------------------------------------------
   13. Tools & Keyboard (03 / Tools)
   -------------------------------------------------------------------------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.tool-card {
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease);
}
.tool-card:hover {
    border-color: var(--accent-line);
    transform: translateY(-2px);
}
.tool-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
    transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.tool-card:hover .tool-card-icon {
    transform: scale(1.06);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}
.tool-card-icon .icon {
    width: 22px;
    height: 22px;
}
.tool-card-title {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.tool-card-title span {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--faint);
    font-weight: 400;
    margin-top: 2px;
}
.tool-card-desc {
    margin: 0;
    color: var(--text-2);
    font-size: 0.86rem;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   14. Architecture & Code Panels (04 / Architecture)
   -------------------------------------------------------------------------- */
.tech-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-6);
}
.tech-chip {
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-2);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.tech-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.code-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-6);
}
html[data-theme="dark"] .code-panel {
    background: var(--surface);
    border-color: var(--line);
}

.code-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.05em;
}
.code-panel-dots {
    display: flex;
    gap: 6px;
}
.code-panel-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--line-strong);
}

.code-panel-body {
    padding: var(--space-5);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-2);
}
.code-panel-body pre { margin: 0; white-space: pre; }
.code-panel-body .hl-tree { color: var(--faint); }
.code-panel-body .hl-file { color: var(--text); font-weight: 600; }
.code-panel-body .hl-comment { color: var(--muted); font-style: italic; }
.code-panel-body .hl-cmd { color: var(--accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   15. Footer
   -------------------------------------------------------------------------- */
.footer {
    margin-top: auto;
    flex: 0 0 auto;
    padding: var(--space-8) 0 var(--space-6);
    border-top: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--muted);
}

.footer-inner {
    width: var(--shell);
    max-width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr);
    gap: var(--space-7);
    align-items: start;
}

.footer-brand { max-width: 44ch; }
.footer-brand .wordmark { font-size: 1.15rem; }
.footer-brand p {
    margin: var(--space-3) 0 0;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--muted);
}

.footer-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.footer-col h5 {
    margin: 0 0 var(--space-3);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.footer-col ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col a {
    color: var(--text-2);
    font-size: 0.86rem;
    text-decoration: none;
    transition: color var(--dur-fast) ease;
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
    width: var(--shell);
    max-width: 100%;
    margin: var(--space-7) auto 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}
.footer-bottom p { margin: 0; }

/* --------------------------------------------------------------------------
   16. Motion & Animations
   -------------------------------------------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
    will-change: opacity, transform;
}
[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

@keyframes page-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes masthead-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-line); }
    70%  { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

body { animation: page-fade-in 0.4s var(--ease) both; }
.masthead { animation: masthead-enter 0.3s var(--ease) both; }

/* --------------------------------------------------------------------------
   17. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .section-head { grid-template-columns: 1fr; gap: var(--space-2); }
    .hero-showcase { grid-template-columns: 1fr; }
    .feature-row,
    .feature-row.is-reversed { grid-template-columns: 1fr; gap: var(--space-5); }
    .footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    :root { --shell: min(calc(100% - 36px), 768px); }
    
    .nav-toggle { display: inline-flex; }
    .nav-links {
        position: absolute;
        top: var(--masthead-h); right: 0; left: 0;
        display: none;
        min-height: 0;
        flex-direction: column;
        border: 1px solid var(--line);
        border-top: 0;
        background: var(--bg);
        box-shadow: var(--shadow-md);
    }
    .nav-links.is-open { display: flex; }
    .nav-links li + li { border-top: 1px solid var(--line); }
    .nav-links a { width: 100%; min-height: 48px; padding: 0 var(--space-4); }
    .nav-links a.is-active::after { right: var(--space-4); bottom: 0; left: var(--space-4); }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-nav-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-name { font-size: clamp(2.4rem, 10vw, 3.6rem); }
}

@media (max-width: 480px) {
    :root { --shell: min(calc(100% - 24px), 480px); }
    .stats-grid { grid-template-columns: 1fr; }
    .footer-nav-grid { grid-template-columns: 1fr; }
    .solvers-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   18. Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
}
