/* ── Azraverse · codex design-system layer ──────────────────────────
   Ported from azra-redesign _chrome/codex-app.css + codex-sections.css
   (UnGodly codex design system, Jul 2026). Shared by the portal and,
   eventually, each game's UI chrome. Fonts are self-hosted in ./fonts.
   Class names mirror the codex (cs-*) so upstream integration stays
   a familiar copy-paste. */

/* ── Fonts ─────────────────────────────────────────────────────── */
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cinzel-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: "Cinzel";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cinzel-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: "Nocturne Serif";
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url("fonts/NocturneSerif-Light.woff2") format("woff2");
}
@font-face {
  font-family: "Nocturne Serif";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/NocturneSerif-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Nocturne Serif";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url("fonts/NocturneSerif-RegularItalic.woff2") format("woff2");
}
@font-face {
  font-family: "Nocturne Serif";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("fonts/NocturneSerif-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Nocturne Serif";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("fonts/NocturneSerif-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Nocturne Serif";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/NocturneSerif-Bold.woff2") format("woff2");
}

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  /* Near-black base — crushed obsidian for maximum contrast */
  --color-codex-bgPrimary: #060709;
  --color-codex-bgSurface: rgba(8, 10, 16, 0.94);
  --color-codex-bgSurfaceSolid: #080a10;
  --color-codex-bgElevated: rgba(12, 15, 22, 0.96);
  --color-codex-bgElevatedSolid: #0c0f16;

  --color-codex-textPrimary: #f0ece1;
  --color-codex-textSecondary: #bbb5a9;
  --color-codex-textHeading: #f8f4e8;
  --color-codex-textMuted: #8a8377;

  --color-codex-border: rgba(212, 179, 117, 0.15);
  --line-soft: rgba(212, 179, 117, 0.10);
  --line: rgba(212, 179, 117, 0.18);
  --line-strong: rgba(212, 179, 117, 0.30);

  --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem; --sp-7: 3rem; --sp-8: 4rem; --sp-9: 6rem;

  --r-panel: 0; --r-pill: 999px; --r-round: 50%;

  --color-codex-brass: #d4b375;
  --color-codex-brassLight: #f4dca4;
  --color-codex-brassDark: #c9a25a;
  --color-codex-statUp: #4ade80;
  --color-codex-statDown: #ef4444;

  --font-heading: "Cinzel", Georgia, serif;
  --font-body: "Nocturne Serif", "Barlow", Georgia, serif;
}

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

body {
  background: var(--color-codex-bgPrimary);
  color: var(--color-codex-textPrimary);
  font-family: var(--font-body);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Atmospheric vignette — fixed layer the content scrolls over */
.atmospheric-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.45) 100%),
    radial-gradient(ellipse at 15% 0%, rgba(18, 30, 55, 0.25) 0%, transparent 40%);
}

/* Global focus-visible — themed to void purple accent */
:focus-visible {
  outline: 2px solid rgba(155, 126, 199, 0.7);
  outline-offset: 2px;
}
:focus:not(:focus-visible) {
  outline: none;
}

/* ── Type roles ────────────────────────────────────────────────── */
.cs-eyebrow {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.625rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.60);
  margin-bottom: 0.75rem;
}
.cs-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.75rem, 3.5vw, 3rem);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 30px rgba(212, 179, 117, 0.18);
  text-wrap: balance;
}
.cs-divider {
  display: block;
  width: clamp(140px, 14vw, 200px);
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(to right,
    transparent,
    rgba(212, 179, 117, 0.15),
    rgba(212, 179, 117, 0.55),
    rgba(212, 179, 117, 0.15),
    transparent);
}
.cs-lede {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.15rem);
  line-height: 1.6;
  color: rgba(240, 236, 225, 0.72);
  max-width: 60ch;
  margin: 0 auto;
  text-wrap: balance;
}
.cs-rank-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 241, 204, 0.98);
}
.cs-rank-title::after {
  content: "";
  display: block;
  width: 72px;
  height: 1px;
  margin-top: 0.55rem;
  background: linear-gradient(to right, rgba(212, 179, 117, 0.52), transparent);
}
.cs-card-name {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  transition: color 250ms ease;
}
.cs-empty {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 400;
  color: rgba(240, 236, 225, 0.45);
  font-size: 0.85rem;
}

