/* ===================================================================
   OUKID — Design System
   Fonts self-hosted in /fonts. Tokens per PLAN.md §2.
   =================================================================== */

/* --- Fonts --- */
@font-face {
  font-family: 'Switzer';
  src: url('/fonts/switzer-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Switzer';
  src: url('/fonts/switzer-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/fonts/generalsans-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/fonts/generalsans-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/fonts/generalsans-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrainsmono-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrainsmono-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrainsmono-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --- */
:root {
  --ink: #1B1D16;
  --olive: #606C38;
  --olive-deep: #454E29;
  --sand: #EDEDED;
  --paper: #FCFCFA;
  --line: #D8DBC9;

  --font-display: 'Switzer', 'General Sans', system-ui, sans-serif;
  --font-body: 'General Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.5rem;
  --space-7: 5.5rem;
  --space-8: 8rem;

  --container: 1180px;
  --radius: 3px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --corner-size: 18px;
  --corner-size-active: 12px;
  --corner-thickness: 2px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, picture, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

h1 { font-size: clamp(2.1rem, 5.4vw + 0.5rem, 4.25rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw + 0.5rem, 2.6rem); }
h3 { font-size: clamp(1.15rem, 1.2vw + 0.7rem, 1.4rem); }

p { max-width: 60ch; }
p.lede { font-size: clamp(1.05rem, 0.4vw + 1rem, 1.25rem); color: var(--ink); opacity: 0.85; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
}

::selection { background: var(--olive); color: var(--sand); }

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

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

/* --- Mono / technical utility text --- */
.mono {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--olive-deep);
}
.eyebrow::before,
.eyebrow::after {
  content: '';
  width: 8px;
  height: 8px;
  flex: none;
}
.eyebrow::before { border-left: 2px solid var(--olive); border-bottom: 2px solid var(--olive); }
.eyebrow::after { border-right: 2px solid var(--olive); border-top: 2px solid var(--olive); }

/* --- Dimension-line divider ---
   Section breaks styled as a drawing's dimension line. Label carries real
   content (section name / short descriptor), never used purely as decoration. */
.dim-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-block: var(--space-6);
  color: var(--olive-deep);
}
.dim-divider__line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}
.dim-divider__label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* --- Registration-mark frame ---
   CSS-only corner brackets, no extra markup. Used on cards/photos only. */
.frame {
  position: relative;
}
.frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-repeat: no-repeat;
  background-image:
    linear-gradient(var(--olive), var(--olive)), linear-gradient(var(--olive), var(--olive)),
    linear-gradient(var(--olive), var(--olive)), linear-gradient(var(--olive), var(--olive)),
    linear-gradient(var(--olive), var(--olive)), linear-gradient(var(--olive), var(--olive)),
    linear-gradient(var(--olive), var(--olive)), linear-gradient(var(--olive), var(--olive));
  background-size:
    var(--corner-size) var(--corner-thickness), var(--corner-thickness) var(--corner-size),
    var(--corner-size) var(--corner-thickness), var(--corner-thickness) var(--corner-size),
    var(--corner-size) var(--corner-thickness), var(--corner-thickness) var(--corner-size),
    var(--corner-size) var(--corner-thickness), var(--corner-thickness) var(--corner-size);
  background-position:
    top left, top left,
    top right, top right,
    bottom left, bottom left,
    bottom right, bottom right;
  transition: background-size 0.25s var(--ease);
}
.frame:hover::before,
.frame:focus-within::before {
  --corner-size: var(--corner-size-active);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.9em 1.6em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 44px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--olive);
  color: var(--sand);
}
.btn--primary:hover { background: var(--olive-deep); }

