/* ============================================================
   Apex Plumbing & Heating — "工具" (tools)
   Industrial, utilitarian, high contrast. The other demos are
   hospitality: warm ground, serif display, pill buttons, soft
   cards. This one is equipment — cold steel ground, one heavy
   condensed grotesk set in caps, square corners, 2px rules, and
   a service list that reads like a rate card rather than a menu.
   Loaded after tokens.css, base.css and demo.css.
   ============================================================ */

:root {
  /* --- Type: one family, worked hard -------------------------
     Archivo carries a real wdth axis, so headings can be genuinely
     condensed rather than transform-squashed, and a single family
     covers display and body without the page reading as unstyled. */
  --font-display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;

  /* Caps need looser tracking than the shared lowercase serif did. */
  --tr-tight: -0.012em;
  --tr-snug: -0.005em;
  --tr-normal: 0em;
  --tr-wide: 0.17em;

  --lh-tight: 0.95;
  --lh-snug: 1.06;
  --lh-normal: 1.45;
  --lh-loose: 1.6;

  /* Smaller headline scale. Caps at 8rem is a poster; this page is
     a document someone reads with a bucket under the sink. */
  --t-h1: clamp(2.125rem, 1.35rem + 3.85vw, 4.75rem);
  --t-h2: clamp(1.75rem, 1.28rem + 2.35vw, 3.25rem);
  --t-h3: clamp(1.125rem, 0.98rem + 0.72vw, 1.5rem);

  /* Denser vertical rhythm than the hospitality demos. */
  --section-y: clamp(3.5rem, 2.4rem + 5.5vw, 7rem);

  /* --- Ground: cool rolled steel ------------------------------
     The shared neutrals are warm-shifted so gold sits inside them.
     These are pushed the other way — blue-grey, so the page reads
     cold and technical next to the restaurant and the coffee shop. */
  --ink-000: #0b0f14;
  --ink-050: #111721;
  --ink-100: #161d28;
  --ink-200: #1c2530;
  --ink-300: #28323f;
  --ink-400: #3b4756;
  --ink-500: #55636f;

  /* Off-white with the warmth taken out, not added. */
  --paper-000: #eef1f5;
  --paper-100: #dbe2ea;
  --paper-200: #b4bfcb;
  --paper-300: #9aa7b5;
  --paper-400: #909dab;

  --bg: var(--ink-000);
  --bg-raised: var(--ink-100);
  --bg-inset: var(--ink-050);
  --text: var(--paper-000);
  --text-muted: var(--paper-300);
  --text-dim: var(--paper-400);

  /* Rules are the main structural device here, so they are cooler and
     a shade more present than the shared hairlines. */
  --line: rgb(150 178 208 / 0.16);
  --line-strong: rgb(150 178 208 / 0.34);
  --rule-soft: rgb(150 178 208 / 0.38);
  --tint: rgb(150 178 208 / 0.06);

  --scrim-rgb: 11 15 20;
  --header-veil: rgb(11 15 20 / 0.9);

  /* --- Accent: safety blue, tuned up to clear 4.5:1 -----------
     #3f7fc2 itself only manages 4.30:1 on the card ground and 4.50:1
     over the scroll atmosphere, so it is lifted to the next tint of
     the same hue. Used as a marking colour: stencil labels, prices,
     one rule under the hero. */
  --accent: #5590d0;
  --accent-text: #78afe8;
  --accent-contrast: #05090e;

  /* Hazard amber rather than coral — it has to read as a fault light
     and stay clearly distinct from the blue. */
  --danger: #ffb257;

  /* --- Shape: square. Nothing here is rounded. ---------------- */
  --r-sm: 0px;
  --r-md: 0px;
  --r-lg: 2px;
  --r-full: 0px;

  /* Flat and hard-edged: a thin cast shadow, no soft bloom. */
  --shadow-lift: 0 2px 0 rgb(0 0 0 / 0.5);
  --shadow-deep: 0 4px 0 rgb(0 0 0 / 0.6);
}

/* --- Type ------------------------------------------------------
   Everything structural is set in caps: headings, the brand, item
   names, the email address. Condensed and heavy so long lines still
   fit, and legible from across a room at 7am. */

h1, h2, h3, h4,
.display {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 84%;
  text-transform: uppercase;
  letter-spacing: var(--tr-tight);
  text-wrap: balance;
}

/* Archivo has no true italic on this axis and an oblique would read as
   a mistake on a page about pipework. The accent word is marked in
   colour instead — the same job, done with the hazard colour. */
.display em,
.d-hero__title em,
h2 em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent-text);
}

/* Leads are set tighter than the shared 1.65 — this is instruction copy,
   not an essay, and the looser rhythm belonged to the restaurant. */
