/* Winging AI v2 -- Complete Redesign
   Flying Squirrels Wiki structure + Creative Apes energy
   Design Bible: scale x1.8, 10% less saturation, strong weight contrast
*/

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Fraunces:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ===== DESIGN TOKENS ===== */
:root,
[data-theme="dark"] {
    /* Backgrounds */
    --bg:          #0A0A0C;
    --bg-2:        #111114;
    --bg-3:        #18181C;
    --bg-elevated: #1E1E24;
    --bg-glass:    rgba(17, 17, 20, 0.7);

    /* Borders */
    --border:       rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-active: rgba(255, 255, 255, 0.2);

    /* Text */
    --text:   #E0E0DB;
    --text-2: #7A7A7A;
    --text-3: rgba(255, 255, 255, 0.2);
    --text-inverse: #0A0A0C;

    /* Accent -- amber, 10% desaturated */
    --accent:      #E8A830;
    --accent-hover: #F0B840;
    --accent-dim:  rgba(232, 168, 48, 0.12);
    --accent-glow: rgba(232, 168, 48, 0.2);

    /* Secondary */
    --violet:     #9370DB;
    --violet-dim: rgba(147, 112, 219, 0.1);
    --teal:       #5BB8A6;
    --teal-dim:   rgba(91, 184, 166, 0.1);

    /* Status */
    --live:    #2DD4A0;
    --live-dim: rgba(45, 212, 160, 0.12);
    --error:   #E86060;
    --error-dim: rgba(232, 96, 96, 0.1);

    /* Agents */
    --agent-arthur: #5A9BE6;
    --agent-ivan:   #2DD4A0;
    --agent-beski:  #B07CE6;
    --agent-luchi:  #E68C3A;
    --agent-dafi:   #C084FC;

    /* Terminal */
    --terminal-bg:     #08080A;
    --terminal-border: rgba(255, 255, 255, 0.06);

    /* Header */
    --header-bg: rgba(10, 10, 12, 0.85);

    /* Cards */
    --card-bg:     rgba(24, 24, 28, 0.6);
    --card-border: rgba(255, 255, 255, 0.04);
    --card-hover:  rgba(30, 30, 36, 0.8);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.5);

    /* Misc */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg:          #F8F7F4;
    --bg-2:        #EFEEE8;
    --bg-3:        #E4E3DC;
    --bg-elevated: #FFFFFF;
    --bg-glass:    rgba(248, 247, 244, 0.8);

    --border:       rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --border-active: rgba(0, 0, 0, 0.2);

    --text:   #1A1A1E;
    --text-2: #5A5A5A;
    --text-3: rgba(0, 0, 0, 0.2);
    --text-inverse: #F8F7F4;

    --accent:      #C08820;
    --accent-hover: #D49828;
    --accent-dim:  rgba(192, 136, 32, 0.08);
    --accent-glow: rgba(192, 136, 32, 0.12);

    --violet:     #7C3AED;
    --violet-dim: rgba(124, 58, 237, 0.06);
    --teal:       #0D9488;
    --teal-dim:   rgba(13, 148, 136, 0.06);

    --live:    #059669;
    --live-dim: rgba(5, 150, 105, 0.08);
    --error:   #DC2626;
    --error-dim: rgba(220, 38, 38, 0.06);

    --agent-arthur: #2563EB;
    --agent-ivan:   #059669;
    --agent-beski:  #9333EA;
    --agent-luchi:  #EA580C;
    --agent-dafi:   #7C3AED;

    --terminal-bg:     #1A1A1E;
    --terminal-border: rgba(255, 255, 255, 0.04);

    --header-bg: rgba(248, 247, 244, 0.9);

    --card-bg:     rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.05);
    --card-hover:  rgba(255, 255, 255, 0.9);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-lg: 0 24px 64px rgba(0,0,0,0.1);
}

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-weight: 800;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    letter-spacing: 0.01em;
}

.serif {
    font-family: 'Fraunces', Georgia, serif;
}

/* ===== GRAIN OVERLAY ===== */
.grain {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 999;
}

/* ===== HEADER ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 8px var(--live);
    animation: pulse-dot 3s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--live); }
    50% { opacity: 0.6; box-shadow: 0 0 4px var(--live); }
}

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--transition);
    position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--accent); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-2);
    display: flex;
    align-items: center;
    transition: all var(--transition);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-hover); }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ===== HERO ===== */
.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 7rem 2rem 4rem;
}

