/* ==========================================================================
   Core-Monitor site — "bench instrument"

   The site is styled as the thing it advertises: a precision instrument.
   Light brushed-aluminum ground, machined 2px rules, square shoulders.
   Two signal colors carry meaning rather than decoration:

     --heat  deep signal orange-red : temperature, primary actions
     --cool  coolant teal           : fans, cooling, "handed back to macOS"

   Type is Bricolage Grotesque (variable: optical size + weight), self-hosted
   so the same-origin CSP stays intact. Spline Sans Mono appears only where
   the content is genuinely a readout or a command.

   Every token lives below; the dark variant swaps the chassis at the end of
   the file. All motion respects prefers-reduced-motion.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("fonts/bricolage-grotesque-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Spline Sans Mono";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/spline-sans-mono-latin.woff2") format("woff2");
}

:root {
  --bench: #e8eaec;
  --plate: #f6f7f8;
  --plate-deep: #dde0e3;
  --ink: #22272c;
  --dim: #59646e;
  --faint: #7f8994;

  --rule: #c3c9cf;
  --rule-strong: #22272c;

  --heat: #c93a0f;          /* accent surfaces, strokes            */
  --heat-text: #b13309;     /* accent text on light chassis        */
  --heat-hot: #e04a1a;      /* hover / active                      */
  --heat-ink: #ffffff;      /* text on heat surfaces               */
  --heat-wash: rgba(201, 58, 15, 0.07);

  --cool: #0f6672;
  --cool-text: #0c5761;
  --cool-wash: rgba(15, 102, 114, 0.08);

  --anodized: #171b1e;      /* the one dark band (privacy)         */
  --anodized-plate: #21272b;
  --anodized-ink: #e8ebed;
  --anodized-dim: #9fa9b1;
  --anodized-rule: #363e44;

  --sans: "Bricolage Grotesque", "Avenir Next", "Trebuchet MS", sans-serif;
  --mono: "Spline Sans Mono", "Andale Mono", monospace;

  --measure: 66ch;
  --span: 1160px;
  --bar-h: 60px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  background: var(--bench);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-h) + 1.25rem);
}

body {
  margin: 0;
  background: var(--bench);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--heat); color: var(--heat-ink); }

a { color: var(--heat-text); text-underline-offset: 3px; }
a:hover { color: var(--heat-hot); }

:focus-visible {
  outline: 2.5px solid var(--heat);
  outline-offset: 2px;
}

img, video, svg { max-width: 100%; height: auto; display: block; }

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

h1, h2, h3 {
  font-weight: 640;
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.7rem, 6.2vw, 4.6rem); font-weight: 700; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.3rem; line-height: 1.2; }

.shell {
  width: min(var(--span), calc(100% - 2.75rem));
  margin-inline: auto;
}

.sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skiplink {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 99;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bench);
  text-decoration: none;
}
.skiplink:focus { top: 0.5rem; color: var(--bench); }

/* ---------- top bar ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bench);
  border-bottom: 2px solid var(--rule-strong);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--bar-h);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 680;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.wordmark img { width: 27px; height: 27px; }

.site-menu {
  display: flex;
  gap: 1.35rem;
}
.site-menu a {
  color: var(--dim);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.site-menu a:hover { color: var(--ink); border-bottom-color: var(--heat); }

.menu-btn {
  display: none;
  border: 2px solid var(--rule-strong);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

/* ---------- actions ------------------------------------------------------ */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.35rem;
  border: 2px solid var(--rule-strong);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 620;
  text-decoration: none;
  color: var(--ink);
  background: none;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease,
              color 140ms ease, border-color 140ms ease;
}
.act:hover { transform: translateY(-1.5px); color: var(--ink); }
.act:active { transform: translateY(0); }

.act-heat {
  background: var(--heat);
  border-color: var(--heat);
  color: var(--heat-ink);
}
.act-heat:hover { background: var(--heat-hot); border-color: var(--heat-hot); color: var(--heat-ink); }

.act-line:hover { border-color: var(--heat); }

