/* ============================================================
   AB Byg & Montage — Design Tokens
   Import this once at the top of any HTML file:
   <link rel="stylesheet" href="../colors_and_type.css">
   ============================================================ */

/* Manrope — self-hosted variable font (uploaded brand file) */
@font-face {
  font-family: 'Manrope';
  src: url('fonts/Manrope-VariableFont_wght.ttf') format('truetype-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- Color tokens ---------- */
  /* Surfaces / neutrals — cool Nordic stone palette */
  --hvid:        #FFFFFF;
  --kalk:        #ECEDEA;   /* page bg — cool limestone */
  --kalk-2:      #DEE0DC;   /* subtle surface / divider */
  --flint:       #C4C7C2;   /* stronger divider, on-image overlays */
  --stål-2:      #7B8189;   /* tertiary text / metadata — cool slate */
  --stål:        #565C64;   /* secondary text */
  --tømmer:      #1F2937;   /* primary ink (kept) */
  --tømmer-700:  #111827;   /* deepest ink (kept) */
  --shousugi:    #0E0B0A;   /* charred-cedar (Shou Sugi Ban) */
  --shousugi-2:  #1A1411;   /* raised charred surface */

  /* Legacy alias — keep working but point at new palette */
  --beton:       var(--kalk);
  --linned:      var(--kalk-2);
  --linned-2:    var(--flint);

  /* Brand */
  --marine:      #0F2942;   /* primary brand — workwear navy (kept) */
  --marine-700:  #0A1E33;   /* hover/pressed */
  --marine-50:   #E4E8ED;   /* tinted surface (cooler) */

  /* Accent — iron oxide, deeper + drier than safety orange */
  --rust:        #8C3A1F;   /* iron-oxide / oxblood */
  --rust-700:    #6B2C16;
  --rust-50:     #EFE0DA;

  /* Sustainability accent — cool moss / lichen */
  --mos:         #4A6B58;
  --mos-700:     #36503F;
  --mos-50:      #DFE6E0;

  /* Semantic */
  --bg:          var(--kalk);
  --bg-elev:     var(--hvid);
  --fg:          var(--tømmer);
  --fg-2:        var(--stål);
  --fg-3:        var(--stål-2);
  --border:      var(--kalk-2);
  --border-2:    var(--flint);
  --link:        var(--marine);
  --link-hover:  var(--rust);

  --success:     var(--mos);
  --warning:     #B45309;
  --danger:      #B91C1C;

  /* ---------- Type ---------- */
  --font-sans:   'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: var(--font-sans);
  --font-mono:   ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Type scale (rem at 16px base) */
  --fs-xs:    0.75rem;   /* 12 — eyebrow / metadata */
  --fs-sm:    0.875rem;  /* 14 */
  --fs-base:  1rem;      /* 16 */
  --fs-md:    1.125rem;  /* 18 — lead body */
  --fs-lg:    1.375rem;  /* 22 — h4 */
  --fs-xl:    1.75rem;   /* 28 — h3 */
  --fs-2xl:   2.25rem;   /* 36 — h2 */
  --fs-3xl:   3rem;      /* 48 — h1 desktop */
  --fs-4xl:   4.25rem;   /* 68 — display hero */

  /* Line-heights */
  --lh-tight:  1.05;  /* @kind font */
  --lh-snug:   1.2;   /* @kind font */
  --lh-normal: 1.5;   /* @kind font */
  --lh-loose:  1.65;  /* @kind font */

  /* Letter-spacing */
  --tracking-tight:    -0.02em;
  --tracking-normal:    0em;
  --tracking-eyebrow:   0.08em;

  /* Weights */
  --fw-regular: 400;  /* @kind font */
  --fw-medium:  500;  /* @kind font */
  --fw-semi:    600;  /* @kind font */
  --fw-bold:    700;  /* @kind font */
  --fw-black:   800;  /* @kind font */

  /* ---------- Spacing (8pt grid) ---------- */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;
  --space-11: 80px;
  --space-12: 96px;
  --space-13: 128px;

  /* ---------- Radii ---------- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* ---------- Shadows ---------- */
  --shadow-sm: 0 1px 2px rgb(15 41 66 / 0.06), 0 1px 1px rgb(15 41 66 / 0.04);
  --shadow-md: 0 8px 24px -8px rgb(15 41 66 / 0.12);
  --shadow-lg: 0 24px 48px -16px rgb(15 41 66 / 0.18);

  /* ---------- Layout ---------- */
  --container-max: 1240px;
  --gutter:        24px;
  --gutter-lg:     48px;

  /* ---------- Motion ---------- */
  --ease-out:   cubic-bezier(0.2, 0.8, 0.2, 1);  /* @kind other */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);   /* @kind other */
  --dur-fast:   180ms;  /* @kind other */
  --dur-base:   260ms;  /* @kind other */
  --dur-slow:   420ms;  /* @kind other */
}

