/*
 * AI Took My Job — "Human Signal" Design System
 * Dark editorial aesthetic with warm amber accents
 * In a world of AI noise, this is the human signal.
 */

@layer reset, tokens, base, components, layout, utilities, responsive;

/* ─── RESET ─── */
@layer reset {
  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
  html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  img, svg { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  a { color: inherit; text-decoration: none; }
  ul, ol { list-style: none; }
  button { cursor: pointer; background: none; border: none; }
}

/* ─── DESIGN TOKENS ─── */
@layer tokens {
  :root {
    /* Dark theme (default) */
    --bg-deep: #0A0A0B;
    --bg-surface: #131316;
    --bg-elevated: #1B1B1F;
    --bg-hover: #232328;
    --border-subtle: rgba(255,255,255,0.06);
    --border-default: rgba(255,255,255,0.1);
    --border-strong: rgba(255,255,255,0.16);

    --text-primary: #EDEBE8;
    --text-secondary: #8A8A90;
    --text-muted: #555558;

    --amber: #D4956B;
    --amber-light: #E8B98A;
    --amber-dim: #A06840;
    --amber-glow: rgba(212,149,107,0.15);
    --teal: #4A9A8A;
    --teal-dim: #2A6A5A;
    --signal-red: #D45454;
    --signal-red-dim: rgba(212,84,84,0.15);
    --signal-green: #5AA86C;
    --signal-green-dim: rgba(90,168,108,0.15);

    /* Typography */
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.75rem;
    --text-5xl: 3.5rem;
    --text-hero: clamp(3rem, 7vw, 5.5rem);

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;
    --sp-32: 8rem;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 40px var(--amber-glow);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 150ms;
    --dur-normal: 300ms;
    --dur-slow: 500ms;

    --max-w: 1280px;
    --nav-h: 64px;
  }

  [data-theme="light"] {
    --bg-deep: #F5F2ED;
    --bg-surface: #FFFFFF;
    --bg-elevated: #F0ECE6;
    --bg-hover: #E8E4DD;
    --border-subtle: rgba(0,0,0,0.05);
    --border-default: rgba(0,0,0,0.1);
    --border-strong: rgba(0,0,0,0.18);
    --text-primary: #1A1A1C;
    --text-secondary: #6B6B72;
    --text-muted: #9A9AA0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  }
}

/* ─── BASE ─── */
@layer base {
  body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Grain overlay — subtle noise for tactile quality */
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
  }

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

  h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text-primary);
  }

  p { max-width: 65ch; }
}

