/* system.css — Addison at the Wheel design system.
   Palette is locked: dark ink + #6C8CFF #A9BEFF #9D7BFF #E86BD8.
   No brown, tan, cream, amber, orange, wood, or teal anywhere. */

:root {
  /* Ground */
  --ink-0: #050609;
  --ink-1: #06101f;
  --ink-2: #0b1830;
  --ink-3: #101f3c;
  --edge:  #24344f;
  --edge-bright: #35507d;

  /* Signal spectrum */
  --signal: #6C8CFF;   /* primary blue  — PRACTICE ring, primary action */
  --ice:    #A9BEFF;   /* label blue    — labels, glow, secondary text */
  --violet: #9D7BFF;   /* violet        — HOMEWORK ring, Spanish */
  --pink:   #E86BD8;   /* pink          — CHECK-IN ring, Hexa, celebration */

  /* Text */
  --text:      #eaf2ff;
  --text-soft: #c5d8f5;
  --text-dim:  #8ba3c7;

  /* Type */
  --ui: "Schibsted Grotesk", "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  /* Motion — one vocabulary, used everywhere */
  --ease-out:  cubic-bezier(0.22, 1, 0.36, 1);   /* arrivals, ring fills */
  --ease-in:   cubic-bezier(0.55, 0, 1, 0.45);   /* departures */
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);     /* neutral state change */
  --spring:    cubic-bezier(0.34, 1.56, 0.64, 1);/* pops, celebrations */
  --t-fast: 160ms;
  --t-base: 280ms;
  --t-ring: 400ms;
  --t-slow: 700ms;

  /* Shape */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-xl: 32px;

  /* Depth — cool shadows only, never warm */
  --lift-1: 0 2px 10px rgba(4, 8, 20, 0.5);
  --lift-2: 0 10px 30px rgba(4, 8, 20, 0.6);
  --glow-signal: 0 0 0 1px rgba(108, 140, 255, 0.35), 0 0 24px rgba(108, 140, 255, 0.25);
  --glow-pink:   0 0 0 1px rgba(232, 107, 216, 0.35), 0 0 24px rgba(232, 107, 216, 0.25);

  /* Layout */
  --pad: clamp(16px, 2.2vw, 28px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* An author `display` rule beats the UA stylesheet's [hidden]{display:none}, so
   .gate and .sheet would stay visible when hidden. Make hidden actually hide. */
[hidden] { display: none !important; }



html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink-1);
  color: var(--text);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

body {
  background:
    radial-gradient(90% 55% at 88% -6%, rgba(157, 123, 255, 0.20), transparent 60%),
    radial-gradient(70% 45% at 4% 100%, rgba(108, 140, 255, 0.16), transparent 60%),
    var(--ink-1);
  background-attachment: fixed;
}

/* Touch-first: nothing tappable smaller than 44pt */
button, .tap { min-height: 44px; min-width: 44px; font-family: inherit; }

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.12; font-weight: 700; }
h1 { font-size: clamp(26px, 3.4vw, 40px); }
h2 { font-size: clamp(20px, 2.2vw, 27px); }
h3 { font-size: clamp(16px, 1.5vw, 19px); }
h4 { font-size: 15px; font-weight: 600; }
p  { margin: 0; }

.label {
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ice);
}
.dim  { color: var(--text-dim); }
.soft { color: var(--text-soft); }
.mono { font-family: var(--mono); }
.num  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---- Surfaces ---- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  padding: var(--pad);
  box-shadow: var(--lift-1);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}