.t-lead {
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.42;
  max-width: 56ch;
}

.eyebrow {
  color: var(--text-dim);
  font-weight: 500;
}

.eyebrow::before {
  width: var(--s-5);
  height: 2px;
  background: var(--accent);
}

/* --- Buttons: square, stencilled ------------------------------- */

.btn {
  border-radius: 0;
  border-width: 2px;
  padding: var(--s-4) var(--s-6);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: var(--t-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* No lift on hover — it is a switch, not a card. */
.btn:hover { transform: none; opacity: 1; background: var(--accent-text); }
.btn--ghost { border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--tint); border-color: var(--paper-200); }

/* --- Banner and header ----------------------------------------- */

.d-banner {
  background: var(--ink-100);
  border-bottom: 1px solid var(--line-strong);
  letter-spacing: 0.18em;
}

.d-header.is-stuck { border-bottom: 2px solid var(--accent); }

.d-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 80%;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.d-nav {
  gap: var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
}

/* --- Hero -------------------------------------------------------
   The siblings fade type into a photograph from the bottom. This one
   cuts a hard vertical seam through the frame: a near-solid working
   panel on the left where the words live, the photograph left legible
   on the right. An edge, not a fade.

   `color` is declared, not merely inherited — body sets
   `color: var(--text)`, so re-scoping the token alone would move
   .eyebrow (which declares --text-dim) and leave the headline behind. */

.d-hero {
  min-height: 84svh;
  color: var(--text);
  --text-muted: #b6c2cf;
  --text-dim: #a9b6c4;
  --line-strong: rgb(180 200 220 / 0.45);
}

.d-hero__media img {
  filter: grayscale(0.3) saturate(0.75) contrast(1.18) brightness(0.6);
}

/* Below the seam breakpoint there is no room for a panel and a window
   side by side, so the panel simply becomes the frame. On a phone the
   eyebrow sits 8% down from the top of the hero, so the veil has to stay
   heavy all the way up rather than thinning towards the top as the
   shared scrim does — measured, not assumed. */
.d-hero::after {
  background:
    linear-gradient(to top,
      rgb(var(--scrim-rgb) / 0.96) 0%,
      rgb(var(--scrim-rgb) / 0.9) 55%,
      rgb(var(--scrim-rgb) / 0.88) 100%);
}

/* The panel holds 0.94 alpha across the whole width the type occupies —
   the longest headline line measures 675px against 728px of panel at the
   narrowest width this rule applies. Composited with the vertical layer
   the worst case is ~0.95 over a pure white photo pixel, where every hero
   tone still clears 4.5:1. */
@media (min-width: 78rem) {
  .d-hero::after {
    background:
      linear-gradient(to right,
        rgb(var(--scrim-rgb) / 0.93) 0%,
        rgb(var(--scrim-rgb) / 0.93) 62%,
        rgb(var(--scrim-rgb) / 0.42) 62.5%,
        rgb(var(--scrim-rgb) / 0.3) 100%),
      linear-gradient(to top,
        rgb(var(--scrim-rgb) / 0.3) 0%,
        rgb(var(--scrim-rgb) / 0.1) 55%,
        rgb(var(--scrim-rgb) / 0.4) 100%);
  }
}

.d-hero__inner { padding-block: var(--s-8) var(--s-7); }

.d-hero__title {
  font-size: clamp(1.75rem, 1.05rem + 3.15vw, 3.375rem);
  max-width: 31ch;
  margin-bottom: var(--s-4);
}

.d-hero__lead {
  max-width: 44ch;
  margin-bottom: var(--s-6);
}

/* The facts row becomes a spec strip: ruled cells under one accent bar,
   held inside the panel so it never crosses the seam. */
.d-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 40rem;
  padding-top: 0;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
}

.d-facts div {
  gap: var(--s-1);
  padding-block: var(--s-3);
  border-top: 1px solid var(--line);
}

.d-facts div:first-child { border-top: 0; }
.d-facts dd { font-size: var(--t-small); }

@media (min-width: 45rem) {
  .d-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .d-facts div {
    border-top: 0;
    border-left: 1px solid var(--line-strong);
    padding: var(--s-4) var(--s-5);
  }
  .d-facts div:first-child { border-left: 0; padding-left: 0; }
}

/* --- Section structure ------------------------------------------
   A full-bleed hairline between every section, and a ruled head block
   above each one. The page should read as a set of stacked panels
   rather than as content floating in space. */

.section { border-top: 1px solid var(--line); }

.section__head {
  margin-bottom: var(--s-7);
  padding-top: var(--s-2);
}

.section__head .eyebrow { margin-bottom: var(--s-4); }
.section__title { margin-bottom: var(--s-4); }

/* --- Intro ------------------------------------------------------- */