/* ─── COMPONENTS ─── */
@layer components {

  /* ── Navigation ── */
  .site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg-deep) 85%, transparent);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border-bottom: 1px solid var(--border-subtle);
  }

  .nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--sp-6);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-8);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    text-decoration: none;
    flex-shrink: 0;
  }

  .nav-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--amber), var(--amber-dim));
    display: grid;
    place-items: center;
    position: relative;
  }

  .nav-brand-mark::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--bg-deep);
    border-radius: 2px;
  }

  .nav-brand-name {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
  }

  .nav-links {
    display: flex;
    gap: var(--sp-1);
  }

  .nav-link {
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out);
  }

  .nav-link:hover,
  .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
  }

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

  .nav-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
  }

  .nav-mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: background var(--dur-fast);
  }

  .nav-mobile-toggle:hover { background: var(--bg-elevated); }

  /* ── Buttons ── */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    transition: all var(--dur-normal) var(--ease-out);
    border: 1px solid transparent;
    white-space: nowrap;
  }

  .btn-primary {
    background: var(--amber);
    color: var(--bg-deep);
    border-color: var(--amber);
  }

  .btn-primary:hover {
    background: var(--amber-light);
    border-color: var(--amber-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
  }

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

  .btn-ghost:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
  }

  .btn-sm {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
  }

  .btn-lg {
    padding: var(--sp-4) var(--sp-8);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    transition: all var(--dur-fast);
  }

  .btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-default);
  }

  /* ── Cards ── */
  .card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    transition: border-color var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-normal) var(--ease-out);
  }

  .card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
  }

  .card-flat {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
  }

  /* ── Stat Blocks ── */
  .stat-block {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
  }

  .stat-value {
    font-family: var(--font-mono);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--amber);
    line-height: 1;
    letter-spacing: -0.04em;
  }

  .stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
  }

  /* ── Tags ── */
  .tag {
    display: inline-flex;
    align-items: center;
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .tag-amber {
    background: var(--amber-glow);
    color: var(--amber-light);
  }

  .tag-red {
    background: var(--signal-red-dim);
    color: var(--signal-red);
  }

  .tag-green {
    background: var(--signal-green-dim);
    color: var(--signal-green);
  }

  /* ── Form Controls ── */
  .input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-sm);
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  }

  .input:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: 0 0 0 3px var(--amber-glow);
  }

  .input::placeholder {
    color: var(--text-muted);
  }

  .select {
    padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%238A8A90' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    padding-right: var(--sp-8);
  }

  .select:focus {
    outline: none;
    border-color: var(--amber);
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
    margin-bottom: var(--sp-4);
  }

  @media (max-width: 540px) {
    .form-row {
      grid-template-columns: 1fr;
    }
  }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .form-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
  }

  /* ── Modal ── */
  .modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-normal);
  }

  .modal-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .modal-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--sp-8);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(10px);
    transition: transform var(--dur-normal) var(--ease-out);
  }

  .modal-panel-lg {
    max-width: 640px;
  }

  .modal-overlay.is-open .modal-panel {
    transform: translateY(0);
  }

  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp-6);
  }

  .modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
  }

  .modal-close {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--dur-fast);
    font-size: 1.25rem;
  }

  .modal-close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
  }

  /* ── Tabs ── */
  .tabs {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--sp-6);
    gap: var(--sp-1);
  }

  .tab-btn {
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--dur-fast);
  }

  .tab-btn:hover { color: var(--text-secondary); }

  .tab-btn.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
  }

  .tab-pane { display: none; }
  .tab-pane.active { display: block; }

  /* ── Divider ── */
  .divider {
    width: 100%;
    height: 1px;
    background: var(--border-subtle);
    margin: var(--sp-8) 0;
  }

  /* ── Signal Line (animated accent) ── */
  .signal-line {
    width: 48px;
    height: 3px;
    background: var(--amber);
    border-radius: var(--radius-full);
    position: relative;
    overflow: hidden;
  }

  .signal-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--amber-light), transparent);
    animation: signal-pulse 2s ease-in-out infinite;
  }

  /* ── Ticker / Live Feed ── */
  .live-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--radius-full);
    background: var(--signal-red-dim);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--signal-red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

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

  /* ── Story Card ── */
  .story-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    transition: border-color var(--dur-normal),
                transform var(--dur-normal) var(--ease-out);
    position: relative;
  }

  .story-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: var(--sp-6);
    right: var(--sp-6);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--amber-dim), transparent);
    opacity: 0;
    transition: opacity var(--dur-normal);
  }

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

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

  .story-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-4);
  }

  .story-author {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
  }

  .story-company {
    font-size: var(--text-sm);
    color: var(--amber);
    font-weight: 500;
  }

  .story-body {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .story-meta {
    display: flex;
    gap: var(--sp-4);
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
  }

  .story-meta-item {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
  }

  .story-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-subtle);
  }

  .btn-metoo {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
  }

  .btn-metoo:hover {
    border-color: var(--amber);
    color: var(--amber);
    background: rgba(212, 149, 107, 0.08);
  }

  .btn-metoo.metoo-active {
    border-color: var(--amber);
    color: var(--amber);
    background: rgba(212, 149, 107, 0.12);
  }

  .btn-metoo:disabled {
    opacity: 0.6;
    cursor: default;
  }

  .metoo-count {
    font-weight: 600;
  }

  .btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
    margin-left: auto;
  }

  .btn-share:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(74, 154, 138, 0.08);
  }

  /* ── Topic Item (Forum) ── */
  .topic-item {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: var(--sp-4);
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    transition: border-color var(--dur-fast), background var(--dur-fast);
  }

  .topic-item:hover {
    border-color: var(--border-default);
    background: var(--bg-elevated);
  }

  .topic-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: grid;
    place-items: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--amber);
    border: 1px solid var(--border-subtle);
  }

  .topic-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--sp-1);
    transition: color var(--dur-fast);
  }

  .topic-title:hover { color: var(--amber); }

  .topic-excerpt {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .topic-meta {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .topic-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .topic-stat {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
  }

  /* ── Chart Container ── */
  .chart-wrap {
    position: relative;
    height: 260px;
    margin-top: var(--sp-4);
  }

  /* ── Toast Notifications ── */
  .toast {
    position: fixed;
    top: var(--sp-4);
    right: var(--sp-4);
    padding: var(--sp-3) var(--sp-5);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: #fff;
    z-index: 1000;
    animation: toast-in var(--dur-normal) var(--ease-out);
  }

  .toast-success { background: var(--signal-green); }
  .toast-error { background: var(--signal-red); }
  .toast-info { background: var(--teal); }

  /* ── Footer ── */
  .site-footer {
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--sp-32);
    padding: var(--sp-16) var(--sp-6) var(--sp-8);
    background: var(--bg-surface);
  }

  .footer-grid {
    max-width: var(--max-w);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--sp-12);
    margin-bottom: var(--sp-12);
  }

  .footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
  }

  .footer-brand-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    max-width: 32ch;
    line-height: 1.7;
  }

  .footer-col h4 {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--sp-4);
  }

  .footer-col a {
    display: block;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--sp-1) 0;
    transition: color var(--dur-fast);
  }

  .footer-col a:hover { color: var(--amber); }

  .footer-bottom {
    max-width: var(--max-w);
    margin: 0 auto;
    padding-top: var(--sp-8);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--text-xs);
    color: var(--text-muted);
  }
}