.card.tight { padding: 14px 16px; border-radius: var(--r); }
.card.accent-signal { border-color: rgba(108,140,255,0.45); box-shadow: var(--glow-signal); }
.card.accent-pink   { border-color: rgba(232,107,216,0.45); box-shadow: var(--glow-pink); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border: 1px solid var(--edge-bright);
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--ease-soft),
              border-color var(--t-fast) var(--ease-soft), box-shadow var(--t-fast) var(--ease-soft);
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--signal), var(--violet));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 22px rgba(108,140,255,0.38);
}
.btn.pink {
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 22px rgba(232,107,216,0.34);
}
.btn.ghost { background: transparent; }
.btn.big { padding: 18px 30px; font-size: 19px; border-radius: var(--r-lg); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--edge);
  background: rgba(255,255,255,0.04);
  font: 600 12.5px/1 var(--ui); color: var(--text-soft);
  white-space: nowrap;
}
.chip.signal { border-color: rgba(108,140,255,0.5); color: var(--ice); }
.chip.pink   { border-color: rgba(232,107,216,0.5); color: #ffc7f4; }
.chip.violet { border-color: rgba(157,123,255,0.5); color: #d3c4ff; }
/* Honest-unknown chip. Required whenever a fact is not known. */
.chip.unknown {
  border-style: dashed; border-color: var(--edge-bright);
  color: var(--text-dim); background: transparent;
}

/* Source tag — every number must be able to say where it came from */
.src { font: 500 10px/1 var(--mono); color: var(--text-dim); letter-spacing: 0.04em; }

/* ---- Hexa's tank ----
   The clips are 640x640 with periwinkle water. The tank frames that water as
   her habitat, so no chroma-key is needed and no warm tone ever appears. */
.tank {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(169, 190, 255, 0.35);
  box-shadow: 0 0 0 6px rgba(108, 140, 255, 0.08), 0 18px 44px rgba(4, 8, 20, 0.6),
              inset 0 0 40px rgba(108, 140, 255, 0.18);
  background: radial-gradient(circle at 50% 40%, #93a8e8, #5f6fae);
}
.tank video, .tank img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* Cool rim light + water caustics over the video, keeps the frame in palette */
.tank::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 30% 22%, rgba(255,255,255,0.22), transparent 42%),
    radial-gradient(circle at 72% 82%, rgba(108,140,255,0.24), transparent 52%);
  mix-blend-mode: screen;
}
.tank.rounded { border-radius: var(--r-xl); }
.tank.calm    { --fin: var(--ice); }
.tank.stressed{ --fin: var(--pink); }
/* Gill state ring — the "fins show stress or calm" channel, inherited from Flower */
.tank .gills {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px var(--fin, var(--ice));
  opacity: 0.75;
  transition: box-shadow var(--t-slow) var(--ease-soft), opacity var(--t-slow) var(--ease-soft);
}
.tank.stressed .gills { animation: gill-pulse 2.4s var(--ease-soft) infinite; }
@keyframes gill-pulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.95; }
}

/* Speech bubble from Hexa */
.bubble {
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid rgba(169,190,255,0.38);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  color: var(--text);
  font-size: 16.5px;
  box-shadow: var(--lift-1);
  animation: bubble-in var(--t-base) var(--spring) both;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ---- Motion utilities ---- */
.rise   { animation: rise var(--t-base) var(--ease-out) both; }
.rise-2 { animation: rise var(--t-base) var(--ease-out) 60ms both; }
.rise-3 { animation: rise var(--t-base) var(--ease-out) 120ms both; }
.rise-4 { animation: rise var(--t-base) var(--ease-out) 180ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.pop { animation: pop 500ms var(--spring) both; }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

.shake-soft { animation: shake-soft 420ms var(--ease-soft) both; }
@keyframes shake-soft {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

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

/* ---- Layout helpers ---- */
.wrap { max-width: 1240px; margin: 0 auto; padding: calc(var(--safe-top) + 14px) var(--pad) calc(var(--safe-bottom) + 120px); }
.row  { display: flex; gap: 12px; align-items: center; }
.row.wrapped { flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) { .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 620px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* ---- Tab bar (bottom, thumb reach on iPad) ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(6,16,31,0.6), rgba(6,16,31,0.95));
  border-top: 1px solid var(--edge);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.tabbar button {
  flex: 1 1 0; max-width: 150px;
  display: grid; place-items: center; gap: 3px;
  padding: 8px 6px;
  background: transparent; border: 0; border-radius: var(--r);
  color: var(--text-dim); font: 600 11.5px/1.1 var(--ui);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-soft), background var(--t-fast) var(--ease-soft);
}
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--text); background: rgba(108,140,255,0.14); }

/* ---- Screens ---- */
.screen { display: none; }
.screen[data-active] { display: block; animation: screen-in var(--t-base) var(--ease-out) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- Print: the breakfast sheet is black on white and must survive grayscale ---- */
@media print {
  @page { size: letter portrait; margin: 0.5in; }
  html, body { background: #fff !important; color: #000 !important; }
  .noprint, .tabbar { display: none !important; }
  .card { border: 1px solid #000 !important; box-shadow: none !important; background: #fff !important; backdrop-filter: none !important; }
  .printonly { display: block !important; }
}
.printonly { display: none; }
