/*
 * STATIX calculator-site layer, 2026-09-27.
 *
 * This file is deliberately opt-in.  It is linked only by the isolated
 * calculator candidate and all selectors are scoped to body.stx-calc-theme.
 * The calculator pages keep their existing markup, IDs, event handlers,
 * diagrams, engines and auth tags; this layer only aligns the visual chrome
 * with the public STATIX site.
 */
:where(body.stx-calc-theme) {
  --stx-ground: #f5faf8;
  --stx-panel: #ffffff;
  --stx-panel-soft: #e9f3ef;
  --stx-border: #c3dad3;
  --stx-border-soft: #dce8e5;
  --stx-ink: #123a38;
  --stx-muted: #5e7c78;
  --stx-faint: #90a8a3;
  --stx-chrome: #0f3d31;
  --stx-teal: #1c9c8e;
  --stx-teal-deep: #14796e;
  --stx-good: #2e8b57;
  --stx-warn: #c58a1e;
  --stx-bad: #ce5a40;
  --stx-shadow: 0 2px 4px rgba(18, 58, 56, .06), 0 12px 30px rgba(18, 58, 56, .06);
  --stx-radius: 10px;
  background: var(--stx-ground);
  color: var(--stx-ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:where(body.stx-calc-theme) body,
:where(body.stx-calc-theme) input,
:where(body.stx-calc-theme) select,
:where(body.stx-calc-theme) textarea,
:where(body.stx-calc-theme) button {
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:where(body.stx-calc-theme) .hero h1,
:where(body.stx-calc-theme) .soon h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  letter-spacing: -.01em;
}

:where(body.stx-calc-theme) .hero h1 {
  color: var(--stx-ink);
  font-size: 32px;
  line-height: 1.08;
}

:where(body.stx-calc-theme) .hero .lab + h1 {
  font-size: clamp(30px, 4.4vw, 48px);
}

:where(body.stx-calc-theme) .soon h2 {
  color: #fff;
}

:where(body.stx-calc-theme) .hero {
  padding-top: 28px;
  padding-bottom: 4px;
}

/* Dense calculator headings follow the homepage's UI face. Fraunces is reserved
 * for the page/display hierarchy, not input cards, check rows or calc-sheet
 * subheads. */
:where(body.stx-calc-theme) .card h2,
:where(body.stx-calc-theme) .card h3,
:where(body.stx-calc-theme) .card h4,
:where(body.stx-calc-theme) .sheet h3,
:where(body.stx-calc-theme) .glabel,
:where(body.stx-calc-theme) .dlabel,
:where(body.stx-calc-theme) .lab,
:where(body.stx-calc-theme) .eyebrow,
:where(body.stx-calc-theme) .badge {
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:where(body.stx-calc-theme) .titlebar,
:where(body.stx-calc-theme) header.top {
  background: rgba(245, 250, 248, .96);
  color: var(--stx-ink);
  border-bottom: 1px solid var(--stx-border);
  box-shadow: 0 1px 0 rgba(18, 58, 56, .03);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

:where(body.stx-calc-theme) .titlebar .brand img {
  filter: brightness(0) saturate(100%) !important;
}

:where(body.stx-calc-theme) .titlebar nav a,
:where(body.stx-calc-theme) header.top a {
  color: var(--stx-ink);
}

:where(body.stx-calc-theme) .titlebar nav a:hover,
:where(body.stx-calc-theme) header.top a:hover {
  color: var(--stx-teal-deep);
}

:where(body.stx-calc-theme) .ver,
:where(body.stx-calc-theme) header.top .brand small {
  color: var(--stx-muted);
}

:where(body.stx-calc-theme) .titlebar .ver {
  border-color: var(--stx-border);
  color: var(--stx-muted);
}

/* statix-auth.js owns these controls and injects its rules after this link;
 * the important declarations keep only the dock readable on the light shell.
 * The modal/account gate remains dark and is intentionally out of scope. */
:where(body.stx-calc-theme) #stx-acct-dock .stx-brand small,
:where(body.stx-calc-theme) #stx-acct-dock .stx-email {
  color: var(--stx-muted) !important;
}

:where(body.stx-calc-theme) #stx-acct-dock .stx-plan {
  background: var(--stx-panel-soft) !important;
  border-color: var(--stx-border) !important;
  color: var(--stx-teal-deep) !important;
}

:where(body.stx-calc-theme) #stx-acct-dock .stx-ghost {
  color: var(--stx-ink) !important;
  border-color: var(--stx-border) !important;
}

:where(body.stx-calc-theme) #stx-acct-dock .stx-solid {
  background: var(--stx-chrome) !important;
  color: #fff !important;
  border-color: var(--stx-chrome) !important;
}

