/*
  DSK Realm theme — shared design tokens + components, v2.

  Extends (does not replace) the existing navy/gold identity already
  proven across the site and the video pipeline. New here:
    - Nunito Sans, self-hosted (assets/fonts/*.woff2), replacing the
      generic 'Segoe UI' body font. Same self-hosting pattern already
      used for Baloo Display — no font CDN, no third-party request.
    - Zone colors, lifted directly from game-site/assets/js/game.js's
      four threat zones, so the site and the game share one palette
      instead of inventing a second one.
    - Realm gradients/accents pulled from the CANONICAL_WORLD language
      already locked in dsk-shorts/content/*.json (glowing blue crystal
      towers, soft violet, warm amber lantern light) — the same world
      the daily shorts already render, now extended to the site.
    - A grouped, collapsible nav ("realm-nav") replacing the flat list
      of ~19 links that, on a phone, filled the entire first screen
      before any hero content appeared.

  Pages opt in by linking this file and adding the realm-nav markup;
  nothing here is auto-applied, so existing pages are unaffected until
  they're migrated (tracked page-by-page, see CHAPTER plans).
*/

@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nunito-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/nunito-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Same two files cover the whole family — Nunito Sans is a variable font,
   so 600/700/800 reuse the identical bytes already cached by the browser
   from the 400 declaration above. Four separate weight blocks (matching
   how Google itself serves this font) rather than one `font-weight: 400
   900` range, for the widest browser support. */
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:600; font-display:swap; src:url('fonts/nunito-sans-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:600; font-display:swap; src:url('fonts/nunito-sans-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:700; font-display:swap; src:url('fonts/nunito-sans-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:700; font-display:swap; src:url('fonts/nunito-sans-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:800; font-display:swap; src:url('fonts/nunito-sans-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:'Nunito Sans'; font-style:normal; font-weight:800; font-display:swap; src:url('fonts/nunito-sans-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Zone colors — identical values to game-site/assets/js/game.js's
     ZONES array, so a threat category reads the same color on the site
     and in the game rather than each inventing its own. */
  --zone-scam: #e63946;
  --zone-stranger: #d06035;
  --zone-ai: #8a5fbf;
  --zone-privacy: #2a9d8f;

  /* Realm accents — lifted from the CANONICAL_WORLD description already
     rendered dozens of times in the shorts: glowing blue crystal towers,
     soft floating light-motes, warm amber lantern light, a cool violet
     doorway. Extending that world to the site instead of a second one. */
  --realm-crystal: #2f6fed;
  --realm-crystal-deep: #1b3f8f;
  --realm-violet: #6a4fb8;
  --realm-amber: #e8a23d;
  --realm-bg: radial-gradient(ellipse at 20% -10%, rgba(47,111,237,0.35), transparent 55%),
              radial-gradient(ellipse at 85% 0%, rgba(106,79,184,0.28), transparent 50%),
              linear-gradient(180deg, var(--navy) 0%, var(--navy2) 100%);

  --font-body: 'Nunito Sans', system-ui, -apple-system, sans-serif;
}

body.realm-body { font-family: var(--font-body); }

/* ---------- realm-nav ---------- */
/* Groups existing links via data-group without restructuring the DOM:
   each <a> keeps its href/i18n key; a group label + toggle sit above the
   links carrying that data-group. Works whether the links live in one
   flat container (mobile drawer) or several (desktop dropdowns). */

.realm-nav-toggle {
  display: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(232,197,106,0.35);
  border-radius: 10px;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.realm-nav-toggle span, .realm-nav-toggle span::before, .realm-nav-toggle span::after {
  content: ''; display: block; width: 20px; height: 2px; background: var(--gold2);
  border-radius: 2px; position: relative; transition: transform .2s, opacity .2s;
}
.realm-nav-toggle span::before { position: absolute; top: -6px; }
.realm-nav-toggle span::after { position: absolute; top: 6px; }
.realm-nav-toggle[aria-expanded="true"] span { background: transparent; }
.realm-nav-toggle[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.realm-nav-toggle[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

.realm-nav-groups { display: flex; gap: 0.4rem; align-items: center; }
.realm-nav-group { position: relative; }
.realm-nav-group > .rng-label {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; color: #ccd6f6; font: inherit;
  font-size: 0.85rem; font-weight: 700; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; white-space: nowrap;
}
.realm-nav-group > .rng-label:hover, .realm-nav-group > .rng-label[aria-expanded="true"] { color: var(--gold2); background: rgba(255,255,255,0.06); }
.realm-nav-group > .rng-label .rng-caret { font-size: 0.6rem; transition: transform .15s; }
.realm-nav-group > .rng-label[aria-expanded="true"] .rng-caret { transform: rotate(180deg); }

.realm-nav-panel {
  display: none;
  background: var(--navy2);
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
}
.realm-nav-panel a {
  display: block; color: #dbe2f5; text-decoration: none; font-size: 0.86rem;
  font-weight: 600; padding: 9px 12px; border-radius: 8px; white-space: nowrap;
}
.realm-nav-panel a:hover { background: rgba(232,197,106,0.12); color: var(--gold2); }
.realm-nav-panel.open { display: block; }

.realm-nav-direct {
  color: #ccd6f6; text-decoration: none; font-size: 0.85rem; font-weight: 700;
  padding: 8px 10px; border-radius: 8px; white-space: nowrap;
}
.realm-nav-direct:hover { color: var(--gold2); background: rgba(255,255,255,0.06); }
@media (max-width: 900px) { .realm-nav-direct { padding: 13px 12px; font-size: 0.95rem; } }

@media (min-width: 901px) {
  .realm-nav-panel { position: absolute; top: 100%; left: 0; margin-top: 6px; min-width: 220px; z-index: 60; }
}

@media (max-width: 900px) {
  .realm-nav-toggle { display: inline-flex; }
  .realm-nav-groups {
    position: fixed; inset: 0 0 0 auto; width: min(84vw, 340px); height: 100dvh;
    background: var(--navy); border-left: 1px solid rgba(201,168,76,0.25);
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 78px 14px 24px; overflow-y: auto;
    transform: translateX(100%); transition: transform .25s ease;
    z-index: 90;
  }
  .realm-nav-groups.open { transform: translateX(0); }
  .realm-nav-group > .rng-label { width: 100%; justify-content: space-between; padding: 13px 12px; font-size: 0.95rem; }
  .realm-nav-panel { border: none; background: rgba(255,255,255,0.03); margin: 0 0 4px; box-shadow: none; }
  .realm-nav-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(5,10,24,0.55); z-index: 80;
  }
  .realm-nav-backdrop.open { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .realm-nav-groups, .realm-nav-toggle span, .realm-nav-toggle span::before, .realm-nav-toggle span::after { transition: none; }
}

/* ---------- zone-coded cards (Threats / Programs) ---------- */
.zone-card {
  border-radius: 16px; padding: 1.6rem; position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03);
}
.zone-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--zone-color, var(--gold));
}
.zone-card .zone-icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 1.5rem; margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--zone-color, var(--gold)) 18%, transparent);
}
.zone-card h3 { color: #fff; font-size: 1.08rem; margin-bottom: 0.4rem; }
.zone-card p { color: #b9c6e8; font-size: 0.9rem; line-height: 1.6; }