/* ─── LAYOUT ─── */
@layer layout {
  .container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 var(--sp-6);
  }

  /* ── Hero ── */
  .hero {
    padding: var(--sp-24) 0 var(--sp-16);
    position: relative;
  }

  .hero-inner {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--sp-16);
    align-items: start;
  }

  .hero-eyebrow {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
  }

  .hero-eyebrow-text {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
  }

  .hero-title {
    font-size: var(--text-hero);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin-bottom: var(--sp-6);
    font-variation-settings: 'opsz' 72;
  }

  .hero-title em {
    font-style: normal;
    color: var(--amber);
  }

  .hero-subtitle {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 52ch;
    line-height: 1.7;
    margin-bottom: var(--sp-10);
  }

  .hero-actions {
    display: flex;
    gap: var(--sp-4);
    flex-wrap: wrap;
  }

  .hero-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
  }

  .hero-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
  }

  .hero-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .hero-stat-card .stat-value {
    font-size: var(--text-2xl);
  }

  /* ── Sections ── */
  .section {
    padding: var(--sp-20) 0;
  }

  .section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--sp-10);
    gap: var(--sp-4);
    flex-wrap: wrap;
  }

  .section-title {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.03em;
  }

  .section-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--sp-2);
    max-width: 50ch;
  }

  .section-actions {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
  }

  /* ── Stories Grid ── */
  .stories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--sp-5);
  }

  /* ── Dashboard Grid ── */
  .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-5);
  }

  /* ── Community Grid ── */
  .community-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-5);
  }

  .discussion-item {
    padding: var(--sp-4);
    border-radius: var(--radius-md);
    transition: background var(--dur-fast);
    cursor: pointer;
  }

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

  .discussion-item h4 {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    color: var(--text-primary);
  }

  .discussion-meta {
    display: flex;
    gap: var(--sp-3);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .group-item {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    transition: background var(--dur-fast);
  }

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

  .group-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .group-info h4 {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: 2px;
  }

  .group-info p {
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .online-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-xs);
    color: var(--signal-green);
    font-weight: 600;
  }

  .online-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal-green);
  }

  /* ── Forum Layout ── */
  .forum-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--sp-8);
    align-items: start;
  }

  .forum-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    position: sticky;
    top: calc(var(--nav-h) + var(--sp-6));
  }

  .forum-topics-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  .category-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    transition: all var(--dur-fast);
  }

  .category-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  .category-link.active {
    background: var(--amber-glow);
    color: var(--amber);
  }

  .category-badge {
    margin-left: auto;
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--text-muted);
  }

  /* ── Cabinet Auth ── */
  .cabinet-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-8);
    align-items: start;
  }

  .feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
  }

  .feature-item {
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .feature-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--amber-glow);
    display: grid;
    place-items: center;
    color: var(--amber);
    font-size: 1.1rem;
  }

  .feature-item h4 {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
  }

  .feature-item p {
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  /* ── News Grid ── */
  .news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--sp-5);
  }

  .news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color var(--dur-normal),
                transform var(--dur-normal) var(--ease-out),
                box-shadow var(--dur-normal);
  }

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

  .news-card-accent {
    height: 3px;
    background: linear-gradient(90deg, var(--amber), var(--amber-dim));
  }

  .news-card-body {
    padding: var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    flex: 1;
  }

  .news-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
  }

  .news-source {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--amber);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .news-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
  }

  .news-title {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    flex: 1;
  }

  .news-link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--dur-fast);
    margin-top: var(--sp-2);
  }

  .news-link:hover {
    color: var(--amber);
  }

  .news-link i {
    font-size: 0.875rem;
    transition: transform var(--dur-fast);
  }

  .news-link:hover i {
    transform: translate(2px, -2px);
  }

  /* ── Resources ── */
  .resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-5);
  }

  .resource-card {
    display: flex;
    gap: var(--sp-4);
    padding: var(--sp-5);
    background: var(--surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }

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

  .resource-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 149, 107, 0.1);
    border-radius: var(--radius-md);
    color: var(--amber);
    font-size: 1.25rem;
  }

  .resource-body {
    display: flex;
    flex-direction: column;
  }

  .resource-title {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--sp-1);
  }

  .resource-summary {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--sp-2);
  }

  .resource-provider {
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  /* ── Pagination ── */
  .pagination {
    display: flex;
    justify-content: center;
    gap: var(--sp-2);
    margin-top: var(--sp-10);
  }
}