.act-bare {
  border-color: transparent;
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.act-bare:hover { color: var(--heat-text); }

.act-sm { padding: 0.45rem 0.95rem; font-size: 0.9rem; }

/* ---------- hero --------------------------------------------------------- */

.hero {
  padding: clamp(3rem, 7vh, 5.5rem) 0 clamp(2.5rem, 5vh, 4rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

.lede-sub {
  font-size: 1.15rem;
  color: var(--dim);
  margin: 1.4rem 0 2rem;
}

/* one orchestrated load moment: title, sub, and actions */
@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 640ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .rise-2 { animation-delay: 90ms; }
  .rise-3 { animation-delay: 180ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- framed screenshots ------------------------------------------- */

.bezel {
  margin: 0;
  border: 2px solid var(--rule-strong);
  background: var(--plate);
  padding: 0.6rem;
  box-shadow: 8px 8px 0 var(--plate-deep);
}
.bezel img { width: 100%; }
.bezel figcaption {
  padding: 0.55rem 0.25rem 0;
  font-size: 0.85rem;
  color: var(--dim);
}

.hero-shot { margin-top: clamp(2.5rem, 6vh, 4.5rem); }

/* ---------- bands (sections) --------------------------------------------- */

.band { padding: clamp(3rem, 8vh, 5.5rem) 0; }

.band-head { margin-bottom: 2.25rem; max-width: 46rem; }
.band-head h2 { margin-bottom: 0.4rem; }
.band-head p { color: var(--dim); font-size: 1.08rem; }

.band + .band { border-top: 1.5px solid var(--rule); }

/* ---------- filmstrip gallery -------------------------------------------- */

.strip-scroller {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 0.9rem;
  /* let the strip bleed to the viewport edge on the right */
  margin-right: calc(50% - 50vw);
  padding-right: max(1.375rem, calc(50vw - var(--span) / 2));
  scrollbar-color: var(--rule-strong) transparent;
}

.strip {
  display: flex;
  gap: 1.1rem;
  width: max-content;
}

.shot {
  margin: 0;
  scroll-snap-align: start;
  width: min(74vw, 470px);
  flex: none;
}
.shot.is-narrow { width: min(58vw, 300px); }

.shot a { display: block; border: 2px solid var(--rule-strong); background: var(--plate); padding: 0.45rem; }
.shot a:hover { border-color: var(--heat); }
.shot img { width: 100%; }

.shot figcaption {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.5rem;
  font-size: 0.88rem;
  color: var(--dim);
}
.shot figcaption b { color: var(--ink); font-weight: 620; }

.strip-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 0.25rem;
}

/* ---------- cooling / fan curve ------------------------------------------ */

.cooling-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.fan-points { margin: 1.75rem 0 0; }
.fan-points > div {
  padding: 0.9rem 0;
  border-top: 1.5px solid var(--rule);
}
.fan-points dt { font-weight: 640; margin-bottom: 0.15rem; }
.fan-points dd { margin: 0; color: var(--dim); max-width: 52ch; }

.curvebox {
  border: 2px solid var(--rule-strong);
  background: var(--plate);
  box-shadow: 8px 8px 0 var(--plate-deep);
  padding: 1.1rem 1.1rem 0.75rem;
}

.curvebox svg { width: 100%; height: auto; }

.curve-grid line { stroke: var(--plate-deep); stroke-width: 1; }
.curve-axis { font-family: var(--mono); font-size: 11px; fill: var(--faint); }

.curve-line {
  fill: none;
  stroke: var(--cool);
  stroke-width: 3;
  stroke-linecap: round;
}

.curve-node { fill: var(--plate); stroke: var(--cool); stroke-width: 2.5; }

.curve-op { fill: var(--heat); }
.curve-op-ring { fill: none; stroke: var(--heat); stroke-width: 2; opacity: 0; }

/* drawn when scrolled into view */
@media (prefers-reduced-motion: no-preference) {
  .curve-line {
    stroke-dasharray: 620;
    stroke-dashoffset: 620;
  }
  .curve-node, .curve-op { opacity: 0; transition: opacity 300ms ease; }

  .is-drawn .curve-line {
    transition: stroke-dashoffset 1400ms cubic-bezier(0.4, 0, 0.2, 1);
    stroke-dashoffset: 0;
  }
  .is-drawn .curve-node { opacity: 1; transition-delay: 1100ms; }
  .is-drawn .curve-op   { opacity: 1; transition-delay: 1350ms; }
  .is-drawn .curve-op-ring { animation: op-pulse 2600ms ease-out 1600ms infinite; }

  @keyframes op-pulse {
    0%   { opacity: 0.9; transform: scale(1); }
    70%  { opacity: 0;   transform: scale(2.1); }
    100% { opacity: 0; }
  }
  .curve-op-ring { transform-origin: center; transform-box: fill-box; }
}

.curve-caption {
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--dim);
}

/* ---------- field log (use cases) ---------------------------------------- */

.log {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(2rem, 5vw, 4.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.log li {
  padding: 1.15rem 0 1.25rem;
  border-top: 1.5px solid var(--rule);
}

.log h3 {
  font-size: 1.12rem;
  margin-bottom: 0.25rem;
  padding-left: 1.15rem;
  position: relative;
}
.log h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 0.55em;
  height: 0.55em;
  background: var(--heat);
}
.log li.is-cool h3::before { background: var(--cool); }

.log p { color: var(--dim); padding-left: 1.15rem; max-width: 48ch; }

/* ---------- touch bar ----------------------------------------------------- */

.reel-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.reel-note h3 { margin-bottom: 0.3rem; }
.reel-note p { color: var(--dim); }

/* ---------- privacy: the anodized band ------------------------------------ */

.anodized {
  background: var(--anodized);
  color: var(--anodized-ink);
  padding: clamp(3.5rem, 9vh, 6.5rem) 0;
  border-top: 2px solid var(--rule-strong);
  border-bottom: 2px solid var(--rule-strong);
}

.anodized h2 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  max-width: 15em;
}

.anodized-grid {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.anodized-copy p { color: var(--anodized-dim); }
.anodized-copy a { color: var(--anodized-ink); }

.readouts {
  margin: 0;
  border: 1.5px solid var(--anodized-rule);
  background: var(--anodized-plate);
  font-family: var(--mono);
  font-size: 0.85rem;
}
.readouts > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 1rem;
}
.readouts > div + div { border-top: 1.5px solid var(--anodized-rule); }
.readouts dt { color: var(--anodized-dim); }
.readouts dd { margin: 0; color: var(--anodized-ink); font-weight: 500; }
.readouts dd.ok { color: #7fd6c2; }

.anodized-foot {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--anodized-dim);
  max-width: 52ch;
}

/* ---------- compare table -------------------------------------------------- */

.matrix-scroll { overflow-x: auto; }

.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}
.matrix caption {
  caption-side: bottom;
  text-align: left;
  padding-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--faint);
}
.matrix th, .matrix td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 1.25rem 0.85rem 0;
  border-top: 1.5px solid var(--rule);
  min-width: 11rem;
}
.matrix thead th {
  border-top: 0;
  font-size: 0.85rem;
  font-weight: 620;
  color: var(--faint);
  padding-top: 0;
}
.matrix tbody th { font-weight: 660; white-space: nowrap; }
.matrix td:last-child { color: var(--dim); }
.matrix tbody tr:first-child th,
.matrix tbody tr:first-child td { border-top: 2px solid var(--rule-strong); }

