/* ============================================================
   EMPIRE OS — Base layer: reset, typography, atmosphere
   ============================================================ */

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

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text-200);
  background-color: var(--bg);
  overflow: hidden; /* app shell owns scroll */
  font-feature-settings: "cv05" 1, "ss01" 1;
}

/* Calm near-solid backdrop — whisper of texture, no glows. */
.eos-backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: var(--bg);
}
.eos-backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, #000 30%, transparent 100%);
  opacity: 0.5;
}

/* Typography */
h1, h2, h3, h4 { color: var(--text-100); font-weight: 600; letter-spacing: -0.012em; line-height: 1.25; }
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.serif { font-family: var(--font-display); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul, ol { list-style: none; }
img, svg { display: block; }
/* Inline icons (icon() emits <svg class="ico">). The img,svg reset above makes
   every SVG block-level, which drops icon() glyphs onto their own line above any
   plain inline hint/note/heading label. Give .ico an inline, text-aligned box so
   the icon-beside-text idiom works everywhere (plain inline flow AND inside
   existing flex/grid rows — a flex item may itself be inline-flex, and the
   parent's align-items:center still centers it). flex:none stops any shrink. */
.ico { display: inline-flex; vertical-align: middle; flex: none; }

/* Selection */
::selection { background: var(--accent-soft); color: var(--text-100); }

/* Scrollbars — slim, neutral */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-500); background-clip: content-box; }

/* Utility helpers used across views */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; } .shrink-0 { flex-shrink: 0; }
.muted { color: var(--text-400); } .faint { color: var(--text-500); }
.gold { color: var(--text-100); }
.up { color: var(--green-400); } .down { color: var(--red-400); }
.center { align-items: center; } .justify-center { justify-content: center; }
.text-c { text-align: center; }
.uppercase { text-transform: uppercase; letter-spacing: 0.08em; }
.text-xs { font-size: var(--fs-xs); } .text-sm { font-size: var(--fs-sm); }
.text-2xs { font-size: var(--fs-2xs); }
.w-full { width: 100%; } .h-full { height: 100%; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.eyebrow { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-400); font-weight: 600; }

/* Reveal animation for view loads */
/* Entrances blur IN — content focuses into place instead of flicking on (rule 5). */
@keyframes eos-rise { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes eos-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes eos-scale-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.rise { animation: eos-rise var(--t-slow) var(--ease-smooth) both; }

/* Tactile press — a firm 0.98, never a collapse (rule 7). Opt-in so it never fights bespoke states. */
.u-press { transition: transform var(--t-fast) var(--ease-smooth); }
.u-press:active { transform: scale(0.98); }
/* Height reveal the right way — grid rows 0fr→1fr, no max-height hacks (rule 8). */
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-med) var(--ease-smooth); }
.reveal[data-open="true"], .reveal.open { grid-template-rows: 1fr; }
.reveal > * { overflow: hidden; min-height: 0; }
.stagger > * { animation: eos-rise var(--t-slow) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 70ms; }
.stagger > *:nth-child(3) { animation-delay: 110ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 190ms; }
.stagger > *:nth-child(6) { animation-delay: 230ms; }
.stagger > *:nth-child(7) { animation-delay: 270ms; }
.stagger > *:nth-child(8) { animation-delay: 310ms; }

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