/* ==========================================================================
   Iteas Hub · base.css
   Fluid root size, reset, typography, icons, focus and small utilities.
   Everything is sized in rem. 1rem follows the viewport (≈1rem on a
   laptop, up to 1.286rem on large screens) times the user zoom (--zoom).
   ========================================================================== */

/* ---------- fluid root ---------- */
html {
  font-size: calc(clamp(0.875rem, 0.39vw + 0.53rem, 1.125rem) * var(--zoom, 1));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-ligatures: no-contextual;  /* JetBrains Mono's code ligatures turn "//" into a gap */
  overflow: hidden;            /* the layout scrolls inside .page */
}
h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }

/* ---------- scrollbars ---------- */
/* Every scroll area follows the theme (tokens in themes.css, section 6). To recolour the
   scrollbars of one area, set --scroll-thumb, --scroll-thumb-hover and --scroll-track on it,
   or add .scroll-spine on a dark surface. */
.scroll-spine {
  --scroll-thumb: var(--scroll-thumb-spine);
  --scroll-thumb-hover: var(--scroll-thumb-spine-hover);
}
/* scrollbar-width only together with scrollbar-color: a browser that knows the width but
   not the colour would otherwise drop the ::-webkit-scrollbar colours below */
@supports (scrollbar-color: auto) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
  *:hover { scrollbar-color: var(--scroll-thumb-hover) var(--scroll-track); }
}
/* browsers without scrollbar-color, Safari among them */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: var(--scroll-size); height: var(--scroll-size); }
  ::-webkit-scrollbar-track { background: var(--scroll-track); }
  ::-webkit-scrollbar-thumb {
    border: 0.143rem solid transparent;
    border-radius: var(--scroll-size);
    background: var(--scroll-thumb) padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover) padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }
}
ul[role="list"], ol[role="list"] { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
input, button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }

::selection { background: var(--acc); color: var(--acc-text); }

/* ---------- typography ---------- */
.display { font-family: var(--font-display); font-weight: var(--fw-display); letter-spacing: var(--ls-display); }
.mono { font-family: var(--font-mono); }
.lbl {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
}
.h2 { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: var(--fw-display); letter-spacing: var(--ls-display); line-height: 1.15; }
.h3 { font-family: var(--font-display); font-size: var(--fs-h3); font-weight: var(--fw-display); letter-spacing: var(--ls-display); line-height: 1.2; }
.num { font-variant-numeric: tabular-nums; }
.pretty { text-wrap: pretty; }
.help { color: var(--faint); font-size: var(--fs-sm); }

/* ---------- links ---------- */
a { color: var(--acc); text-decoration: none; }
a:hover { color: var(--acc-hover); text-decoration: underline; }

/* ---------- focus ---------- */
:focus-visible { outline: var(--focus-ring); outline-offset: var(--hair-2); }
:focus:not(:focus-visible) { outline: none; }
/* FocusOnNavigate (Routes.razor) focuses the h1 for screen readers; a heading is no control, so it shows no ring. */
h1[tabindex="-1"]:focus { outline: none; }

/* ---------- icons ---------- */
/* <svg class="icon" viewBox="0 0 18 18"><path d="…"/></svg> */
.icon {
  width: var(--icon);
  height: var(--icon);
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .f { fill: currentColor; stroke: none; }
.icon.sm { --icon: var(--icon-sm); }
.icon.lg { --icon: var(--icon-lg); }

/* ---------- utilities ---------- */
/* layout */
.row { display: flex; align-items: center; gap: 0.714rem; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.base { align-items: baseline; }
.row.top { align-items: flex-start; }
.row.end { align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: 0.714rem; min-width: 0; }
.gap-0 { gap: 0; }
.gap-xs { gap: 0.286rem; }
.gap-s { gap: 0.429rem; }
.gap-m { gap: 1rem; }
.gap-l { gap: 1.571rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.ml-auto { margin-left: auto; }
.self-start { align-self: flex-start; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 1rem; }

/* text colour */
.t-ink { color: var(--ink); }
.t-dim { color: var(--dim); }
.t-faint { color: var(--faint); }
.t-acc { color: var(--acc); }
.t-ok { color: var(--ok-t); }
.t-warn { color: var(--warn-t); }
.t-err { color: var(--err-t); }
.t-info { color: var(--info-t); }

/* text size and weight */
.fs-2xs { font-size: var(--fs-2xs); }
.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-base { font-size: var(--fs-base); }
.fs-md { font-size: var(--fs-md); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

/* overflow */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.clip { overflow: hidden; }

/* accessibility */
.visually-hidden {
  position: absolute !important;
  width: 0.071rem; height: 0.071rem;
  margin: -0.071rem; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Blazor reconnect / error UI (framework default element) */
#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-toast);
  padding: 0.714rem var(--gutter);
  background: var(--err-soft);
  border-top: var(--hair) solid var(--err-line);
  color: var(--err-t);
  font-size: var(--fs-base);
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