/* Hero illustration above terminal */
.hero-right .hero-illustration {
    margin-bottom: 1.5rem;
}
.hero-right .hero-illustration img {
    width: 100%;
    height: auto;
    display: block;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    background: var(--accent-dim);
    border: 1px solid rgba(232, 168, 48, 0.15);
    border-radius: 100px;
    margin-bottom: 1.5rem;
    font-size: 0.78rem;
    color: var(--accent);
}

.hero-badge .live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--live);
    animation: pulse-dot 2s ease-in-out infinite;
}

.hero h1 {
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 1.5rem;
    color: var(--text);
    line-height: 1.05;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-2);
    line-height: 1.75;
    margin-bottom: 0.5rem;
    max-width: 480px;
    font-weight: 400;
}

.hero-cta {
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.9rem 1.5rem;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}
.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-hover);
    background: var(--bg-2);
}

/* ===== TERMINAL ===== */
.terminal {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.terminal::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-md);
    padding: 1px;
    background: linear-gradient(135deg, rgba(232,168,48,0.1), transparent 40%, rgba(147,112,219,0.05));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    pointer-events: none;
}

.terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--terminal-border);
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dot.red { background: #FF5F57; }
.terminal-dot.yellow { background: #FFBD2E; }
.terminal-dot.green { background: #28CA42; }

.terminal-title {
    margin-left: 8px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.72rem;
}

.terminal-body {
    padding: 18px 20px;
    font-size: 0.82rem;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.55);
    min-height: 300px;
}

.t-line { white-space: nowrap; overflow: hidden; }
.t-prompt { color: var(--accent); }
.t-cmd { color: #E0E0DB; font-weight: 500; }
.t-dim { color: rgba(255, 255, 255, 0.25); }
.t-val { color: #E0E0DB; }
.t-status { font-size: 0.72rem; padding: 1px 6px; border-radius: 3px; }
.t-online { background: var(--live-dim); color: var(--live); }

.t-agent {
    font-weight: 600;
    display: inline-block;
    min-width: 65px;
}
.t-arthur { color: var(--agent-arthur); }
.t-ivan { color: var(--agent-ivan); }
.t-beski { color: var(--agent-beski); }
.t-luchi { color: var(--agent-luchi); }
.t-dafi { color: var(--agent-dafi); }

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

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Terminal line animation */
.t-delay-1, .t-delay-2, .t-delay-3, .t-delay-4,
.t-delay-5, .t-delay-6, .t-delay-7, .t-delay-8 {
    opacity: 0;
    animation: t-appear 0.3s ease forwards;
}
.t-delay-1 { animation-delay: 0.5s; }
.t-delay-2 { animation-delay: 0.75s; }
.t-delay-3 { animation-delay: 1.0s; }
.t-delay-4 { animation-delay: 1.25s; }
.t-delay-5 { animation-delay: 1.5s; }
.t-delay-6 { animation-delay: 1.9s; }
.t-delay-7 { animation-delay: 2.2s; }
.t-delay-8 { animation-delay: 2.6s; }

@keyframes t-appear {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== SECTION SHARED ===== */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.section-label::before {
    content: '';
    width: 20px;
    height: 1px;
    background: var(--accent);
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 1rem;
}

.section-subtitle {
    color: var(--text-2);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 600px;
}

/* ===== STORY ===== */
.story {
    max-width: 720px;
    margin: 0 auto;
    padding: 8rem 2rem;
    position: relative;
}

.story::before {
    content: '';
    position: absolute;
    left: 2rem;
    top: 10rem;
    bottom: 4rem;
    width: 1px;
    background: linear-gradient(to bottom, var(--accent-dim), var(--border), transparent);
}

.story-block {
    margin-bottom: 5rem;
    position: relative;
    padding-left: 3.5rem;
}

.story-block:last-child { margin-bottom: 0; }

.story-marker {
    position: absolute;
    left: -4px;
    top: 0.3rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.story-number {
    position: absolute;
    left: 1.2rem;
    top: 0.15rem;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 500;
}

.story-block h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.story-block p {
    color: var(--text-2);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.story-block p:last-child { margin-bottom: 0; }

/* ===== SYSTEM ===== */
.system {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

.system-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.system-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.sys-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.sys-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--agent-color, var(--accent));
    opacity: 0;
    transition: opacity var(--transition);
}

.sys-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    background: var(--card-hover);
    box-shadow: var(--shadow-md);
}

.sys-card:hover::before { opacity: 1; }

/* Agent avatar within card */
.sys-card .agent-avatar {
    margin: 0 auto 1rem;
}

.sys-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.sys-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--agent-color, var(--live));
    box-shadow: 0 0 8px var(--agent-color, var(--live));
}

.sys-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text);
}

.sys-role {
    font-size: 0.72rem;
    color: var(--text-3);
    margin-left: auto;
}

.sys-card p {
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.sys-tags {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.sys-tags span {
    font-size: 0.65rem;
    padding: 2px 7px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 3px;
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.stat-item {
    text-align: center;
    padding: 1.5rem 1rem;
    border-right: 1px solid var(--card-border);
    background: var(--card-bg);
}

.stat-item:last-child { border-right: none; }

.stat-val {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    font-family: 'Space Grotesk', sans-serif;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.25rem;
}

/* ===== LATEST CONTENT ===== */
.latest {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

.latest-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.latest-header .view-all {
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.latest-header .view-all:hover { color: var(--accent); }

.latest-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    grid-template-rows: auto auto;
    gap: 1rem;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}

.post-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    background: var(--card-hover);
    box-shadow: var(--shadow-sm);
}

.post-card.featured {
    grid-row: 1 / 3;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--card-bg), rgba(232,168,48,0.03));
}

.post-card.featured .post-card-title {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    flex-wrap: wrap;
}

.post-date { color: var(--text-2); }

.post-tag {
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.post-reading-time { color: var(--text-3); }

.post-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.post-card-desc {
    color: var(--text-2);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: auto;
    flex: 1;
}

.post-card-link {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: color var(--transition);
}

.post-card:hover .post-card-link { color: var(--accent-hover); }

/* ===== CONTENT PILLARS ===== */
.pillars {
    max-width: 900px;
    margin: 0 auto;
    padding: 6rem 2rem;
}

.pillars-header {
    text-align: center;
    margin-bottom: 3rem;
}

.pillars-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.pillar-item {
    padding: 2.2rem 2rem;
    transition: background var(--transition);
    position: relative;
}

.pillar-item:nth-child(1) { border-right: 1px solid var(--card-border); border-bottom: 1px solid var(--card-border); }
.pillar-item:nth-child(2) { border-bottom: 1px solid var(--card-border); }
.pillar-item:nth-child(3) { border-right: 1px solid var(--card-border); }

.pillar-item:hover { background: var(--card-bg); }

.pillar-pct {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: block;
}

.pillar-item h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.pillar-item p {
    color: var(--text-2);
    font-size: 0.88rem;
    line-height: 1.65;
}

/* ===== NEWSLETTER ===== */
.newsletter {
    padding: 8rem 2rem;
    position: relative;
    overflow: hidden;
}

.newsletter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    opacity: 0.3;
    pointer-events: none;
}

.newsletter-inner {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    position: relative;
}

.newsletter h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 0.75rem;
}

.newsletter .sub-count {
    color: var(--text-2);
    font-size: 0.88rem;
    margin-bottom: 2rem;
}

.subscribe-form { margin-bottom: 1rem; }

.form-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.subscribe-form input {
    flex: 1;
    padding: 0.85rem 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition);
}

