/* ============================================================
   ORDA — base layer: tokens, reset, typography, utilities
   ============================================================ */

:root {
  /* Palette — warm paper + deep steppe pine + ochre */
  --paper: #f4f1e9;
  --paper-2: #eeeadf;
  --surface: #fffdf8;
  --surface-2: #faf7f0;
  --surface-3: #f4f0e6;

  --ink: #14120e;
  --ink-2: #37342e;
  --muted: #6c675d;
  --faint: #9a9489;

  --line: #e5dfd2;
  --line-strong: #d6cfbf;

  --brand: #163a32;
  --brand-2: #215046;
  --brand-3: #2d6657;
  --brand-soft: #e8efe9;
  --brand-tint: #f1f5f0;

  --gold: #b58a34;
  --gold-strong: #8f6a1f;
  --gold-soft: #f6edd8;

  --clay: #b25a3c;
  --clay-soft: #f9e9e1;
  --olive: #5f7136;
  --olive-soft: #edf1e2;
  --teal: #2f6570;
  --teal-soft: #e6f0f1;
  --indigo: #4a4f7d;
  --indigo-soft: #ececF7;
  --violet: #6d4f70;
  --violet-soft: #f2eaf2;
  --rose: #a04b62;
  --rose-soft: #f8e9ee;

  --ok: #2f6b4f;
  --ok-soft: #e7f1ea;
  --warn: #94651c;
  --warn-soft: #f8efd9;
  --danger: #a5433a;
  --danger-soft: #f8e7e4;

  --focus: #2d6657;

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 30px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(28, 23, 14, 0.05);
  --shadow-sm: 0 1px 2px rgba(28, 23, 14, 0.04), 0 6px 16px -12px rgba(28, 23, 14, 0.28);
  --shadow-md: 0 2px 4px rgba(28, 23, 14, 0.04), 0 18px 34px -26px rgba(28, 23, 14, 0.42);
  --shadow-lg: 0 30px 70px -34px rgba(24, 20, 12, 0.42), 0 2px 8px rgba(24, 20, 12, 0.05);

  /* Type */
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Consolas", "SF Mono", ui-monospace, monospace;

  /* Layout */
  --sidebar-w: 274px;
  --page-max: 1216px;
  --topbar-h: 68px;
  --gutter: 40px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 520px at 8% -12%, #fffaf0 0%, rgba(255, 250, 240, 0) 62%),
    radial-gradient(900px 520px at 104% -4%, #edf3ee 0%, rgba(237, 243, 238, 0) 58%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote {
  margin: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.14;
  color: var(--ink);
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

::selection {
  background: rgba(181, 138, 52, 0.28);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Scrollbars (subtle) */
* {
  scrollbar-width: thin;
  scrollbar-color: #cfc7b6 transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: #d3cbbb;
  border-radius: 999px;
  border: 3px solid var(--paper);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ------------------------------------------------------------ utilities */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--brand);
  color: #fbf7ec;
  font-size: 14px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}
.skip-link:focus {
  transform: translateY(0);
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { font-weight: 650; }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-strong);
}
.eyebrow--muted { color: var(--muted); }

.stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.stack--sm { gap: 12px; }
.stack--xs { gap: 8px; }
.stack--lg { gap: 34px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row--between {
  justify-content: space-between;
}
.row--wrap { flex-wrap: wrap; }
.row--top { align-items: flex-start; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 4px 0;
}

.hide-mobile { display: initial; }
.show-mobile { display: none; }

/* ------------------------------------------------------------- app boot */

.app-root {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  text-align: center;
  padding: 40px;
}
.boot-mark {
  color: var(--brand);
  animation: boot-pulse 1.8s ease-in-out infinite;
}
.boot-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--brand);
  margin-top: 10px;
}
.boot-sub {
  font-size: 13px;
  color: var(--muted);
}

@keyframes boot-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

/* Fatal error screen */
.fatal {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 14px;
  max-width: 620px;
  margin: 0 auto;
  padding: 40px;
}
.fatal h1 {
  font-size: 26px;
}
.fatal pre {
  font-size: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 10px;
  overflow: auto;
  max-height: 220px;
  color: var(--danger);
}

.noscript {
  max-width: 560px;
  margin: 12vh auto;
  padding: 32px;
  text-align: center;
}

/* --------------------------------------------------------------- motion */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes slide-left {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

.page-enter {
  animation: rise-in 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