/* ---------- install ways --------------------------------------------------- */

.ways { border-top: 2px solid var(--rule-strong); }

.way {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 1rem clamp(1.5rem, 4vw, 3.5rem);
  padding: 1.9rem 0;
  border-bottom: 1.5px solid var(--rule);
}

.way h3 { margin-bottom: 0.3rem; }
.way-blurb { color: var(--dim); margin-bottom: 1.1rem; max-width: 56ch; }

.command {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  background: var(--anodized);
  color: var(--anodized-ink);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

.copy-act[data-state="done"] {
  background: var(--cool);
  border-color: var(--cool);
  color: #fff;
}
.copy-act[data-state="failed"] { border-color: var(--heat); color: var(--heat-text); }

/* ---------- FAQ ------------------------------------------------------------ */

.qa { max-width: 54rem; }

.qa-item { border-top: 1.5px solid var(--rule); }
.qa-item:last-child { border-bottom: 1.5px solid var(--rule); }

.qa-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.05rem 0.25rem;
  font-size: 1.12rem;
  font-weight: 640;
}
.qa-item summary::-webkit-details-marker { display: none; }
.qa-item summary:hover { color: var(--heat-text); }

.qa-mark {
  flex: none;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--heat-text);
  transition: rotate 240ms ease;
}
.qa-item[open] .qa-mark { rotate: 45deg; }

.qa-item p {
  padding: 0 0.25rem 1.25rem;
  color: var(--dim);
  max-width: 60ch;
}