.subscribe-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.subscribe-form input::placeholder { color: var(--text-3); }
.name-input { width: 100%; }

.subscribe-form button {
    padding: 0.85rem 2rem;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition);
    white-space: nowrap;
}

.subscribe-form button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.newsletter-note {
    color: var(--text-3);
    font-size: 0.75rem;
}

.msg {
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
    font-size: 0.88rem;
}
.msg-success { background: var(--live-dim); border: 1px solid var(--live); color: var(--live); }
.msg-info { background: var(--accent-dim); border: 1px solid var(--accent); color: var(--accent); }
.msg-error { background: var(--error-dim); border: 1px solid var(--error); color: var(--error); }

/* ===== FOOTER ===== */
footer {
    border-top: 1px solid var(--border);
    padding: 2rem 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand { display: flex; align-items: center; gap: 0.75rem; }
.footer-brand .logo-sm {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
}
.footer-tagline { color: var(--text-3); font-size: 0.72rem; }
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
    color: var(--text-2);
    font-size: 0.85rem;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--text); }
.footer-copy {
    color: var(--text-3);
    font-size: 0.72rem;
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
}

/* ===== SCROLL REVEAL ===== */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: var(--delay, 0s);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== BLOG LIST PAGE ===== */
.blog-hero {
    max-width: 1200px;
    margin: 0 auto;
    padding: 7rem 2rem 3rem;
}

.blog-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    margin: 0.5rem 0;
}

.blog-hero-sub {
    color: var(--text-2);
    font-size: 1.1rem;
    margin-top: 0.5rem;
    max-width: 500px;
}

/* Featured post on blog page */
.blog-featured {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.blog-featured-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 3rem;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--card-bg), rgba(232,168,48,0.04));
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.blog-featured-card::after {
    content: 'LATEST';
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
}