.btn--ghost {
  padding-inline: 0.2em;
  min-height: auto;
  color: var(--olive-deep);
  position: relative;
}
.btn--ghost .btn__underline {
  position: relative;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--olive), var(--olive));
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: left bottom;
  transition: background-size 0.3s var(--ease);
}
.btn--ghost:hover .btn__underline,
.btn--ghost:focus-visible .btn__underline { background-size: 100% 1.5px; }
.btn--ghost svg { width: 1em; height: 1em; transition: transform 0.2s var(--ease); }
.btn--ghost:hover svg { transform: translateX(3px); }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: 76px;
  transition: height 0.25s var(--ease);
}
.site-header.is-compact .container { height: 58px; }

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.brand img { height: 34px; width: 34px; transition: height 0.25s var(--ease), width 0.25s var(--ease); }
.site-header.is-compact .brand img { height: 26px; width: 26px; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav {
  position: fixed;
  inset: 0;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: 96px var(--space-4) var(--space-5);
  gap: var(--space-4);
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
  z-index: 1;
}
.site-nav.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.site-nav__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.site-nav__links a {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}
.site-nav__links a[aria-current="page"] { color: var(--olive); }

.header-actions { position: relative; z-index: 2; display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.header-actions .btn--primary { padding: 0.7em 1.2em; font-size: 0.85rem; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav {
    position: static;
    inset: auto;
    flex-direction: row;
    align-items: center;
    padding: 0;
    background: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    gap: var(--space-6);
  }
  .site-nav__links { flex-direction: row; gap: var(--space-5); }
  .site-nav__links a { font-size: 0.95rem; font-weight: 500; font-family: var(--font-body); }
  .header-actions .btn--primary { padding: 0.9em 1.6em; font-size: 0.95rem; }
}

/* --- Sections & layout --- */
.section { padding-block: var(--space-7); }
.section--tight { padding-block: var(--space-6); }
.section--olive { background: var(--olive); color: var(--sand); }
.section--olive h2, .section--olive h1 { color: var(--sand); }
.section--olive .eyebrow { color: var(--sand); opacity: 0.85; }
.section--olive .eyebrow::before { border-color: var(--sand); }
.section--olive .eyebrow::after { border-color: var(--sand); }
.section--olive .spec { border-color: rgba(237, 237, 237, 0.3); }
.section--olive .spec__row { border-bottom-color: rgba(237, 237, 237, 0.3); }
.section--olive .spec dt { color: var(--sand); opacity: 0.75; }
.section--olive .spec dd { color: var(--sand); }
.section--olive .btn--ghost { color: var(--sand); }
.section--olive .btn--ghost .btn__underline { background-image: linear-gradient(var(--sand), var(--sand)); }
.section--sand { background: var(--sand); }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 720px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  align-items: center;
}
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1.05fr 0.95fr; gap: var(--space-6); }
}

/* --- Cards --- */
.card {
  padding: var(--space-4);
  background: var(--paper);
  border: 1px solid var(--line);
}
.card h3 { margin-bottom: var(--space-2); }
.card p { margin: 0; opacity: 0.85; font-size: 0.95rem; }

/* --- Hero --- */
.hero {
  padding-block: var(--space-6) var(--space-7);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; margin-top: var(--space-4); }
.hero__eyebrow { margin-bottom: var(--space-3); }
.hero h1 { margin-bottom: var(--space-3); }
.hero .lede { margin-bottom: var(--space-4); }

.assembly-wrap {
  background: var(--sand);
  padding: var(--space-4);
}

/* Assembly Sequence — parts start exploded and settle to their assembled
   position when JS adds .is-settled. As with .reveal, the exploded start
   state only applies once `.js` confirms the script is running — without
   it, the space simply renders fitted-out and correct. */
.assembly .part { transform-box: fill-box; transform-origin: center; }

.js .assembly .part { transition: transform 1.15s var(--ease); }
.js .assembly.is-settled .part { transform: translate(0, 0) rotate(0deg) !important; }

