/* Trio base: reset, type, layout shell, utilities. Tokens live in tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--strip-h) + var(--sp-2));
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-14);
  line-height: var(--lh-prose);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-head); font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: var(--fs-20); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-16); }
h3 { font-size: var(--fs-14); }
h4 { font-size: var(--fs-13); color: var(--ink-2); }
p { margin: 0 0 var(--sp-1); }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-2) 0; }
code, kbd, samp { font-family: var(--font-num); font-size: 0.92em; }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

/* every number: mono, tabular */
.num, .num-lg, .num-xl, .hero-num, .mono {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 0;
  letter-spacing: -0.01em;
}
.num-lg { font-size: var(--fs-20); font-weight: 600; }
.num-xl { font-size: var(--fs-28); font-weight: 600; line-height: 1.1; }
.hero-num { font-size: var(--fs-40); font-weight: 600; line-height: 1.05; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* type helpers */
.t-12 { font-size: var(--fs-12); }
.t-13 { font-size: var(--fs-13); }
.t-14 { font-size: var(--fs-14); }
.t-16 { font-size: var(--fs-16); }
.t-20 { font-size: var(--fs-20); }
.muted { color: var(--ink-3); }
.secondary { color: var(--ink-2); }
.eyebrow { font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.prose { line-height: var(--lh-prose); max-width: 72ch; }

/* focus: 2px accent ring, offset */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: var(--sp-1); top: -100px; z-index: var(--z-toast);
  background: var(--accent); color: var(--accent-ink); padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-ctl); font-weight: 600;
}
.skip-link:focus { top: var(--sp-1); }
.skip-link { min-height: var(--tap); display: inline-flex; align-items: center; }

/* ---------- layout helpers ---------- */
.stack > * + * { margin-top: var(--sp-2); }
.stack-sm > * + * { margin-top: var(--sp-1); }
.stack-lg > * + * { margin-top: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-1); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--sp-2); }
.grid-auto { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.grid-2 { display: grid; gap: var(--sp-2); grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-1);
  gap: var(--sp-2);
  z-index: var(--z-header);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: var(--sp-0) var(--sp-1);
  color: var(--ink); text-decoration: none; min-height: 40px;
}
.brand:hover { text-decoration: none; }
.brand-mark { flex: none; width: 28px; height: 28px; object-fit: contain; }

/* wordmark: lowercase "trio", underlined by a rule */
.wordmark {
  position: relative; display: inline-block;
  font-family: var(--font-head); font-weight: 700; font-size: var(--fs-20);
  letter-spacing: -0.02em; line-height: 1;
  padding-bottom: 5px;
}
.wordmark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; border-radius: 2px; background: var(--brand-1);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 0 var(--sp-1);
  border-radius: var(--radius-ctl);
  color: var(--ink-2); font-weight: 500; font-size: var(--fs-14);
  text-decoration: none; position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link:hover { background: var(--hover-wash); color: var(--ink); text-decoration: none; }
.nav-link .icon { flex: none; }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-1);
}
.nav-link[aria-current="page"] .icon { color: var(--accent); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-1); }
.rail-note { font-size: var(--fs-12); color: var(--ink-3); padding: 0 var(--sp-1); }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--sp-1);
  height: var(--header-h);
  padding: 0 var(--sp-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { display: none; }
.cmd-trigger {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: 32px; min-width: 260px; padding: 0 var(--sp-1);
  background: var(--surface); color: var(--ink-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-ctl);
  text-align: left;
}
.cmd-trigger:hover { background: var(--surface-2); color: var(--ink-2); }
.cmd-trigger .grow { font-size: var(--fs-13); }
.topbar-spacer { flex: 1; }
.cmd-short { display: none; }

.status-strip {
  position: sticky; top: var(--header-h); z-index: var(--z-sticky);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-2);
  min-height: var(--strip-h);
  padding: 0 var(--sp-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-12); color: var(--ink-3);
}
.status-strip .sep { color: var(--border-strong); }
.status-strip .num { color: var(--ink-2); }
.status-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-updating { color: var(--info); }
.lbl-short { display: none; }
.status-updating .dot { background: var(--info); animation: pulse 1.4s ease-in-out infinite; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

.content {
  width: 100%; max-width: var(--content-max);
  margin: 0 auto; padding: var(--sp-3);
  flex: 1;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.section { margin-top: var(--sp-4); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-1); }
.section-head h2 { font-size: var(--fs-16); }

.bottombar { display: none; }

/* collapse rail to icons below 1280 */
@media (max-width: 1279.98px) {
  .app { grid-template-columns: var(--rail-w-collapsed) minmax(0, 1fr); }
  .brand .wordmark, .nav-link .label, .rail-note, .rail-foot .btn .label { display: none; }
  .brand { justify-content: center; padding: var(--sp-0); }
  .nav-link { justify-content: center; padding: 0; min-height: 44px; }
  .nav-link[aria-current="page"]::before { left: -8px; }
  .rail { padding: var(--sp-2) 8px; }
}

/* phone: bottom bar, single column */
@media (max-width: 767.98px) {
  .app { display: block; }
  .rail { display: none; }
  /* opened from the iPhone home screen the page runs under the status bar: keep the header below it */
  .topbar { padding: env(safe-area-inset-top, 0px) max(var(--sp-2), env(safe-area-inset-right, 0px)) 0 max(var(--sp-2), env(safe-area-inset-left, 0px));
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
  /* 16px fields stop iPhone Safari zooming in when one is tapped */
  .input, .select, textarea, input[type="search"], input[type="number"], input[type="text"], input[type="password"] { font-size: 16px; }
  .topbar-brand { display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin-left: -8px; }
  .cmd-trigger { min-width: 0; flex: 1; height: var(--tap); }
  .cmd-trigger .kbd-hint { display: none; }
  .cmd-long { display: none; }
  .cmd-short { display: inline; }
  .status-strip { padding: var(--sp-0) var(--sp-2); }
  /* one line on a phone: the weights and "Times in ET" are repeated in each screen's own notice */
  .status-item--weights, .status-item--tz { display: none !important; }
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .content { padding: var(--sp-2); padding-bottom: calc(var(--bottombar-h) + var(--sp-3) + env(safe-area-inset-bottom, 0px)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-header);
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .bottombar a, .bottombar button {
    flex: 1 1 0; min-width: 0; min-height: var(--tap);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-2); font-size: var(--fs-12); font-weight: 500;
    background: none; border: 0; text-decoration: none; padding: 0;
  }
  .bottombar a[aria-current="page"] { color: var(--accent); }
  .bottombar .icon { width: 22px; height: 22px; }
  .more-sheet {
    position: fixed; left: var(--sp-1); right: var(--sp-1);
    bottom: calc(var(--bottombar-h) + var(--sp-1) + env(safe-area-inset-bottom, 0px));
    z-index: var(--z-overlay);
    background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
    padding: var(--sp-1);
  }
  .more-sheet a { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 var(--sp-2); color: var(--ink); border-radius: var(--radius-ctl); text-decoration: none; }
  .more-sheet a:hover, .more-sheet a[aria-current="page"] { background: var(--accent-soft); }
}
@media (min-width: 768px) { .more-sheet { display: none !important; } }

/* print: show the data, drop the chrome */
@media print {
  .rail, .topbar, .status-strip, .bottombar, .toast-region, .drawer, .drawer-scrim { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* the Trio AI(TM) mark: the trademark sign is always small and raised, never full size */
.tm { font-size: 0.45em; line-height: 0; vertical-align: super; margin-left: 0.1em; font-weight: 500; letter-spacing: 0; }

