/*
  ZAHNPUTZHOBEL — DESIGN SYSTEM
  Single source of truth for all visual design constraints.

  Structure:
    1. Font faces (self-hosted, see assets/fonts/)
    2. Design tokens (custom properties on :root)
    3. Reset & base element styles
    4. Typography
    5. Layout primitives
    6. Components
    7. Utilities
    8. Media & accessibility

  Namespace: every class is prefixed `zh-` to stay collision-free when
  dropped into any page. Do not fork this file — every page that needs
  a new pattern should extend the tokens/components here instead of
  redefining color, type or spacing locally.
*/

/* ============================================================
   1. FONT FACES
   Self-hosted, no external requests. One family for everything:
   Pontano Sans, a variable font (300–700) set at its light 300
   weight for both headlines and body. SIL OFL 1.1 — see
   assets/fonts/.
   ============================================================ */

@font-face {
  font-family: "Pontano Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/pontano-sans-variable.woff2") format("woff2");
}

/* ============================================================
   2. DESIGN TOKENS
   ============================================================ */

:root {
  /* ---- Color — patina: dark verdigris ground, mist text, brass
     accent. The whole palette, nothing else. ---- */
  --zh-patina-950: #1f3333; /* page ground */
  --zh-patina-900: #284040; /* section surface, one step up */
  --zh-patina-800: #31494a; /* elevated surface / hover */
  --zh-patina-700: #3d5757; /* borders on dark, stronger */

  --zh-mist-300: #93aba6; /* muted secondary text */
  --zh-mist-200: #c3d3cf; /* lines, icon strokes, labels */
  --zh-mist-100: #eff5f3; /* bright headline color */

  --zh-brass-600: #c29a6d; /* accent, pressed */
  --zh-brass-500: #d9b48a; /* accent */
  --zh-brass-300: #e8cdab; /* accent, hover / light */

  --zh-ink-200: #dce7e3; /* body copy on dark ground */
  --zh-line: rgba(239, 245, 243, 0.14); /* hairline dividers */
  --zh-line-strong: rgba(239, 245, 243, 0.3);

  /* Black — for sections built around the product render. Must equal
     the render's background exactly so frame edges disappear;
     assets/blender/build_scrub_frames.sh prints it. */
  --zh-black: #020203;
  --zh-black-heading: #f2f2f3;
  --zh-black-ink: #c9cbce;
  --zh-black-muted: #8a8d92;

  --zh-focus: var(--zh-brass-300);

  /* ---- Type families ---- */
  --zh-font-display: "Pontano Sans", "Helvetica Neue", Arial, sans-serif;
  --zh-font-body: "Pontano Sans", "Helvetica Neue", Arial, sans-serif;

  /* ---- Weights — light throughout; heavier only for UI controls ---- */
  --zh-weight: 300;
  --zh-weight-ui: 500;

  /* ---- Type scale ---- */
  --zh-text-xs: 0.8125rem; /* 13px — fine print */
  --zh-text-sm: 0.9375rem; /* 15px — captions, nav */
  --zh-text-base: 1.125rem; /* 18px — body copy (light weight needs the size) */
  --zh-text-lg: 1.375rem; /* 22px — lede paragraph */
  --zh-text-xl: 1.625rem; /* 26px — sub-heading */
  --zh-text-2xl: clamp(2rem, 1.5rem + 2vw, 3.25rem); /* section headline */
  --zh-text-3xl: clamp(2.75rem, 1.6rem + 5vw, 6rem); /* hero display */

  --zh-leading-tight: 1.04;
  --zh-leading-snug: 1.3;
  --zh-leading-body: 1.65;

  --zh-tracking-tight: -0.02em;
  --zh-tracking-wide: 0.04em;

  /* ---- Spacing scale (rem) ---- */
  --zh-space-1: 0.25rem;
  --zh-space-2: 0.5rem;
  --zh-space-3: 0.75rem;
  --zh-space-4: 1rem;
  --zh-space-5: 1.5rem;
  --zh-space-6: 2rem;
  --zh-space-7: 3rem;
  --zh-space-8: 4.5rem;
  --zh-space-9: 6.5rem;
  --zh-space-10: 9rem;

  /* ---- Layout ---- */
  --zh-container-width: 72rem; /* 1152px */
  --zh-gutter: clamp(1.25rem, 4vw + 0.25rem, 3rem);

  /* ---- Shape — machined edges, not soft UI chrome ---- */
  --zh-chamfer-sm: 2px;
  --zh-chamfer-md: 3px;

  /* ---- Motion ---- */
  --zh-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --zh-duration-fast: 150ms;
  --zh-duration-slow: 900ms;
}