.d-intro__title { margin-block: var(--s-4) var(--s-5); }

.d-intro__media {
  border-radius: 0;
  border: 2px solid var(--line-strong);
}

.d-intro__media img,
.d-shot img {
  filter: grayscale(0.25) saturate(0.8) contrast(1.15) brightness(0.78);
}

@media (min-width: 62rem) {
  .d-intro__inner { grid-template-columns: 1.05fr 0.95fr; gap: var(--s-8); }
}

/* --- Rate card ---------------------------------------------------
   The shared component is a restaurant menu: name, price, note. Here it
   is re-cut as a parts list — a numbered left rail, a heavy top rule per
   row, names in caps and the price set large and tabular on the right,
   so the figure is the thing you see first. */

.d-list { counter-reset: apex-item; }

.d-item {
  position: relative;
  counter-increment: apex-item;
  grid-template-columns: 1fr auto;
  gap: var(--s-2) var(--s-5);
  padding: var(--s-4) var(--s-4) var(--s-5) var(--s-8);
  border-top: 1px solid var(--line-strong);
  border-left: 2px solid var(--line);
  transition:
    border-left-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.d-list .d-item:last-child { border-bottom: 1px solid var(--line-strong); }

.d-item:hover {
  border-left-color: var(--accent);
  background: var(--tint);
}

/* The index number, stencilled into the rail. */
.d-item::before {
  content: counter(apex-item, decimal-leading-zero);
  position: absolute;
  left: var(--s-3);
  top: calc(var(--s-4) + 0.35em);
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.d-item__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 86%;
  text-transform: uppercase;
  letter-spacing: 0.005em;
  line-height: 1.15;
}

.d-item__price {
  font-family: var(--font-sans);
  font-weight: 800;
  font-stretch: 88%;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.3125rem);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--accent-text);
  text-align: right;
  align-self: center;
}

.d-item__note {
  color: var(--text-muted);
  line-height: var(--lh-loose);
  max-width: 66ch;
}

/* Group headings are stencilled plates, not coloured text. */
.d-group + .d-group { margin-top: var(--s-7); }

.d-group__label {
  display: inline-block;
  margin-bottom: var(--s-3);
  padding: 0.35em 0.85em 0.4em;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  letter-spacing: 0.2em;
}

/* --- Gallery -----------------------------------------------------
   Butted hard against each other on a 3px grid. A contact sheet, not
   a set of rounded cards. */

.d-gallery { gap: 3px; }

.d-shot {
  border-radius: 0;
  border: 0;
  background: var(--ink-200);
}

.d-shot:hover img {
  scale: 1.03;
  filter: grayscale(0) saturate(1) contrast(1.12) brightness(0.9);
}

/* --- Reviews ------------------------------------------------------
   Ruled blocks with the quote set in body type. A serif pull-quote
   would put the hospitality back in. */

.d-review {
  padding: var(--s-5);
  background: var(--ink-050);
  border: 0;
  border-top: 3px solid var(--accent);
  border-radius: 0;
  gap: var(--s-3);
}

.d-review blockquote {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--t-body);
  line-height: 1.45;
  letter-spacing: 0;
}

.d-review__stars {
  color: var(--accent-text);
  letter-spacing: 0.25em;
}

.d-review figcaption {
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* --- Contact ------------------------------------------------------ */

.d-address {
  font-family: var(--font-mono);
  font-size: var(--t-small);
  line-height: var(--lh-loose);
}

.d-hours div {
  border-top: 1px solid var(--line-strong);
  padding-block: var(--s-3);
}

.d-hours div:last-child { border-bottom: 1px solid var(--line-strong); }

.d-hours dt {
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.d-hours dd {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.d-email__addr {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 86%;
  text-transform: uppercase;
  letter-spacing: 0;
}

/* --- Form: a job sheet -------------------------------------------- */

.d-form {
  padding: var(--s-6);
  background: var(--ink-050);
  border: 0;
  border-top: 3px solid var(--accent);
  border-radius: 0;
  gap: var(--s-4);
}

.d-form input,
.d-form textarea,
.d-form select {
  padding: var(--s-3) var(--s-4);
  background: var(--ink-000);
  border: 2px solid var(--line-strong);
  border-radius: 0;
}

.d-form input:focus,
.d-form textarea:focus,
.d-form select:focus {
  border-color: var(--accent);
  background: var(--ink-000);
}

.d-form label { letter-spacing: 0.14em; }

.d-form button[type="submit"] { justify-self: start; }

/* --- Footer ------------------------------------------------------- */

.d-footer { border-top: 2px solid var(--line-strong); }

.d-back {
  font-family: var(--font-mono);
  font-size: var(--t-eyebrow);
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
}

.d-footer__fine { letter-spacing: 0.02em; }
