/* =========================================================
   Yong · SOWF 2026 Multi-Intelligence Award — Shared Design Tokens
   Host violet + ink and warm light; four intelligence hues.
   Every text/background pair below is checked to WCAG AA (4.5:1)
   in both themes.
   ========================================================= */

:root, [data-theme="light"] {
  --color-bg: #F6F4F1;
  --color-surface: #FFFFFF;
  --color-surface-2: #FAF8F5;
  --color-surface-offset: #EEEBE6;
  --color-divider: #E4E0DA;
  --color-border: #D6D0C8;

  --color-text: #1B1726;
  --color-text-muted: #524C63;
  --color-text-faint: #686178;
  --color-text-inverse: #FFFFFF;

  /* Yong's host violet */
  --color-primary: #7C3AED;
  --color-primary-hover: #6D28D9;
  --color-primary-highlight: #EEE8FC;

  /* The four intelligences */
  --color-human: #A8431C;          /* warm amber-rose */
  --color-human-highlight: #FBEADF;
  --color-nature: #2B7342;         /* living green */
  --color-nature-highlight: #E0EFE3;
  --color-artificial: #7C3AED;     /* Yong violet */
  --color-artificial-highlight: #EEE8FC;
  --color-cosmic: #2A4796;         /* night indigo */
  --color-cosmic-highlight: #E3E8F5;

  --color-soon: #C77A12;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(27,23,38,0.06);
  --shadow-md: 0 6px 20px rgba(27,23,38,0.08);
  --shadow-lg: 0 12px 32px rgba(27,23,38,0.12);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
}

[data-theme="dark"] {
  --color-bg: #100E17;
  --color-surface: #18151F;
  --color-surface-2: #1D1A26;
  --color-surface-offset: #24202F;
  --color-divider: #2C2739;
  --color-border: #3A3449;

  --color-text: #EDE9F5;
  --color-text-muted: #B3ACC4;
  --color-text-faint: #9A93AE;
  --color-text-inverse: #100E17;

  --color-primary: #B09AFB;
  --color-primary-hover: #C4B5FD;
  --color-primary-highlight: #2A2143;

  --color-human: #F2A77A;
  --color-human-highlight: #3B261B;
  --color-nature: #82CF95;
  --color-nature-highlight: #1B3324;
  --color-artificial: #B09AFB;
  --color-artificial-highlight: #2A2143;
  --color-cosmic: #98ACF4;
  --color-cosmic-highlight: #1D2743;

  --color-soon: #F0B45A;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);
}

/* No-JS fallback: follow the system preference when no theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #100E17; --color-surface: #18151F; --color-surface-2: #1D1A26;
    --color-surface-offset: #24202F; --color-divider: #2C2739; --color-border: #3A3449;
    --color-text: #EDE9F5; --color-text-muted: #B3ACC4; --color-text-faint: #9A93AE; --color-text-inverse: #100E17;
    --color-primary: #B09AFB; --color-primary-hover: #C4B5FD; --color-primary-highlight: #2A2143;
    --color-human: #F2A77A; --color-human-highlight: #3B261B; --color-nature: #82CF95; --color-nature-highlight: #1B3324;
    --color-artificial: #B09AFB; --color-artificial-highlight: #2A2143; --color-cosmic: #98ACF4; --color-cosmic-highlight: #1D2743;
    --color-soon: #F0B45A;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body { min-height: 100vh; overflow-wrap: break-word; }
img, video, svg { max-width: 100%; }

a { color: var(--color-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.y-skip { position: absolute; left: -9999px; top: 8px; background: var(--color-surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.y-skip:focus { left: 12px; }

/* ---------- Shared shell: header, nav, theme toggle ---------- */

.y-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

.y-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.y-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--color-text); }
.y-logo { width: 42px; height: 42px; flex-shrink: 0; }
.y-brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.y-brand-sub { font-size: 13px; color: var(--color-text-muted); margin-top: 2px; }

.y-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.y-badge {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  white-space: nowrap;
}

/* Module nav strip */
.y-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 28px; }
.y-nav a {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.y-nav a:hover { color: var(--color-primary); border-color: var(--color-primary); }
.y-nav a.active, .y-nav a[aria-current="page"] {
  color: var(--color-text-inverse);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.y-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--color-divider);
  font-size: 12.5px;
  color: var(--color-text-faint);
  line-height: 1.7;
}
.y-footer p + p { margin-top: 6px; }
.y-footer a { color: var(--color-text-muted); }
.y-footer a:hover { color: var(--color-primary); }
.y-footer strong { color: var(--color-text-muted); font-weight: 600; }

/* ---------- Common primitives ---------- */

.y-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 8px;
  display: block;
}

.y-lede { font-size: 16px; color: var(--color-text-muted); line-height: 1.65; }

.y-page-hero { max-width: 800px; margin: 8px 0 36px; }
.y-page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.12;
  margin-bottom: 14px;
}

.y-section { margin-bottom: 40px; }
.y-section > h2, .y-h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.y-section > p, .y-prose p { font-size: 15px; line-height: 1.7; color: var(--color-text-muted); max-width: 760px; }
.y-section > p + p, .y-prose p + p { margin-top: 12px; }
.y-section > p strong, .y-prose strong { color: var(--color-text); }