/* ============================================================
   3. RESET & BASE
   ============================================================ */

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

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

body {
  margin: 0;
  background: var(--zh-patina-950);
  color: var(--zh-ink-200);
  font-family: var(--zh-font-body);
  font-size: var(--zh-text-base);
  line-height: var(--zh-leading-body);
  font-weight: var(--zh-weight);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ============================================================
   4. TYPOGRAPHY
   ============================================================ */

.zh-display {
  font-family: var(--zh-font-display);
  font-weight: var(--zh-weight);
  font-size: var(--zh-text-3xl);
  line-height: var(--zh-leading-tight);
  letter-spacing: var(--zh-tracking-tight);
  color: var(--zh-mist-100);
}

.zh-h2 {
  font-family: var(--zh-font-display);
  font-weight: var(--zh-weight);
  font-size: var(--zh-text-2xl);
  line-height: var(--zh-leading-tight);
  letter-spacing: var(--zh-tracking-tight);
  color: var(--zh-mist-100);
}

.zh-h3 {
  font-family: var(--zh-font-body);
  font-weight: var(--zh-weight);
  font-size: var(--zh-text-xl);
  line-height: var(--zh-leading-snug);
  color: var(--zh-mist-100);
}

.zh-lede {
  font-size: var(--zh-text-lg);
  line-height: var(--zh-leading-snug);
  color: var(--zh-ink-200);
  max-width: 38ch;
}

.zh-body {
  font-size: var(--zh-text-base);
  max-width: 62ch;
  color: var(--zh-ink-200);
}

.zh-caption {
  font-size: var(--zh-text-sm);
  color: var(--zh-mist-300);
  max-width: 52ch;
}

.zh-mono {
  font-variant-numeric: tabular-nums;
}

.zh-label {
  font-size: var(--zh-text-xs);
  color: var(--zh-mist-300);
  letter-spacing: var(--zh-tracking-wide);
}

/* ============================================================
   5. LAYOUT PRIMITIVES
   ============================================================ */

.zh-container {
  width: 100%;
  max-width: var(--zh-container-width);
  margin-inline: auto;
  padding-inline: var(--zh-gutter);
}

.zh-section {
  padding-block: var(--zh-space-9);
  border-top: 1px solid var(--zh-line);
}

.zh-section--tight {
  padding-block: var(--zh-space-7);
}

.zh-section--surface {
  background: var(--zh-patina-900);
}

.zh-stack > * + * {
  margin-top: var(--gap, var(--zh-space-5));
}

.zh-grid-two {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--zh-space-8);
  align-items: center;
}

@media (min-width: 56rem) {
  .zh-grid-two {
    grid-template-columns: 1fr 1fr;
    gap: var(--zh-space-9);
  }
  .zh-grid-two--wide-start {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.zh-divider {
  border: 0;
  border-top: 1px solid var(--zh-line);
  margin: 0;
}

/* ============================================================
   6. COMPONENTS
   ============================================================ */

/* -- Header ------------------------------------------------- */

.zh-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--zh-space-3) var(--zh-space-6);
  padding-block: var(--zh-space-5);
}

.zh-wordmark {
  font-family: var(--zh-font-display);
  font-weight: 400;
  font-size: var(--zh-text-lg);
  letter-spacing: var(--zh-tracking-tight);
  color: var(--zh-mist-100);
  text-decoration: none;
  display: inline-block;
}

.zh-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zh-space-2) var(--zh-space-5);
}

.zh-nav a {
  font-size: var(--zh-text-sm);
  color: var(--zh-mist-300);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--zh-duration-fast) var(--zh-ease),
    border-color var(--zh-duration-fast) var(--zh-ease);
}

.zh-nav a:hover {
  color: var(--zh-mist-100);
  border-color: var(--zh-line-strong);
}

