/* ==========================================================================
   StudyPulse Cloud AI — 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 — restrained & layered */
    --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 & utility
   -------------------------------------------------------------------------- */
.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.icon {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    fill: currentColor;
}

.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; top: 12px; left: 12px; z-index: 200;
    padding: 10px 18px; background: var(--text); color: var(--bg);
    font-size: 13px; font-weight: 600; border-radius: var(--radius-sm);
    transform: translateY(-64px);
    transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus-visible { transform: none; }

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

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

/* --------------------------------------------------------------------------
   5. Masthead + navigation
   -------------------------------------------------------------------------- */
.masthead,
.nav {
    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), box-shadow var(--dur) ease;
}

.masthead.scrolled,
.nav.scrolled {
    box-shadow: 0 2px 14px rgb(20 22 26 / 0.05);
}

.masthead-inner,
.nav-inner {
    width: var(--shell);
    max-width: 100%;
    margin: 0 auto;
    min-height: var(--masthead-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* Wordmark */
.wordmark,
.brand {
    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,
.brand:hover { color: var(--text); }
.wordmark b,
.brand b { color: var(--accent); font-weight: 700; }
.wordmark span,
.brand span {
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.brand-logo {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--line);
}

.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: 7px;
    min-height: var(--masthead-h);
    padding: 0 16px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--dur-fast) ease;
}
.nav-links a:hover,
.nav-links a.active,
.nav-links a.is-active { color: var(--text); }
.nav-links a.active,
.nav-links a.is-active { font-weight: 600; }

.nav-links a::after {
    position: absolute;
    right: 16px;
    bottom: 14px;
    left: 16px;
    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.active::after,
.nav-links a.is-active::after { opacity: 1; transform: scaleX(1); }

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

/* Language switch */
.language-switch,
.lang-switch {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    padding: 2px;
    gap: 2px;
}
.language-switch button,
.lang-switch button {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.language-switch button.active,
.language-switch button[aria-pressed="true"],
.lang-switch button.active,
.lang-switch button[aria-pressed="true"] {
    background: var(--accent);
    color: #FFFFFF;
}
.language-switch button:hover:not(.active):not([aria-pressed="true"]),
.lang-switch button:hover:not(.active):not([aria-pressed="true"]) {
    color: var(--text);
}

.control-btn,
.menu-toggle,
.nav-toggle {
    display: inline-flex;
    width: 38px;
    height: 38px;
    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,
.menu-toggle:hover,
.nav-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.control-btn:active,
.menu-toggle:active,
.nav-toggle:active { transform: scale(0.94); }
.menu-toggle,
.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.1s linear;
}

/* --------------------------------------------------------------------------
   6. Typography primitives
   -------------------------------------------------------------------------- */
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 var(--space-4);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}
.kicker::before {
    content: "";
    width: 24px;
    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.05;
    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.06rem;
    line-height: 1.75;
    max-width: 62ch;
}

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

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: var(--space-4);
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
}
.breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}
.breadcrumb a:hover { color: var(--accent); }

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

.section-head,
.section-heading {
    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(--faint);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.section-index b { color: var(--accent-2); font-weight: 600; }

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

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

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: 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.9rem;
    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); }
.btn:hover .arrow { transform: translate(3px, -3px); }

.btn.primary,
.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #FFFFFF;
}
.btn.primary:hover,
.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #FFFFFF;
}

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

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

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

.page-hero {
    position: relative;
    padding: clamp(56px, 10vh, 96px) 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.55;
}

.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-grid-layout,
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: clamp(3rem, 6vw, 6rem);
    align-items: center;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
}
.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,
.hero h1,
.page-hero h1 {
    margin: 0;
    color: var(--text);
    font-family: var(--font-serif);
    font-size: clamp(2.8rem, 8vw, 5.4rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1.02;
    white-space: pre-line;
}
.hero-name em,
.hero h1 em,
.page-hero h1 em {
    font-style: italic;
    color: var(--accent);
    font-weight: 500;
}

.hero-sub {
    margin: var(--space-4) 0 0;
    color: var(--text-2);
    font-family: var(--font-serif);
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    line-height: 1.45;
    max-width: 32ch;
}

.hero-detail,
.page-hero p {
    margin: var(--space-4) 0 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.75;
    max-width: 54ch;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-7);
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    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.95rem; line-height: 1.5; }