.blog-featured-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.blog-featured-card h2 {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    margin-bottom: 0.75rem;
    max-width: 700px;
}

.blog-featured-card .post-card-desc {
    max-width: 600px;
    font-size: 1rem;
}

/* Blog grid */
.blog-grid {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.blog-grid .post-card {
    padding: 1.5rem;
}

/* Blog search/filter */
.blog-controls {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.blog-search {
    flex: 1;
    min-width: 200px;
    padding: 0.6rem 1rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    transition: all var(--transition);
}

.blog-search:focus {
    outline: none;
    border-color: var(--accent);
}

.blog-search::placeholder { color: var(--text-3); }

.tag-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tag-filter {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    transition: all var(--transition);
    font-family: 'JetBrains Mono', monospace;
}

.tag-filter:hover, .tag-filter.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.blog-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-2);
    grid-column: 1 / -1;
}

/* ===== BLOG ARTICLE PAGE ===== */
.article-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem 2rem;
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 4rem;
    align-items: start;
}

.article-main { max-width: 720px; }

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-2);
    font-size: 0.85rem;
    margin-bottom: 2rem;
    transition: color var(--transition);
}

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

.article-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.78rem;
    flex-wrap: wrap;
}

.article-main > h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    margin-bottom: 2.5rem;
}

/* Article body -- editorial serif for reading */
.article-body {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--text);
}

.article-body h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 3rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.article-body h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.article-body p { margin-bottom: 1.4rem; }

.article-body ul, .article-body ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.article-body strong {
    color: var(--text);
    font-weight: 700;
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--accent-dim);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-style: italic;
    color: var(--text-2);
}

.article-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    background: var(--bg-3);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.article-body pre {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent-dim);
    transition: text-decoration-color var(--transition);
}

.article-body a:hover { text-decoration-color: var(--accent); }

.article-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5rem 0;
}

/* Article sidebar */
.article-sidebar {
    position: sticky;
    top: 80px;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 0.72rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin-bottom: 0.4rem;
}

.toc-list a {
    font-size: 0.82rem;
    color: var(--text-2);
    display: block;
    padding: 0.2rem 0 0.2rem 0.75rem;
    border-left: 1px solid var(--border);
    transition: all var(--transition);
}

.toc-list a:hover, .toc-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
}

.sidebar-share {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-share a {
    font-size: 0.82rem;
    color: var(--text-2);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    transition: all var(--transition);
}

.sidebar-share a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.sidebar-newsletter {
    padding: 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
}

.sidebar-newsletter h4 {
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.sidebar-newsletter p {
    font-size: 0.78rem;
    color: var(--text-2);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* Article footer */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.article-nav a {
    font-size: 0.88rem;
    color: var(--text-2);
    transition: color var(--transition);
}

.article-nav a:hover { color: var(--accent); }

/* Blog CTA */
.blog-cta {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

.blog-cta-inner {
    text-align: center;
    padding: 3rem 2rem;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    background: var(--card-bg);
}

.blog-cta-inner h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.blog-cta-inner p {
    color: var(--text-2);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* ===== ABOUT PAGE ===== */
.about-hero {
    max-width: 800px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
    text-align: center;
}

.about-hero h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1rem;
}

.about-hero .lead {
    font-size: 1.15rem;
    color: var(--text-2);
    line-height: 1.8;
    max-width: 600px;
    margin: 0 auto;
}

.about-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.about-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.about-text {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--text-2);
}

.about-text p { margin-bottom: 1.25rem; }

.about-system-visual {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .system-grid { grid-template-columns: repeat(3, 1fr); }
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
    .latest-grid { grid-template-columns: 1fr 1fr; }
    .latest-grid .post-card.featured { grid-row: auto; }
    .article-layout { grid-template-columns: 1fr; }
    .article-sidebar { display: none; }
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        min-height: auto;
        padding-top: 6rem;
    }
    .hero-right { order: -1; }
    .hero h1 { font-size: clamp(2.4rem, 7vw, 3.5rem); }
    .system-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .stat-item:nth-child(2) { border-right: none; }
    .stat-item:nth-child(1), .stat-item:nth-child(2) { border-bottom: 1px solid var(--card-border); }
}

@media (max-width: 640px) {
    nav { padding: 0 1.25rem; height: 56px; }
    .nav-links { gap: 0.75rem; }
    .nav-links a { font-size: 0.82rem; }

    .hero { padding: 5rem 1.25rem 3rem; }
    .hero-sub { font-size: 0.95rem; }
    .hero-cta { flex-direction: column; align-items: stretch; }

    .story { padding: 5rem 1.25rem; }
    .story::before { left: 1.25rem; }
    .story-block { padding-left: 2.5rem; margin-bottom: 3.5rem; }

    .system { padding: 4rem 1.25rem; }
    .system-grid { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: 1fr; }
    .stat-item { border-right: none !important; border-bottom: 1px solid var(--card-border); }
    .stat-item:last-child { border-bottom: none; }

    .latest { padding: 4rem 1.25rem; }
    .latest-grid { grid-template-columns: 1fr; }
    .latest-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    .pillars { padding: 4rem 1.25rem; }
    .pillars-grid { grid-template-columns: 1fr; }
    .pillar-item { border-right: none !important; border-bottom: 1px solid var(--card-border); }
    .pillar-item:last-child { border-bottom: none; }

    .newsletter { padding: 5rem 1.25rem; }
    .form-row { flex-direction: column; }

    .footer-inner { flex-direction: column; text-align: center; }
    .footer-brand { justify-content: center; }

    .blog-hero { padding: 6rem 1.25rem 2rem; }
    .blog-controls { padding: 1rem 1.25rem; }
    .blog-featured { padding: 0 1.25rem 1.5rem; }
    .blog-featured-card { padding: 2rem 1.5rem; }
    .blog-grid { grid-template-columns: 1fr; padding: 0 1.25rem 3rem; }

    .article-layout { padding: 5rem 1.25rem 2rem; }
    .blog-cta { padding: 2rem 1.25rem 4rem; }

    .timeline { padding-left: 1rem; }
    .timeline-item { padding-left: 2rem; }
    .timeline-date { position: static; margin-bottom: 0.25rem; }

    .related-grid { grid-template-columns: 1fr; }

    .newsletter-signup-card { grid-template-columns: 1fr; }
    .newsletter-hero { padding: 6rem 1.25rem 2rem; }
    .newsletter-signup-section { padding: 0 1.25rem 3rem; }
    .newsletter-about { padding: 2rem 1.25rem 4rem; }
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--border), transparent);
}