:where(body.stx-calc-theme) #stx-acct-dock .stx-plain {
  color: var(--stx-teal-deep) !important;
}

:where(body.stx-calc-theme) #stx-acct-dock .stx-ghost:hover,
:where(body.stx-calc-theme) #stx-acct-dock .stx-plain:hover {
  color: var(--stx-teal-deep) !important;
  border-color: var(--stx-teal) !important;
}

:where(body.stx-calc-theme) .card,
:where(body.stx-calc-theme) .panel,
:where(body.stx-calc-theme) .box,
:where(body.stx-calc-theme) section.panel,
:where(body.stx-calc-theme) .sheet,
:where(body.stx-calc-theme) .cc {
  background: var(--stx-panel);
  border-color: var(--stx-border);
  border-radius: var(--stx-radius);
  box-shadow: var(--stx-shadow);
}

:where(body.stx-calc-theme) .hero {
  color: var(--stx-ink);
}

:where(body.stx-calc-theme) .hero p,
:where(body.stx-calc-theme) .hero .sub,
:where(body.stx-calc-theme) .lede,
:where(body.stx-calc-theme) .hint,
:where(body.stx-calc-theme) .dethint,
:where(body.stx-calc-theme) .sub,
:where(body.stx-calc-theme) .muted {
  color: var(--stx-muted);
}

:where(body.stx-calc-theme) .lab,
:where(body.stx-calc-theme) .eyebrow,
:where(body.stx-calc-theme) .glabel,
:where(body.stx-calc-theme) .label-cap {
  color: var(--stx-teal-deep);
}

:where(body.stx-calc-theme) .lab,
:where(body.stx-calc-theme) .chip,
:where(body.stx-calc-theme) .badge {
  background: var(--stx-panel-soft);
  border-color: var(--stx-border);
}

:where(body.stx-calc-theme) input,
:where(body.stx-calc-theme) select,
:where(body.stx-calc-theme) textarea,
:where(body.stx-calc-theme) .field input,
:where(body.stx-calc-theme) .field select,
:where(body.stx-calc-theme) .sched select {
  background: #fff;
  color: var(--stx-ink);
  border-color: var(--stx-border);
  border-radius: 6px;
}

:where(body.stx-calc-theme) input:focus,
:where(body.stx-calc-theme) select:focus,
:where(body.stx-calc-theme) textarea:focus {
  outline: 3px solid rgba(28, 156, 142, .22);
  border-color: var(--stx-teal);
}

:where(body.stx-calc-theme) .btn,
:where(body.stx-calc-theme) .btn-primary,
:where(body.stx-calc-theme) .cta,
:where(body.stx-calc-theme) .cta-top {
  background: var(--stx-teal-deep);
  border-color: var(--stx-teal-deep);
  color: #fff;
  border-radius: 6px;
}

:where(body.stx-calc-theme) .btn:hover,
:where(body.stx-calc-theme) .btn-primary:hover,
:where(body.stx-calc-theme) .cta:hover,
:where(body.stx-calc-theme) .cta-top:hover {
  background: var(--stx-teal);
  border-color: var(--stx-teal);
  color: #fff;
}

:where(body.stx-calc-theme) .btn-ghost,
:where(body.stx-calc-theme) .btn-outline,
:where(body.stx-calc-theme) .beamtab,
:where(body.stx-calc-theme) .chip {
  background: var(--stx-panel);
  color: var(--stx-ink);
  border-color: var(--stx-border);
}

:where(body.stx-calc-theme) .beamtab.on,
:where(body.stx-calc-theme) .btn-ghost:hover,
:where(body.stx-calc-theme) .btn-outline:hover {
  background: var(--stx-panel-soft);
  border-color: var(--stx-teal);
  color: var(--stx-teal-deep);
}

:where(body.stx-calc-theme) .sched th,
:where(body.stx-calc-theme) .sched.bbs th {
  background: var(--stx-panel-soft);
  color: var(--stx-teal-deep);
  border-color: var(--stx-border);
}

:where(body.stx-calc-theme) .sched td,
:where(body.stx-calc-theme) .sched th,
:where(body.stx-calc-theme) table.res td,
:where(body.stx-calc-theme) .chk {
  border-color: var(--stx-border-soft);
}

:where(body.stx-calc-theme) .verdict,
:where(body.stx-calc-theme) .trust {
  border-color: var(--stx-border);
}

:where(body.stx-calc-theme) .trust {
  background: var(--stx-chrome);
  color: #c9dbd4;
}

:where(body.stx-calc-theme) footer {
  background: var(--stx-ground);
  color: var(--stx-muted);
  border-top: 1px solid var(--stx-border);
}

:where(body.stx-calc-theme) footer a {
  color: var(--stx-teal-deep);
}