/* -- Buttons -------------------------------------------------- */

.zh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6ch;
  font-family: var(--zh-font-body);
  font-weight: var(--zh-weight-ui);
  font-size: var(--zh-text-sm);
  padding: 0.85em 1.4em;
  border-radius: var(--zh-chamfer-sm);
  border: 1px solid transparent;
  text-decoration: none;
  transition: background var(--zh-duration-fast) var(--zh-ease),
    border-color var(--zh-duration-fast) var(--zh-ease),
    color var(--zh-duration-fast) var(--zh-ease);
}

.zh-btn--primary {
  background: var(--zh-brass-500);
  color: var(--zh-patina-950);
}

.zh-btn--primary:hover {
  background: var(--zh-brass-300);
}

.zh-btn--ghost {
  background: transparent;
  border-color: var(--zh-line-strong);
  color: var(--zh-mist-100);
}

.zh-btn--ghost:hover {
  border-color: var(--zh-mist-200);
  background: var(--zh-patina-800);
}

/* -- Form fields ------------------------------------------------
   Single-line inputs sit flush with a .zh-btn in a .zh-field-row:
   same height, same chamfer, hairline edge like the image frames. */

.zh-input {
  font: inherit;
  font-size: var(--zh-text-base);
  color: var(--zh-mist-100);
  background: var(--zh-patina-950);
  border: 1px solid var(--zh-line-strong);
  border-radius: var(--zh-chamfer-sm);
  padding: 0.7em 0.9em;
  min-width: 0;
  transition: border-color var(--zh-duration-fast) var(--zh-ease);
}

.zh-input::placeholder {
  color: var(--zh-mist-300);
}

.zh-input:hover,
.zh-input:focus {
  border-color: var(--zh-mist-200);
}

.zh-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zh-space-3);
}

.zh-field-row .zh-input {
  flex: 1 1 16rem;
}

.zh-field-row .zh-btn {
  flex: 0 0 auto;
  justify-content: center;
}

.zh-btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* -- Panels / surfaces ----------------------------------------- */

.zh-panel {
  border: 1px solid var(--zh-line);
  border-radius: var(--zh-chamfer-md);
  padding: var(--zh-space-6);
  background: var(--zh-patina-900);
}

/* -- Spec table -------------------------------------------------
   Used for genuine tabular measurement data (dimensions, mass,
   material). Tabular figures keep the numbers aligned. */

.zh-spec-table {
  width: 100%;
}

.zh-spec-table tr {
  border-top: 1px solid var(--zh-line);
}

.zh-spec-table tr:first-child {
  border-top: 0;
}

.zh-spec-table th,
.zh-spec-table td {
  text-align: left;
  padding-block: var(--zh-space-3);
  font-weight: var(--zh-weight);
  vertical-align: baseline;
}

.zh-spec-table th {
  color: var(--zh-mist-300);
  font-size: var(--zh-text-sm);
  font-weight: var(--zh-weight);
  width: 40%;
}

.zh-spec-table td {
  font-family: var(--zh-font-body);
  font-variant-numeric: tabular-nums;
  font-size: var(--zh-text-base);
  color: var(--zh-mist-100);
  text-align: right;
}

@media (min-width: 30rem) {
  .zh-spec-table td {
    text-align: left;
  }
}

/* -- Image frame --------------------------------------------------
   A consistent treatment for product photography: flat, no shadow,
   a single hairline edge — like a plate in a parts catalog. */

.zh-frame {
  border: 1px solid var(--zh-line);
  border-radius: var(--zh-chamfer-md);
  overflow: hidden;
  background: var(--zh-patina-900);
}

.zh-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -- Technical silhouette overlay -------------------------------- */

.zh-silhouette {
  fill: none;
  stroke: var(--zh-mist-200);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zh-silhouette--draw {
  stroke-dasharray: var(--zh-path-length, 1200);
  stroke-dashoffset: var(--zh-path-length, 1200);
  animation: zh-draw var(--zh-duration-slow) var(--zh-ease) 400ms forwards;
}

@keyframes zh-draw {
  to {
    stroke-dashoffset: 0;
  }
}

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

.zh-footer {
  padding-block: var(--zh-space-7);
  border-top: 1px solid var(--zh-line);
}

.zh-footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--zh-space-6);
  justify-content: space-between;
  align-items: flex-start;
}