/* ── Surface (content-box recipe: translucent + blur, hairline) ── */
.cs-surface {
  background: rgba(8, 10, 18, 0.64);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Card (primals-style frame, design-lab variant B) ──────────── */
.cs-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: rgba(8, 10, 18, 0.64);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  transition: border-color 400ms ease, box-shadow 400ms ease, transform 400ms ease;
}
.cs-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(244, 220, 164, 0.08), transparent 70%),
    linear-gradient(135deg, rgba(244, 220, 164, 0.08) 0 1px, transparent 1px 100%);
  background-size: auto, 18px 18px;
  opacity: 0.24;
  mix-blend-mode: screen;
}
.cs-card > * {
  position: relative;
  z-index: 2;
}
.cs-card:hover {
  border-color: rgba(212, 179, 117, 0.35);
  box-shadow:
    0 0 40px rgba(212, 179, 117, 0.10),
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}
.cs-card:hover .cs-card-name {
  color: rgba(244, 220, 164, 0.95);
}

/* Fine pale-gold corner brackets, tucked 6px inside the edge */
.cs-corner {
  --ck: #f4dca4;
  --c-len: 12px;
  --c-thick: 1px;
  --c-offset: 6px;
  position: absolute;
  width: var(--c-len);
  height: var(--c-len);
  z-index: 7;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: var(--c-len) var(--c-thick), var(--c-thick) var(--c-len);
  opacity: 0.7;
  transition:
    width 500ms cubic-bezier(0.23, 1, 0.32, 1),
    height 500ms cubic-bezier(0.23, 1, 0.32, 1),
    background-size 500ms cubic-bezier(0.23, 1, 0.32, 1),
    opacity 500ms ease;
}
.cs-corner.tl {
  top: var(--c-offset); left: var(--c-offset);
  background-image: linear-gradient(to right, var(--ck), transparent), linear-gradient(to bottom, var(--ck), transparent);
  background-position: top left, top left;
}
.cs-corner.tr {
  top: var(--c-offset); right: var(--c-offset);
  background-image: linear-gradient(to left, var(--ck), transparent), linear-gradient(to bottom, var(--ck), transparent);
  background-position: top right, top right;
}
.cs-corner.bl {
  bottom: var(--c-offset); left: var(--c-offset);
  background-image: linear-gradient(to right, var(--ck), transparent), linear-gradient(to top, var(--ck), transparent);
  background-position: bottom left, bottom left;
}
.cs-corner.br {
  right: var(--c-offset); bottom: var(--c-offset);
  background-image: linear-gradient(to left, var(--ck), transparent), linear-gradient(to top, var(--ck), transparent);
  background-position: bottom right, bottom right;
}
.cs-card:hover .cs-corner {
  --c-len: 16px;
  opacity: 1;
}

/* ── Pill (chips, badges, whoami) ──────────────────────────────── */
.cs-pill {
  display: inline-block;
  background: rgba(8, 10, 18, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  font-family: var(--font-heading);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(240, 236, 225, 0.75);
}

/* ── CTA button — ghost brass, square ──────────────────────────── */
.cs-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  background: rgba(212, 179, 117, 0.06);
  border: 1px solid rgba(212, 179, 117, 0.35);
  border-radius: var(--r-panel);
  padding: 0.85rem 1rem;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-codex-brassLight);
  transition: background 250ms ease, border-color 250ms ease, box-shadow 250ms ease;
}
.cs-btn:hover {
  background: rgba(212, 179, 117, 0.14);
  border-color: rgba(212, 179, 117, 0.6);
  box-shadow: 0 0 24px rgba(212, 179, 117, 0.12);
}
.cs-btn:focus-visible {
  outline: 2px solid rgba(244, 220, 164, 0.75);
  outline-offset: 4px;
}

/* ── Links ─────────────────────────────────────────────────────── */
.cs-link {
  color: rgba(244, 220, 164, 0.85);
  text-decoration: none;
  transition: color 250ms ease;
}
.cs-link:hover {
  color: var(--color-codex-brassLight);
}