/* Hero visual / floating card */
.hero-art {
    position: relative;
    min-height: 380px;
}

.hero-card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
    transform: rotate(2deg);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.hero-card:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 0 30px 70px -20px rgb(0 0 0 / 0.22);
    border-color: var(--accent-line);
}

.hero-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: var(--space-5);
}
.hero-card-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.hero-card-name {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--text);
    line-height: 1.2;
}
.hero-card-role {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.hero-card-notes {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.hero-card-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.hero-card-note i {
    width: 4px;
    height: 20px;
    border-radius: 2px;
    flex: 0 0 auto;
    margin-top: 2px;
}
.hero-card-note:nth-child(1) i { background: var(--accent-2); }
.hero-card-note:nth-child(2) i { background: var(--accent); }
.hero-card-note:nth-child(3) i { background: #E3B56B; }
.hero-card-note b {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    color: var(--text);
    text-transform: uppercase;
}
.hero-card-note span {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

/* Worker code badge */
.worker-badge-card {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    line-height: 1.7;
    color: var(--text-2);
}
.worker-badge-card b {
    display: block;
    color: var(--accent);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   10. Stats grid
   -------------------------------------------------------------------------- */
.stats {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
}

.stat,
.stat-item {
    display: flex;
    flex-direction: column;
    padding: var(--space-6) var(--space-5);
    border-right: 1px solid var(--line);
}
.stat:last-child,
.stat-item:last-child { border-right: 0; }

.stat-value,
.stat-item strong {
    color: var(--text);
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3.8vw, 2.8rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-label,
.stat-item span {
    margin-top: var(--space-2);
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   11. Feature grid & cards
   -------------------------------------------------------------------------- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.feature {
    display: flex;
    flex-direction: column;
    min-height: 280px;
    padding: var(--space-6);
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease);
}
.feature:hover {
    background: var(--surface);
}

.feature .index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-bottom: var(--space-5);
    color: var(--accent-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
}

.feature h3 {
    margin: 0 0 var(--space-2);
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text);
}

.feature p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.92rem;
    line-height: 1.7;
    flex: 1;
}

.feature .actions {
    margin-top: var(--space-5);
}

/* --------------------------------------------------------------------------
   12. Flow & lifecycle rows
   -------------------------------------------------------------------------- */
.flow {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
}

.flow-row {
    display: grid;
    grid-template-columns: 48px minmax(180px, 0.4fr) 1fr;
    gap: var(--space-5);
    align-items: baseline;
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--line);
    transition: background-color var(--dur-fast) ease;
}
.flow-row:hover {
    background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.flow-row b {
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.flow-row strong {
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
}

.flow-row span {
    color: var(--text-2);
    font-size: 0.94rem;
    line-height: 1.7;
}

/* --------------------------------------------------------------------------
   13. Architecture topology
   -------------------------------------------------------------------------- */
.architecture {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.arch-node {
    display: flex;
    flex-direction: column;
    min-height: 230px;
    padding: var(--space-5);
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease);
}
.arch-node:hover {
    background: var(--surface);
}

.arch-node .number {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.arch-node h3 {
    margin: var(--space-4) 0 var(--space-2);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
    word-break: break-all;
}

.arch-node p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.65;
    flex: 1;
}

/* --------------------------------------------------------------------------
   14. Split layout & code / tree panels
   -------------------------------------------------------------------------- */
.split {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: clamp(3rem, 6vw, 6rem);
    align-items: start;
}

.code-panel {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #14171D;
    color: #ECEAE4;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.code-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid #262A32;
    background: #0E1014;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
}
.code-top span { color: #4FB0A4; font-weight: 600; }

.code {
    padding: 20px 22px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-x: auto;
    color: #D6D1C6;
}
.code .method,
.code .key { color: #E8917A; }
.code .comment { color: #6B6F76; }

.tree {
    padding: 24px 26px;
    background: #14171D;
    color: #ECEAE4;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.85;
    overflow-x: auto;
}
.tree .folder { color: #4FB0A4; font-weight: 600; }
.tree .comment { color: #6B6F76; }

/* --------------------------------------------------------------------------
   15. Tables
   -------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

th, td {
    padding: 14px 18px;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: 0; }

th {
    background: var(--bg-2);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

td { color: var(--text-2); }
td code,
code {
    padding: 2px 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.84em;
}

/* --------------------------------------------------------------------------
   16. Endpoint lists & security lists
   -------------------------------------------------------------------------- */
.endpoint-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.endpoint {
    padding: var(--space-5);
    background: var(--bg);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: background-color var(--dur-fast) ease;
}
.endpoint:hover { background: var(--surface); }

.endpoint code {
    display: inline-block;
    margin-bottom: var(--space-2);
    font-size: 0.85rem;
    font-weight: 600;
}

.endpoint p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.65;
}

.security-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--line);
}

.security-list li {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: var(--space-4);
    padding: var(--space-5) 0;
    border-bottom: 1px solid var(--line);
    transition: background-color var(--dur-fast) ease;
}
.security-list li:hover {
    background: color-mix(in srgb, var(--surface) 50%, transparent);
}

.security-list b {
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding-top: 2px;
}

.security-list strong {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}

.security-list span {
    color: var(--text-2);
    font-size: 0.92rem;
    line-height: 1.7;
}

/* --------------------------------------------------------------------------
   17. Screenshots
   -------------------------------------------------------------------------- */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
}

.screenshot-card {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.screenshot-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-line);
}

.screenshot-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
}

.screenshot-card figcaption {
    padding: var(--space-4) var(--space-5);
}

.screenshot-card figcaption strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 600;
}

.screenshot-card figcaption span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.screenshot-card.wide {
    grid-column: 1 / -1;
}

/* --------------------------------------------------------------------------
   18. 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.3fr) repeat(4, minmax(0, 1fr));
    gap: var(--space-6);
    align-items: start;
}

.footer-brand { max-width: 36ch; }
.footer-brand .wordmark { font-size: 1.1rem; margin-bottom: var(--space-2); }
.footer-brand p { margin: 0; font-size: 0.92rem; line-height: 1.6; color: var(--muted); }

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

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

.footer-col a {
    color: var(--text-2);
    font-size: 0.88rem;
    text-decoration: none;
}
.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,
.footer-bottom span { margin: 0; }

/* --------------------------------------------------------------------------
   19. Motion & reveal
   -------------------------------------------------------------------------- */
[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); }

[data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
[data-reveal-stagger].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, .nav { animation: masthead-enter 0.3s var(--ease) both; }

/* --------------------------------------------------------------------------
   20. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .hero-grid-layout,
    .hero-grid,
    .split,
    .section-head,
    .section-heading {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }
    .architecture { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
    :root {
        --shell: min(calc(100% - 32px), 680px);
        --shell-narrow: min(calc(100% - 32px), 680px);
    }

    .masthead-inner,
    .nav-inner { position: relative; }
    .menu-toggle,
    .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);
        padding: var(--space-2) 0;
    }
    .nav-links.open,
    .nav-links.is-open { display: flex; }
    .nav-links a { width: 100%; min-height: 44px; padding: 0 var(--space-4); }
    .nav-links a.active::after,
    .nav-links a.is-active::after { right: var(--space-4); bottom: 0; left: var(--space-4); }

    .hero { padding: clamp(48px, 10vh, 84px) 0 var(--space-7); }
    .hero-name, .hero h1, .page-hero h1 { font-size: clamp(2.4rem, 12vw, 3.8rem); }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat:nth-child(2) { border-right: 0; }
    .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }

    .architecture,
    .feature-grid,
    .endpoint-list,
    .screenshot-grid { grid-template-columns: 1fr; }
    .screenshot-card.wide { grid-column: auto; }

    .flow-row {
        grid-template-columns: 36px 1fr;
        gap: var(--space-2) var(--space-3);
    }
    .flow-row span { grid-column: 2; }

    .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-brand { grid-column: 1 / -1; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat { border-right: 0; border-bottom: 1px solid var(--line); }
    .stat:last-child { border-bottom: 0; }
    .footer-inner { grid-template-columns: 1fr; }
}

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