/* -- Hero with technical drawing --------------------------------
   The opening section: headline top right, the CAD drawing across
   the content width, lede and actions bottom left. The drawing is
   inline SVG (put in place by assets/drawings/import_drawing.py) so
   its lines take the theme's colour. Side and top view stack on the
   left, the isometric view sits on the right; on narrow screens the
   isometric view comes first. Lines stay a hairline at any size. */

.zh-hero {
  padding-block: var(--zh-space-6) var(--zh-space-9);
}

.zh-hero-stage {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
}

.zh-hero-stage > .zh-display {
  justify-self: end;
  text-align: right;
  max-width: 9.5em;
  font-size: clamp(2.75rem, 1rem + 4.5vw, 5.5rem);
}

.zh-hero-text {
  justify-self: start;
  max-width: 32rem;
}

.zh-drawing {
  margin: 0;
  color: var(--zh-mist-100);
  display: grid;
  gap: var(--zh-space-6);
  align-items: center;
}

.zh-drawing-ortho {
  display: grid;
  gap: var(--zh-space-5);
}

.zh-drawing-iso {
  order: -1;
}

.zh-drawing svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.zh-drawing :is(path, line, circle, ellipse, polyline) {
  vector-effect: non-scaling-stroke;
}

.zh-drawing .visible {
  stroke-width: 0.8px;
}

.zh-drawing .hidden {
  stroke-width: 0.6px;
  stroke-dasharray: 4 3;
  opacity: 0.45;
}

@media (max-width: 40rem) {
  .zh-drawing .hidden {
    display: none;
  }
}

@media (min-width: 52rem) {
  .zh-drawing {
    grid-template-columns: 3fr 2fr;
    gap: clamp(2rem, 5vw, 4.5rem);
  }
  .zh-drawing-iso {
    order: 0;
  }
}

/* -- Scroll-scrubbed render ---------------------------------------
   A black section built around the product render. The frame
   column is sticky for the whole section while the copy column
   scrolls past it, one step per screen; scroll progress picks the
   frame (scrub.js). On narrow screens the frames fill the viewport
   behind and the copy scrolls over them, anchored low so it doesn't
   cover the handle. --zh-black must equal the render's background. */

.zh-scrub {
  background: var(--zh-black);
  color: var(--zh-black-ink);
}

.zh-scrub + .zh-section {
  border-top: 0;
}

.zh-scrub-grid {
  display: grid;
}

.zh-scrub-media,
.zh-scrub-copy {
  grid-area: 1 / 1;
}

.zh-scrub-media {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  align-self: start;
}

.zh-scrub-media canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.zh-scrub-copy {
  position: relative;
  z-index: 1;
}

.zh-scrub-step {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: var(--zh-space-6);
}

.zh-scrub-step > div {
  background: color-mix(in srgb, var(--zh-black) 78%, transparent);
  padding: var(--zh-space-5);
  margin-inline: calc(-1 * var(--zh-space-5));
}

.zh-scrub .zh-h2 {
  color: var(--zh-black-heading);
}

.zh-scrub .zh-body {
  color: var(--zh-black-ink);
}

.zh-scrub .zh-caption {
  color: var(--zh-black-muted);
}

@media (min-width: 52rem) {
  .zh-scrub-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: var(--zh-space-8);
  }
  .zh-scrub-copy {
    grid-area: 1 / 2;
  }
  .zh-scrub-step {
    justify-content: center;
    padding-bottom: 0;
  }
  .zh-scrub-step > div {
    background: none;
    padding: 0;
    margin: 0;
    max-width: 28rem;
  }
}

/* ============================================================
   7. UTILITIES
   ============================================================ */

.zh-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.zh-accent {
  color: var(--zh-brass-500);
}

.zh-muted {
  color: var(--zh-mist-300);
}

/* ============================================================
   8. ACCESSIBILITY & MEDIA
   ============================================================ */

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .zh-silhouette--draw {
    stroke-dashoffset: 0;
  }
}

@media (max-width: 30rem) {
  :root {
    --zh-space-9: 4rem;
    --zh-space-8: 3rem;
  }
}