:where(body.stx-calc-theme) footer .fgrid .k {
  color: var(--stx-teal-deep);
}

:where(body.stx-calc-theme) footer .fgrid .v {
  color: var(--stx-ink);
}

:where(body.stx-calc-theme) footer .fend {
  border-top-color: var(--stx-border);
  color: var(--stx-muted);
}

:where(body.stx-calc-theme) .mono,
:where(body.stx-calc-theme) code,
:where(body.stx-calc-theme) kbd,
:where(body.stx-calc-theme) samp,
:where(body.stx-calc-theme) .num,
:where(body.stx-calc-theme) .val,
:where(body.stx-calc-theme) .unit,
:where(body.stx-calc-theme) input[type='number'],
:where(body.stx-calc-theme) td.num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* Keep the directory's search and category grids immediately available. */
:where(body.stx-calc-theme) .filterbar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 12px 20px;
  position: relative;
  z-index: 1;
  margin-top: 14px;
}

:where(body.stx-calc-theme) .filterbar input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--stx-border);
  padding: 10px 14px;
  font: inherit;
}

:where(body.stx-calc-theme) .filterbar .nohits { grid-column: 1 / -1; }
:where(body.stx-calc-theme) .cc[hidden],
:where(body.stx-calc-theme) .gtitle[hidden],
:where(body.stx-calc-theme) .grid[hidden],
:where(body.stx-calc-theme) .nohits[hidden] { display: none !important; }
:where(body.stx-calc-theme) .hero .lab ~ p { max-width: 86ch; font-size: 17px; margin-bottom: 12px; }
:where(body.stx-calc-theme) .hero .lab ~ .badge { margin-top: 0; }
:where(body.stx-calc-theme) .hero .lab ~ .chips { margin-top: 14px !important; }

/* The featured drawing tool occupies one useful row above the categories. */
:where(body.stx-calc-theme) .filterbar + .grid { grid-template-columns: 1fr; margin: 20px 0 28px; }
:where(body.stx-calc-theme) .filterbar + .grid .cc { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 16px; }
:where(body.stx-calc-theme) .filterbar + .grid .ic { grid-column: 1; grid-row: 1 / 4; margin-bottom: 0; }
:where(body.stx-calc-theme) .filterbar + .grid .code { grid-column: 2; grid-row: 1; }
:where(body.stx-calc-theme) .filterbar + .grid h3 { grid-column: 2; grid-row: 2; }
:where(body.stx-calc-theme) .filterbar + .grid p { grid-column: 2; grid-row: 3; }
:where(body.stx-calc-theme) .filterbar + .grid .go { grid-column: 3; grid-row: 1 / 4; align-self: center; margin-top: 0; }

:where(body.stx-calc-theme) .grid {
  align-items: stretch;
}

:where(body.stx-calc-theme) .cc:hover {
  border-color: var(--stx-teal);
  box-shadow: 0 10px 26px rgba(18, 58, 56, .11);
}

@media (max-width: 760px) {
  :where(body.stx-calc-theme) .filterbar { grid-template-columns: 1fr; gap: 8px; }
  :where(body.stx-calc-theme) .filterbar .lab { justify-self: start; }
  :where(body.stx-calc-theme) .filterbar + .grid .cc { grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; }
  :where(body.stx-calc-theme) .filterbar + .grid .ic { width: 32px; height: 32px; }
  :where(body.stx-calc-theme) .filterbar + .grid .go { grid-column: 2; grid-row: 4; margin-top: 8px; }
  :where(body.stx-calc-theme) .titlebar .wrap {
    gap: 10px;
  }

  :where(body.stx-calc-theme) .titlebar nav {
    width: 100%;
    gap: 10px 16px;
    padding-bottom: 8px;
  }

  :where(body.stx-calc-theme) .titlebar nav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  :where(body.stx-calc-theme) .hero h1 {
    font-size: 27px;
  }

  :where(body.stx-calc-theme) .hero .lab + h1 {
    font-size: clamp(34px, 12vw, 48px);
  }
}

@media print {
  :where(body.stx-calc-theme) .titlebar,
  :where(body.stx-calc-theme) .hero,
  :where(body.stx-calc-theme) .trust,
  :where(body.stx-calc-theme) .cta-top,
  :where(body.stx-calc-theme) #printBtn,
  :where(body.stx-calc-theme) .col-in,
  :where(body.stx-calc-theme) footer {
    display: none !important;
  }

  :where(body.stx-calc-theme) {
    background: #fff;
    color: #123a38;
  }

  :where(body.stx-calc-theme) .layout {
    grid-template-columns: 1fr;
    margin: 0;
  }

  :where(body.stx-calc-theme) .card {
    box-shadow: none;
    border-color: #b7c7c1;
    break-inside: avoid;
  }
}