.js .assembly .part--shelf { transform: translate(-90px, -50px) rotate(-14deg); }
.js .assembly .part--table { transform: translate(-70px, 110px) rotate(-18deg); }
.js .assembly .part--rack { transform: translate(60px, -100px) rotate(15deg); }
.js .assembly .part--light { transform: translate(12px, -95px) rotate(6deg); }
.js .assembly .part--counter { transform: translate(95px, 80px) rotate(20deg); }

.js .assembly .callout {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.js .assembly.is-settled .callout { opacity: 1; transition-delay: 0.95s; }

@media (prefers-reduced-motion: reduce) {
  .js .assembly .part { transform: translate(0, 0) rotate(0deg) !important; transition: none !important; }
  .js .assembly .callout { opacity: 1 !important; transition: none !important; }
}

/* --- Process (How We Work) ---
   The one legitimate numbered list on the site: a real ordered process. */
.process {
  counter-reset: step;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 720px) {
  .process { grid-template-columns: repeat(4, 1fr); }
}
.process__step { counter-increment: step; }
.process__step::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--olive);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}
.process__step h3 { margin-bottom: var(--space-1); }
.process__step p { opacity: 0.85; font-size: 0.95rem; margin: 0; }

/* --- Spec block --- */
.spec {
  border: 1px solid var(--line);
  padding: var(--space-4);
}
.spec dl { display: grid; gap: var(--space-2); }
.spec .spec__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  padding-block: var(--space-1);
  border-bottom: 1px solid var(--line);
}
.spec .spec__row:last-child { border-bottom: none; }
.spec dt { text-transform: uppercase; color: var(--olive-deep); }
.spec dd { margin: 0; text-transform: uppercase; }

/* --- Photo placeholder (until real photography is supplied) --- */
.ph-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  background: var(--sand);
  border: 1px dashed var(--line);
  color: var(--olive-deep);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--space-3);
}

/* --- Gallery --- */
.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery__item {
  aspect-ratio: 4 / 5;
  background: var(--sand);
  overflow: hidden;
  position: relative;
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; }

/* --- Shop grid --- */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 640px) { .shop-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }

.product-card { background: var(--paper); }
.product-card__media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--sand);
}
.product-card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.product-card:hover .product-card__media img { transform: scale(1.03); }
.product-card__body { padding: var(--space-3) var(--space-1) var(--space-2); }
.product-card__title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin-bottom: 0.25em; }
.product-card__link { display: inline-block; margin-top: var(--space-2); font-size: 0.85rem; text-decoration: underline; text-underline-offset: 3px; }

/* --- Forms --- */
.form { display: grid; gap: var(--space-4); max-width: 640px; }
.field { display: grid; gap: 0.5em; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--olive-deep);
}
.field input,
.field select,
.field textarea {
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0.7em 0.1em;
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--ink);
  transition: border-color 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 8em; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--olive);
  outline: none;
}
.field-row { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }

.form-note { font-size: 0.85rem; opacity: 0.75; }
.form-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.form-status[data-state="success"] { color: var(--olive); }
.form-status[data-state="error"] { color: #8a3324; }

/* --- Contact details --- */
.details-list { display: grid; gap: var(--space-3); }
.details-list dt { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--olive-deep); }
.details-list dd { margin: 0; font-size: 1.05rem; }

/* --- CTA band --- */
.cta-band { text-align: left; }
.cta-band .cluster { margin-top: var(--space-4); }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-5);
}
.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (min-width: 720px) {
  .site-footer .container { flex-direction: row; justify-content: space-between; align-items: center; }
}
.site-footer__links { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.site-footer__links a { font-size: 0.9rem; opacity: 0.8; }
.site-footer small { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; opacity: 0.6; }

/* --- Scroll reveal ---
   Hidden-until-scrolled only applies once `.js` confirms the script that
   drives it is actually running (set synchronously in <head>). Without
   that class — JS blocked, failed, or disabled — content is visible by
   default, so a script failure can never leave sections permanently blank. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}
