/* Base layout + resets */

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--sw-text);
  background: var(--sw-bg);
  min-height: 100dvh;
}

/* Headings speak in the display voice: Sora, medium weights, set tight —
   precision instrument, never fat. */
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--sp-3); font-family: var(--font-display); }
h1 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--sw-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

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

/* Icons — Lucide sprite at /img/icons.svg */
.icon { width: 20px; height: 20px; flex: none; vertical-align: -0.28em; }
.icon--sm { width: 16px; height: 16px; vertical-align: -0.2em; }

/* The data voice: codes, references, money — anything a surveyor reads off a schedule. */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* Eyebrow — the title-block label (SHEET · ESTATE etc.) above page titles. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sw-text-muted);
  margin-bottom: var(--sp-1);
}
.eyebrow::before {
  content: '';
  width: 9px; height: 9px;
  border: 1.5px solid var(--sw-primary);
  flex: none;
}

/* App bar — deep signage green in both themes; the one fixed landmark. */
.appbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-4);
  min-height: 56px;
  background: var(--sw-ink-bar);
  color: var(--sw-ink-bar-text);
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  position: sticky;
  top: 0;
  z-index: 50;
}

.appbar__brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--sw-ink-bar-text); }
.appbar__brand:hover { text-decoration: none; }
.appbar__logo { width: 22px; height: 22px; fill: var(--sw-mint); }
.appbar__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  letter-spacing: -0.02em;
}
.appbar__name em { font-style: normal; color: var(--sw-mint); }

.appbar__nav { display: flex; gap: var(--sp-1); flex: 1; overflow-x: auto; align-self: stretch; }
.appbar__link {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-3);
  color: rgb(233 242 238 / 0.72);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  border-top: 2px solid transparent; /* keeps text optically centred */
}
.appbar__link:hover { color: var(--sw-ink-bar-text); text-decoration: none; background: rgb(255 255 255 / 0.06); }
.appbar__link--active {
  color: #ffffff;
  border-bottom-color: var(--sw-mint);
  background: rgb(255 255 255 / 0.05);
}

.appbar__meta { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.appbar__org {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: var(--radius-sm);
  color: rgb(233 242 238 / 0.85);
}
.appbar__org:hover { text-decoration: none; border-color: var(--sw-mint); color: #fff; }

.usermenu { position: relative; }
.usermenu__button {
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  color: var(--sw-ink-bar-text);
}
.usermenu__button::-webkit-details-marker { display: none; }
.usermenu__button:hover { background: rgb(255 255 255 / 0.08); }
.usermenu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--sw-surface-raised);
  border: 1px solid var(--sw-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: var(--sp-2);
  min-width: 160px;
  z-index: 60;
  color: var(--sw-text);
}

/* Page shell */
.page { max-width: 1200px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-6); }

@media (max-width: 720px) {
  .appbar { flex-wrap: wrap; padding: var(--sp-2) var(--sp-3); }
  .appbar__nav { order: 3; flex-basis: 100%; }
  .page { padding: var(--sp-4) var(--sp-3) var(--sp-6); }
}

/* ---------- offline state (shell.js toggles data-net elements) ---------- */
.net-disabled {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(1);
  cursor: not-allowed;
}
a.net-disabled { text-decoration: none; }

/* ---------- themed scrollbars everywhere (stock bars are a brick through the UI) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--sw-border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--sw-border-strong); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--sw-primary); }