.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 2.5rem;
}

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

.timeline-marker {
    position: absolute;
    left: -6px;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-item:last-child .timeline-marker {
    background: var(--accent);
}

.timeline-date {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-content h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.timeline-content p {
    color: var(--text-2);
    font-size: 0.92rem;
    line-height: 1.65;
}

/* ===== RELATED POSTS ===== */
.related-posts {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.related-header {
    margin-bottom: 1.5rem;
}

.related-header h3 {
    font-size: 1.4rem;
    font-weight: 700;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.related-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}

.related-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    background: var(--card-hover);
}

.related-card h4 {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: auto;
    flex: 1;
}

.related-card .post-card-link {
    margin-top: 1rem;
}

/* ===== NEWSLETTER PAGE ===== */
.newsletter-hero {
    max-width: 800px;
    margin: 0 auto;
    padding: 8rem 2rem 3rem;
    text-align: center;
}

.newsletter-hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: 1rem;
    line-height: 1.15;
}

.newsletter-hero-sub {
    color: var(--text-2);
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 560px;
    margin: 0 auto;
}

.newsletter-signup-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.newsletter-signup-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    padding: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
}

.newsletter-signup-left h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.newsletter-features {
    list-style: none;
    padding: 0;
}

.newsletter-features li {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.feature-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
}

.newsletter-features strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.newsletter-features p {
    font-size: 0.85rem;
    color: var(--text-2);
    line-height: 1.55;
    margin: 0;
}

.newsletter-form-wrap {
    padding: 2rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.newsletter-form-wrap h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.newsletter-form-wrap .sub-count {
    color: var(--text-2);
    font-size: 0.78rem;
    margin-bottom: 1.25rem;
}

.newsletter-form-wrap .subscribe-form input {
    width: 100%;
    margin-bottom: 0.5rem;
}

.newsletter-form-wrap .newsletter-note {
    text-align: center;
    margin-top: 0.75rem;
}

.newsletter-about {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

.newsletter-about-inner {
    text-align: center;
}

.newsletter-about h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.newsletter-about p {
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.75;
    margin-bottom: 1rem;
    font-family: 'Fraunces', Georgia, serif;
}

.newsletter-about .btn-ghost {
    margin-top: 0.5rem;
}

/* ===== BLOG MAGAZINE LAYOUT (enhanced) ===== */
.blog-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

@media (min-width: 900px) {
    .blog-grid .post-card:nth-child(3n+1) {
        grid-column: span 1;
    }
}

@media (max-width: 1024px) {
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .newsletter-signup-card { grid-template-columns: 1fr; }
}