/* ============================================================
   Base + semantic type rules
   ============================================================ */

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* Headings — display weights for hierarchy */
h1, .h1 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: clamp(2.25rem, 4.5vw, var(--fs-3xl));
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-6);
  color: var(--fg);
  text-wrap: balance;
}

.display, .h0 {
  font-family: var(--font-display);
  font-weight: var(--fw-black);
  font-size: clamp(2.5rem, 5.5vw, var(--fs-4xl));
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-7);
  color: var(--fg);
  text-wrap: balance;
}

h2, .h2 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: clamp(1.75rem, 3vw, var(--fs-2xl));
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-tight);
  margin: 0 0 var(--space-5);
  color: var(--fg);
  text-wrap: balance;
}

h3, .h3 {
  font-family: var(--font-display);
  font-weight: var(--fw-semi);
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-4);
  color: var(--fg);
}

h4, .h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-semi);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  margin: 0 0 var(--space-3);
  color: var(--fg);
}

p, .body {
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--fg);
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

.lead {
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--fg-2);
  font-weight: var(--fw-regular);
  text-wrap: pretty;
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--marine);
  margin: 0 0 var(--space-3);
}
.eyebrow--rust { color: var(--rust); }
.eyebrow--mos  { color: var(--mos); }

.metadata, small {
  font-size: var(--fs-sm);
  color: var(--fg-3);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-out),
              text-decoration-thickness var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

ul, ol { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
li { margin: 0 0 var(--space-2); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--linned);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

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

/* ============================================================
   Reusable component primitives (used by UI kit + previews)
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--gutter-lg); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 14px 22px;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform 120ms var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--marine);
  color: var(--hvid);
}
.btn--primary:hover { background: var(--marine-700); }

.btn--accent {
  background: var(--rust);
  color: var(--hvid);
}
.btn--accent:hover { background: var(--rust-700); }

.btn--secondary {
  background: transparent;
  color: var(--fg);
  border: 1.5px solid var(--tømmer);
}
.btn--secondary:hover {
  background: var(--kalk-2);
  border-color: var(--tømmer);
}

.btn--ghost {
  background: transparent;
  color: var(--fg);
  padding-inline: 8px;
}
.btn--ghost:hover { color: var(--rust); }

.btn--lg { padding: 18px 28px; font-size: var(--fs-md); }
.btn--sm { padding: 10px 16px; font-size: var(--fs-sm); }

/* Card */
.card {
  background: var(--hvid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  transition: box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* Inputs */
.input, .textarea, .select {
  width: 100%;
  padding: 14px 16px;
  background: var(--hvid);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--fg);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus, .textarea:focus, .select:focus {
  outline: 0;
  border-color: var(--marine);
  box-shadow: 0 0 0 3px rgb(15 41 66 / 0.12);
}
.label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--fg);
  margin-bottom: var(--space-2);
}

/* Badges / chips */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: var(--kalk-2);
  color: var(--tømmer);
}
.badge--marine { background: var(--marine-50); color: var(--marine); }
.badge--rust   { background: var(--rust-50);   color: var(--rust); }
.badge--mos    { background: var(--mos-50);    color: var(--mos); }

/* Section */
.section { padding-block: var(--space-12); }
.section--reverse {
  background: var(--marine);
  color: var(--hvid);
}
.section--reverse h1, .section--reverse h2, .section--reverse h3 { color: var(--hvid); }
.section--reverse .lead { color: rgb(255 255 255 / 0.78); }
.section--reverse .eyebrow { color: var(--rust); }

/* Shou Sugi Ban — charred cedar accent surface */
.section--shousugi {
  background-color: var(--shousugi);
  background-image: url('assets/patterns/shousugi-grain.svg');
  background-size: 240px 480px;
  background-repeat: repeat;
  color: var(--hvid);
  position: relative;
}
.section--shousugi::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(14 11 10 / 0) 0%, rgb(14 11 10 / 0.4) 100%);
  pointer-events: none;
}
.section--shousugi > * { position: relative; z-index: 1; }
.section--shousugi h1, .section--shousugi h2, .section--shousugi h3 { color: var(--hvid); }
.section--shousugi .lead { color: rgb(255 255 255 / 0.72); }
.section--shousugi .eyebrow { color: var(--rust); }

/* Hatch pattern overlay (reuse sparingly) */
.hatch {
  background-image: repeating-linear-gradient(
    45deg,
    currentColor 0 1px,
    transparent 1px 5px
  );
  opacity: 0.06;
}
