/* =============================================================================
   Shaiya Devoted — design tokens
   -----------------------------------------------------------------------------
   The one place colour, type, space, shape, depth and motion are defined.
   Every other stylesheet reads these names; none of them writes a raw colour.

   The palette is taken from the Devoted logo: a sea dragon in mother-of-pearl,
   sea teal and copper. The world is a chapel by the sea at night: obsidian
   stone, pearl for lettering, sea teal for light and information, copper for
   furniture, antique gold for whatever the player should do next, and vellum
   for the written word.

   Load order: tokens → base → components → pages → (page file, e.g. home).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- Colour channels -------------------------------------------------------
     Space-separated so any of them can take an alpha: rgb(var(--c-gold) / .4). */
  --c-ground: 7 9 10;
  --c-surface: 14 16 19;
  --c-surface-2: 21 24 28;
  --c-surface-3: 32 36 42;
  --c-line: 206 216 220;
  --c-ink: 244 241 234;
  --c-gold: 200 164 90;
  --c-gold-hi: 240 214 151;
  --c-gold-lo: 122 94 44;
  --c-copper: 196 122 86;
  --c-teal: 63 182 168;
  --c-teal-hi: 155 232 220;
  --c-teal-lo: 15 74 71;
  --c-silver: 176 181 190;
  --c-oxblood: 138 47 44;
  --c-oxblood-hi: 210 122 108;
  --c-vellum: 232 218 184;
  --c-ok: 143 207 159;
  --c-warn: 236 198 124;
  --c-bad: 226 114 91;

  /* --- Surfaces, darkest first ---------------------------------------------- */
  --ground: rgb(var(--c-ground));          /* the page */
  --surface: rgb(var(--c-surface));        /* panels, menus */
  --surface-2: rgb(var(--c-surface-2));    /* hover, selected, nested */
  --surface-3: rgb(var(--c-surface-3));    /* tracks, wells' rims, disabled */
  --well: #040506;                         /* inside an input or a track */

  /* --- Lines: pearl, so they read as inlay on the stone ------------------------ */
  --line: rgb(var(--c-line) / .14);
  --line-2: rgb(var(--c-line) / .32);
  --line-3: rgb(var(--c-line) / .6);

  /* --- Text: pearl (contrast on --ground: 17.6, 13.0, 7.3, 5.3) --------------- */
  --ink: #f4f1ea;
  --soft: #cfd3d2;
  --mute: #98a2a1;
  --faint: #808a89;

  /* --- Metals ---------------------------------------------------------------- */
  --gold: rgb(var(--c-gold));
  --gold-hi: rgb(var(--c-gold-hi));
  --gold-lo: rgb(var(--c-gold-lo));
  --copper: rgb(var(--c-copper));
  --bronze: var(--copper);                 /* legacy name */
  --silver: rgb(var(--c-silver));
  --gold-face: linear-gradient(180deg, #f9eabb 0%, #e2c27c 38%, #c39a4d 62%, #a17b38 100%);

  /* --- The logo's own colours: light, information, and the sheen on a struck heading */
  --teal: rgb(var(--c-teal));
  --teal-hi: rgb(var(--c-teal-hi));
  --teal-lo: rgb(var(--c-teal-lo));
  --pearl: #f4f1ea;
  --pearl-sheen: linear-gradient(120deg, #f6f3ee, #cdeee8 32%, #f3e6f0 52%, #f2e2c0 74%, #f6f3ee);
  --gold-rule: linear-gradient(90deg, transparent, var(--gold-lo) 18%, var(--gold-hi) 50%, var(--gold-lo) 82%, transparent);

  /* --- Factions and states --------------------------------------------------- */
  --oxblood: rgb(var(--c-oxblood));
  --oxblood-hi: rgb(var(--c-oxblood-hi));
  --oxblood-deep: #3d1513;
  --ember: #e0a25a;
  --aol: var(--gold-hi);                   /* Alliance of Light */
  --uof: var(--oxblood-hi);                /* Union of Fury */
  --ok: rgb(var(--c-ok));
  --warn: rgb(var(--c-warn));
  --bad: rgb(var(--c-bad));

  /* --- Roles ----------------------------------------------------------------- */
  --accent: var(--gold);                   /* the next action */
  --on-accent: #1a1408;                    /* text set on gold */
  --accent-2: var(--teal-hi);              /* links, focus, data highlights; follows the chosen faction */
  --c-accent-2: var(--c-teal-hi);

  /* --- Vellum: the written word ---------------------------------------------- */
  --vellum: rgb(var(--c-vellum));
  --vellum-2: #d6c497;
  --vellum-ink: #2a2118;
  --vellum-soft: #3d3122;
  --vellum-mute: #6a5a41;
  --vellum-rubric: #7a3a16;                /* initials and hovers on vellum */

  /* --- Glass of the rose window, in the logo's sea colours ------------------- */
  --glass-sea: #2fa99c;
  --glass-coral: #d2674c;
  --glass-pearl: #f3ead2;

  /* --- Type ------------------------------------------------------------------
     Cormorant Garamond speaks (headings, names, numerals). Cinzel labels, and
     sets the few ceremonial headings in the logo's own capitals. Geist does
     the reading and the data. The name itself is always the logo, never type. */
  --font-display: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --font-label: "Cinzel", Georgia, serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --step--1: clamp(.8rem, .78rem + .1vw, .86rem);
  --step-0: clamp(.95rem, .92rem + .15vw, 1.03rem);
  --step-1: clamp(1.2rem, 1.1rem + .45vw, 1.45rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.1vw, 2.2rem);
  --step-3: clamp(2.1rem, 1.5rem + 2.4vw, 3.5rem);
  --step-4: clamp(2.6rem, 1.7rem + 4vw, 4.75rem);
  --label: 600 .72rem/1.2 var(--font-label);   /* the standard small-caps label */
  --label-track: .18em;

  /* --- Space (4px base) ------------------------------------------------------ */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;
  --gutter-l: max(clamp(16px, 4vw, 44px), env(safe-area-inset-left, 0px));
  --gutter-r: max(clamp(16px, 4vw, 44px), env(safe-area-inset-right, 0px));
  --section: clamp(64px, 9vw, 128px);
  --header-h: 104px;

  /* --- Shape: struck, not moulded. Corners stay square; the arch is the curve. */
  --radius: 2px;
  --cut: 0px;                              /* legacy chamfer size, retired */

  /* --- Depth ----------------------------------------------------------------- */
  --lift-1: inset 0 1px 0 rgb(var(--c-ink) / .06), 0 1px 0 rgb(0 0 0 / .6);
  --lift-2: inset 0 1px 0 rgb(var(--c-ink) / .08), 0 22px 44px -26px #000;
  --lift-3: 0 0 0 1px rgb(var(--c-line) / .1), 0 40px 100px -30px #000;
  --glow: 0 0 44px -10px rgb(var(--c-gold) / .65);
  --shadow: var(--lift-3);

  /* --- Motion: slow candle, quick hand --------------------------------------- */
  --dur-1: 140ms;                          /* colour, small state */
  --dur-2: 260ms;                          /* hover lift, menus */
  --dur-3: 520ms;                          /* reveals, wipes */
  --dur-4: 1000ms;                         /* hero entrance */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-in-out: cubic-bezier(.6, 0, .3, 1);

  /* --- Layers ---------------------------------------------------------------- */
  --z-header: 60; --z-menu: 70; --z-drawer: 80; --z-toast: 100; --z-skip: 200;

  /* --- Materials ------------------------------------------------------------- */
  --stone: linear-gradient(180deg, rgb(var(--c-surface-2) / .94), rgb(var(--c-surface) / .96));
  --stone-lit: linear-gradient(180deg, rgb(var(--c-teal) / .16), rgb(var(--c-surface) / .96) 58%);
  --tex-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .86 0 0 0 0 .92 0 0 0 0 .94 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --tex-vellum: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.03' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");

  /* --- The arch --------------------------------------------------------------
     A pointed arch that keeps its true proportions at any width: the drawing is
     ten times taller than it is wide, laid at the top of the box and scaled to
     its width, so the box simply shows as much of the shaft as it needs.
     --arch-mask cuts the shape; --arch-outline is the same curve as a hairline. */
  --arch-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 1000'%3E%3Cpath d='M0 1000V62C0 32 23 11 50 0 77 11 100 32 100 62V1000Z'/%3E%3C/svg%3E");
  --arch-outline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 1000'%3E%3Cpath d='M.5 1000V62C.5 32 23.2 11.3 50 .6 76.8 11.3 99.5 32 99.5 62V1000' fill='none' stroke='%23000' stroke-width='1' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
  --arch-rise: 62%;                        /* height of the pointed part, as a share of the width */

  /* --- Ornament: the gold diamond that sits where two rules meet ------------- */
  --orn-diamond: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M5 0l5 5-5 5-5-5z' fill='%23f0d697'/%3E%3C/svg%3E");
}

/* The chosen faction tints the secondary accent across the whole site. */
:root[data-faction="fury"] { --accent-2: var(--oxblood-hi); --c-accent-2: var(--c-oxblood-hi); }