.y-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.y-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}
.y-card p, .y-card li { font-size: 14px; line-height: 1.65; color: var(--color-text-muted); }
.y-card p + p { margin-top: 10px; }
.y-card ul, .y-card ol { padding-left: 20px; }
.y-card li + li { margin-top: 6px; }
.y-card strong { color: var(--color-text); }

.y-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.y-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.y-quote {
  border-left: 3px solid var(--q-color, var(--color-primary));
  background: var(--q-bg, var(--color-primary-highlight));
  padding: 16px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  color: var(--color-text);
  max-width: 760px;
}
.y-quote cite { display: block; margin-top: 8px; font-family: var(--font-body); font-style: normal; font-size: 12.5px; color: var(--color-text-muted); }

.y-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--chip-color, var(--color-primary));
  background: var(--chip-bg, var(--color-primary-highlight));
}
.y-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* Intelligence hue helpers */
.hue-human      { --i-color: var(--color-human);      --i-bg: var(--color-human-highlight); }
.hue-nature     { --i-color: var(--color-nature);     --i-bg: var(--color-nature-highlight); }
.hue-artificial { --i-color: var(--color-artificial); --i-bg: var(--color-artificial-highlight); }
.hue-cosmic     { --i-color: var(--color-cosmic);     --i-bg: var(--color-cosmic-highlight); }

.y-intel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--i-color, var(--color-primary));
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.y-intel h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--color-text); display: flex; align-items: center; gap: 10px; }
.y-intel .y-intel-glyph { width: 30px; height: 30px; border-radius: 50%; background: var(--i-bg); color: var(--i-color); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.y-intel .y-intel-glyph svg { width: 16px; height: 16px; }
.y-intel-label { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--color-text-faint); }
.y-intel p { font-size: 14px; line-height: 1.6; color: var(--color-text-muted); }
.y-intel .y-intel-q {
  background: var(--i-bg);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.45;
}
.y-intel .y-intel-q span { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--i-color); margin-bottom: 4px; }

.y-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.y-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px; font-weight: 700;
  background: var(--color-primary);
  color: var(--color-text-inverse) !important;
  text-decoration: none !important;
  transition: background 0.15s ease;
}
.y-cta:hover { background: var(--color-primary-hover); }
.y-cta.secondary { background: var(--color-surface); color: var(--color-text) !important; border: 1px solid var(--color-border); }
.y-cta.secondary:hover { border-color: var(--color-primary); color: var(--color-primary) !important; }

.y-draft {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--color-human);
  background: var(--color-human-highlight);
  padding: 4px 11px; border-radius: 999px;
}

.y-rigor { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.y-rigor.formal { color: var(--color-nature); background: var(--color-nature-highlight); }
.y-rigor.analogy { color: var(--color-cosmic); background: var(--color-cosmic-highlight); }
.y-rigor.lens { color: var(--color-human); background: var(--color-human-highlight); }

.y-video-wrap { border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); background: #000; }
.y-video-wrap video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
/* Click-to-load YouTube facade (plan #2255, ruling V1) */
.y-yt { position: relative; aspect-ratio: 16 / 9; }
.y-yt iframe { display: block; width: 100%; height: 100%; border: 0; }
.y-yt-play { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: #000; cursor: pointer; display: block; }
.y-yt-play img { display: block; width: 100%; height: 100%; object-fit: cover; }
.y-yt-icon { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; background: rgba(0, 0, 0, 0.6); }
.y-yt-icon::after { content: ""; position: absolute; left: 29px; top: 22px; border-style: solid; border-width: 14px 0 14px 22px; border-color: transparent transparent transparent #fff; }
.y-yt-play:hover .y-yt-icon, .y-yt-play:focus-visible .y-yt-icon { background: rgba(0, 0, 0, 0.85); }
.y-yt-note { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; font-size: 12.5px; line-height: 1.4; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); }
.y-yt-alt { font-size: 13px; margin-top: 8px; }

.y-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.y-table th, .y-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-divider); vertical-align: top; line-height: 1.55; }
.y-table th { font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-faint); font-weight: 700; }
.y-table td { color: var(--color-text-muted); }
.y-table td:first-child { color: var(--color-text); font-weight: 600; white-space: nowrap; }
.y-table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }

.y-note { font-size: 12.5px; color: var(--color-text-faint); line-height: 1.6; margin-top: 10px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 860px) {
  .y-grid-2, .y-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .y-shell { padding: 16px 16px 48px; }
  .y-header { padding-bottom: 16px; }
  .y-badge { white-space: normal; }
  .y-table td:first-child { white-space: normal; }
}

/* "Chat with Yong" (Howard 2026-10-29, B + C): the menu pill, and the "Ask Yong" button on narrow screens */
.y-nav a.y-nav-chat { color: var(--color-primary); border-color: var(--color-primary); }
.y-nav a.y-nav-chat:hover { background: var(--color-primary-highlight); }
#chat { scroll-margin-top: 16px; }
.y-ask-fab { display: none; }
@media (max-width: 960px) {
  .y-ask-fab {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 900;
    display: flex; align-items: center; gap: 8px; padding: 6px 18px 6px 6px; border-radius: 999px;
    background: var(--color-primary); color: var(--color-text-inverse) !important; font-size: 15px; font-weight: 700;
    text-decoration: none; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .y-ask-fab img { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--color-text-inverse); object-fit: cover; }
  .y-ask-fab.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }
}
@media print { .y-ask-fab { display: none !important; } }