/* ─── UTILITIES ─── */
@layer utilities {
  .hidden { display: none !important; }
  .text-amber { color: var(--amber); }
  .text-muted { color: var(--text-muted); }
  .text-mono { font-family: var(--font-mono); }
  .text-center { text-align: center; }
  .full-width { width: 100%; }
  .flex-center { display: flex; align-items: center; justify-content: center; }
  .gap-2 { gap: var(--sp-2); }
  .gap-4 { gap: var(--sp-4); }
  .mt-4 { margin-top: var(--sp-4); }
  .mt-6 { margin-top: var(--sp-6); }
  .mb-4 { margin-bottom: var(--sp-4); }
}

/* ─── ANIMATIONS ─── */
@keyframes signal-pulse {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fade-up 0.6s var(--ease-out) both;
}

.fade-up-1 { animation-delay: 0.1s; }
.fade-up-2 { animation-delay: 0.2s; }
.fade-up-3 { animation-delay: 0.3s; }
.fade-up-4 { animation-delay: 0.4s; }
.fade-up-5 { animation-delay: 0.5s; }

/* ─── RESPONSIVE ─── */
@layer responsive {
  @media (max-width: 1024px) {
    .hero-inner {
      grid-template-columns: 1fr;
      gap: var(--sp-10);
    }

    .hero-sidebar {
      order: -1;
    }

    .hero-stats-grid {
      grid-template-columns: repeat(4, 1fr);
    }

    .dashboard-grid,
    .community-grid {
      grid-template-columns: 1fr;
    }

    .forum-layout {
      grid-template-columns: 1fr;
    }

    .forum-sidebar {
      position: static;
    }

    .footer-grid {
      grid-template-columns: 1fr 1fr;
      gap: var(--sp-8);
    }

    .cabinet-split {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 768px) {
    :root {
      --nav-h: 56px;
      --text-hero: 2.5rem;
    }

    .nav-links { display: none; }
    .nav-mobile-toggle { display: flex; }

    .nav-links.is-open {
      display: flex;
      flex-direction: column;
      position: absolute;
      top: var(--nav-h);
      left: 0;
      right: 0;
      background: var(--bg-surface);
      border-bottom: 1px solid var(--border-subtle);
      padding: var(--sp-4) var(--sp-6);
      gap: var(--sp-1);
    }

    .hero { padding: var(--sp-12) 0 var(--sp-8); }

    .hero-stats-grid {
      grid-template-columns: 1fr 1fr;
    }

    .stories-grid,
    .news-grid {
      grid-template-columns: 1fr;
    }

    .section-header {
      flex-direction: column;
      align-items: flex-start;
    }

    .footer-grid {
      grid-template-columns: 1fr;
      gap: var(--sp-8);
    }

    .footer-bottom {
      flex-direction: column;
      gap: var(--sp-4);
      text-align: center;
    }

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

    .topic-item {
      grid-template-columns: 1fr;
      gap: var(--sp-3);
    }

    .topic-avatar { display: none; }
    .topic-stats { flex-direction: row; }
  }

  @media (max-width: 480px) {
    .hero-actions {
      flex-direction: column;
    }

    .hero-actions .btn {
      width: 100%;
      justify-content: center;
    }

    .hero-stats-grid {
      grid-template-columns: 1fr;
    }
  }
}

/* ─── ACCESSIBILITY ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border-subtle: var(--text-muted);
    --border-default: var(--text-secondary);
  }
}

@media print {
  .site-nav, .site-footer, .hero-visual, .hero-sidebar { display: none; }
  body { background: white; color: black; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