/* smooth open where the platform supports it */
@media (prefers-reduced-motion: no-preference) {
  .qa-item::details-content {
    opacity: 0;
    block-size: 0;
    overflow-y: clip;
    transition: content-visibility 300ms allow-discrete,
                opacity 300ms ease, block-size 300ms ease;
  }
  .qa-item[open]::details-content {
    opacity: 1;
    block-size: auto;
    block-size: calc-size(auto, size);
  }
}

/* ---------- coda ------------------------------------------------------------ */

.coda { padding: clamp(4rem, 10vh, 7rem) 0; text-align: left; }
.coda h2 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); max-width: 18em; }
.coda .action-row { margin-top: 1.75rem; }

/* ---------- footer ----------------------------------------------------------- */

.basefoot {
  border-top: 2px solid var(--rule-strong);
  padding: 1.75rem 0 2.25rem;
}

.basefoot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.basefoot-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 660;
}
.basefoot-brand img { width: 21px; height: 21px; }

.basefoot-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.basefoot-nav a { color: var(--dim); text-decoration: none; font-size: 0.92rem; }
.basefoot-nav a:hover { color: var(--heat-text); }

.basefoot-legal {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--faint);
}
.basefoot-legal a { color: inherit; }

/* ---------- interior pages (Mac App Store, 404) ------------------------------ */

.page-lede { padding: clamp(3rem, 7vh, 5rem) 0 clamp(2rem, 4vh, 3rem); }
.page-lede h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); max-width: 20em; }
.page-lede .lede-sub { max-width: var(--measure); }

.meta-line {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--faint);
}

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
}

.tally {
  border: 2px solid var(--rule-strong);
  background: var(--plate);
  padding: 1.4rem 1.5rem 1.5rem;
}
.tally.is-out { background: none; border-color: var(--rule); }
.tally h3 { margin-bottom: 0.75rem; }
.tally ul { margin: 0; padding: 0; list-style: none; }
.tally li {
  padding: 0.45rem 0 0.45rem 1.2rem;
  position: relative;
  color: var(--dim);
}
.tally li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95em;
  width: 0.5em;
  height: 2px;
  background: var(--cool);
}
.tally.is-out li::before { background: var(--heat); }

.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 clamp(1.75rem, 4vw, 3.5rem);
}
.trio > article { border-top: 2px solid var(--rule-strong); padding-top: 1rem; }
.trio h3 { font-size: 1.1rem; }
.trio p { color: var(--dim); font-size: 0.97rem; }

.lost { padding: clamp(4rem, 14vh, 9rem) 0; }
.lost h1 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(4rem, 14vw, 9rem);
  letter-spacing: 0.02em;
  margin-bottom: 0.2em;
}
.lost .flatline { max-width: 30rem; margin-bottom: 1.5rem; }
.lost .flatline polyline { fill: none; stroke: var(--heat); stroke-width: 2.5; }
.lost p { color: var(--dim); }

/* ---------- responsive -------------------------------------------------------- */

@media (max-width: 960px) {
  .hero-grid, .cooling-grid, .reel-grid, .anodized-grid { grid-template-columns: 1fr; }
  .way { grid-template-columns: 1fr; padding: 1.5rem 0; }
  .trio { grid-template-columns: 1fr; }
  .trio > article { padding-bottom: 0.75rem; }
}

@media (max-width: 760px) {
  .site-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bench);
    border-bottom: 2px solid var(--rule-strong);
    padding: 0.5rem 1.375rem 1rem;
  }
  .site-menu.is-open { display: flex; }
  .site-menu a { padding: 0.65rem 0; border-bottom: 1.5px solid var(--rule); }
  .menu-btn { display: block; }
  .topbar .act { display: none; }

  .log, .duo { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .act, .qa-mark { transition: none; }
}

/* ---------- dark chassis -------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bench: #16191c;
    --plate: #1e2226;
    --plate-deep: #0e1113;
    --ink: #e7eaec;
    --dim: #a2abb3;
    --faint: #79838c;

    --rule: #343b41;
    --rule-strong: #e7eaec;

    --heat-text: #ff7a4d;
    --heat-hot: #e85a28;
    --heat-wash: rgba(255, 122, 77, 0.08);

    --cool-text: #5fbcc9;
    --cool-wash: rgba(95, 188, 201, 0.08);

    --anodized: #0b0e10;
    --anodized-plate: #15191c;
    --anodized-rule: #2c3338;

    color-scheme: dark;
  }

  .skiplink { background: var(--plate); color: var(--ink); }
  ::selection { background: var(--heat); color: #fff; }
}
