/* DobbelS – «klassisk verksted».
   Spec: docs/superpowers/specs/2026-11-30-dobbels-nettside-design.md (sections 3 and 4).

   Rule that the tests enforce: an element may only start hidden (opacity 0) under html.motion.
   flag.js sets .motion only when the visitor tolerates motion, and removes it again if main.js
   never reports ready. Without .motion this stylesheet is a complete, static, readable page. */

/* ---------- Fonts (self-hosted, OFL 1.1; see assets/js/vendor/LICENSES.txt) ---------- */
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cormorant Garamond";
  src: url("/assets/fonts/cormorant-garamond-latin-wght-italic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #F4EEE3;
  --paper-deep: #EAE1D1;
  --ink: #1F1A14;
  --walnut: #5B3A24;
  --forest: #2F3B2F;
  --brass: #A8834A;
  --brass-light: #C9A66B;
  --muted: #5E5347;          /* body text on paper: 7.0:1 contrast */
  --hair: rgba(31, 26, 20, 0.16);
  --hair-light: rgba(244, 238, 227, 0.22);

  --display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --text: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --max: 1320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html:not(.lenis) { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.06rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* Paper tooth: a faint, fixed fibre layer over everything. Pointer-transparent. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: url("/assets/img/wood-hero.svg") center / cover;
  mix-blend-mode: multiply;
  opacity: 0.07;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--walnut); color: var(--paper); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }

h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.02; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

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

.eyebrow {
  font-family: var(--text);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.22em;
  font-size: 1.02rem;
  color: var(--walnut);
  margin: 0 0 0.9rem;
}
.numeral {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem);
  color: var(--brass);
  line-height: 1;
  margin-bottom: 0.6rem;
}
.placeholder {
  font-style: italic;
  color: var(--muted);
  border-left: 1px solid var(--brass);
  padding-left: 1rem;
}
.placeholder-inline { font-style: italic; }

/* Text link with a hairline that draws itself on hover. */
.line {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left 100% / 100% 1px no-repeat;
  padding-bottom: 0.08em;
  transition: background-size 0.6s var(--ease);
}
.line:hover { background-size: 0% 1px; background-position: right 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  margin-top: 0.6rem;
  padding: 0.95em 1.6em 0.9em;
  border: 1px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.18em;
  font-size: 1.05rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--walnut);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.6s var(--ease);
}
.btn:hover, .btn:focus-visible { color: var(--paper); border-color: var(--walnut); }
.btn:hover::before, .btn:focus-visible::before { transform: scaleY(1); }
.btn span { transition: transform 0.6s var(--ease); }
.btn:hover span { transform: translateX(0.35em); }

/* ---------- Scroll progress ---------- */
.progress { display: none; }
.motion .progress {
  display: block;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 60;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Solid by default, so the nav stays readable over the dark bands without JS, with reduced
     motion and on the failsafe path. Only the animated page makes it transparent over the hero. */
  padding: 0.6rem var(--gutter);
  background: rgba(244, 238, 227, 0.92);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  box-shadow: 0 1px 0 var(--hair);
  transition: background-color 0.6s var(--ease), box-shadow 0.6s var(--ease), padding 0.6s var(--ease);
}
.motion .nav:not(.is-scrolled):not(.nav--solid) {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.nav__links {
  display: flex;
  gap: clamp(1rem, 2.4vw, 2.4rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav__links a {
  text-decoration: none;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.18em;
  font-size: 1rem;
  position: relative;
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.2em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__cta { color: var(--walnut); }
@media (max-width: 760px) {
  .nav__links li:not(:last-child) { display: none; }
  .nav__links--always li { display: list-item; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 7rem var(--gutter) 5rem;
  overflow: hidden;
}
.hero__grain {
  position: absolute;
  inset: -8%;
  z-index: -1;
  opacity: 0.7;
}
.hero__grain img { width: 100%; height: 100%; object-fit: cover; }
.hero::after {
  /* vignette that settles the title onto the paper */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 45%, rgba(244, 238, 227, 0.92) 0%, rgba(244, 238, 227, 0.55) 45%, rgba(234, 225, 209, 0.2) 100%);
}
.hero__inner { max-width: 70rem; }
.hero__mono { margin: 0 auto 1.6rem; }
.hero__title {
  font-size: clamp(4.4rem, 1rem + 15vw, 15rem);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.035em;
  margin: 0.2rem 0 2.2rem;
}
.hero__title em { font-style: italic; font-weight: 400; color: var(--brass); padding-left: 0.02em; }
.hero__lede {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem);
  font-style: italic;
  color: var(--muted);
  max-width: 34rem;
  margin: 0 auto 3rem;
}
.hero__cue {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.24em;
  font-size: 0.95rem;
  color: var(--walnut);
}
.hero__cue i {
  display: block;
  width: 1px;
  height: 4rem;
  background: linear-gradient(var(--walnut), transparent);
}

/* ---------- Chapters (shared) ---------- */
.chapter {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(6rem, 12vw, 11rem) var(--gutter);
}
.chapter__head { margin-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.chapter__head--center { text-align: center; max-width: 44rem; margin-left: auto; margin-right: auto; }
.chapter__title { font-size: clamp(2.6rem, 1.4rem + 4.4vw, 5.6rem); }
.chapter__lede { color: var(--muted); font-style: italic; margin-top: 1.4rem; }

/* ---------- I. Håndverket ---------- */
.craft {
  display: grid;
  gap: clamp(3rem, 6vw, 6rem);
}
.craft__words {
  font-family: var(--display);
  font-size: clamp(2rem, 1.1rem + 3.2vw, 4.1rem);
  line-height: 1.14;
  font-weight: 400;
  letter-spacing: -0.012em;
  margin: 0;
  max-width: 22ch;
}
.craft__aside { display: grid; gap: 2rem; align-content: start; }
.craft__note { color: var(--muted); max-width: 30rem; }
@media (min-width: 900px) {
  .craft { grid-template-columns: 1.25fr 0.75fr; align-items: start; }
  .craft__pin { padding-top: 2vh; }
  .craft__aside { padding-top: 22vh; }
}

/* ---------- Media frames (placeholders today, photos later) ---------- */
.media {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--paper-deep);
}
.media--tall { aspect-ratio: 3 / 4; }
.media--wide { aspect-ratio: 16 / 9; }
.media__inner { position: absolute; inset: -9% 0; }
.media__inner img { width: 100%; height: 100%; object-fit: cover; }
.media figcaption {
  position: absolute;
  left: 1rem;
  bottom: 0.9rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.22em;
  font-size: 0.9rem;
  color: var(--paper);
  background: rgba(31, 26, 20, 0.72);   /* chip keeps the caption readable on light woods */
  padding: 0.15rem 0.6rem 0.25rem;
  z-index: 1;
}
.media::after {
  /* thin inner frame, like a mount around a print */
  content: "";
  position: absolute;
  inset: 0.75rem;
  border: 1px solid rgba(244, 238, 227, 0.28);
  pointer-events: none;
}

/* ---------- II. Kolleksjonen ---------- */
.panel {
  display: grid;
  gap: 2rem;
  margin-bottom: clamp(5rem, 10vw, 9rem);
  align-items: center;
}
.panel:last-child { margin-bottom: 0; }
.panel__text { max-width: 30rem; }
.panel__num {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--brass);
  margin-bottom: 0.4rem;
}
.panel h3 { font-size: clamp(2.2rem, 1.4rem + 2.8vw, 3.9rem); margin-bottom: 1.2rem; }
.panel p { color: var(--muted); }
@media (min-width: 900px) {
  .panel { grid-template-columns: repeat(12, 1fr); gap: 0; }
  .panel .media { grid-column: 1 / span 7; grid-row: 1; }
  .panel .panel__text { grid-column: 9 / span 4; grid-row: 1; }
  .panel--flip .media { grid-column: 6 / span 7; }
  .panel--flip .panel__text { grid-column: 1 / span 4; }
}

/* ---------- III. Prosessen (forest band) ---------- */
.process {
  max-width: none;
  padding: 0;
  background: var(--forest);
  color: var(--paper);
  overflow: hidden;
}
.process .eyebrow { color: var(--brass-light); }
.process .numeral { color: var(--brass-light); }
.process__frame {
  padding: clamp(6rem, 12vw, 10rem) var(--gutter);
  max-width: var(--max);
  margin: 0 auto;
}
.process__head { margin-bottom: 3.5rem; }
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2.8rem;
}
.step {
  border-top: 1px solid var(--hair-light);
  padding-top: 1.6rem;
}
.step__num {
  display: block;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--brass-light);
  margin-bottom: 0.6rem;
}
.step h3 { font-size: clamp(2rem, 1.4rem + 2vw, 3.2rem); margin-bottom: 0.8rem; }
.step p { color: rgba(244, 238, 227, 0.78); max-width: 26rem; }
@media (min-width: 900px) {
  /* Wide screens: one row that main.js slides sideways while the section is pinned. */
  .process__frame { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; max-width: none; }
  .process__head { padding-left: max(0px, calc((100vw - var(--max)) / 2)); }
  .steps {
    display: flex;
    gap: clamp(3rem, 6vw, 7rem);
    width: max-content;
    padding-left: max(0px, calc((100vw - var(--max)) / 2));
    padding-right: var(--gutter);
  }
  .step { width: clamp(20rem, 30vw, 28rem); flex: none; }
}

/* ---------- IV. Verkstedet ---------- */
.workshop { display: grid; gap: clamp(3rem, 6vw, 5rem); }
.workshop__motto {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.8rem, 1.1rem + 2.4vw, 3.2rem);
  line-height: 1.15;
  color: var(--walnut);
  max-width: 20ch;
}
@media (min-width: 900px) {
  .workshop { grid-template-columns: 7fr 5fr; align-items: center; }
}

/* ---------- Kontakt (walnut band) ---------- */
.contact {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(6rem, 12vw, 11rem) var(--gutter);
}
.contact__inner { max-width: var(--max); margin: 0 auto; }
.contact .eyebrow { color: var(--brass-light); }
.contact__title { font-size: clamp(3rem, 1.2rem + 7vw, 8rem); margin-bottom: 1.6rem; }
.contact__lede { color: rgba(244, 238, 227, 0.75); font-style: italic; max-width: 32rem; margin-bottom: 4rem; }
.contact__list { display: grid; gap: 0; margin: 0; }
.contact__list > div {
  display: grid;
  gap: 0.3rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--hair-light);
}
.contact__list > div:last-child { border-bottom: 1px solid var(--hair-light); }
.contact__list dt {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.2em;
  color: var(--brass-light);
}
.contact__list dd {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.6rem);
}
.contact__list a { text-decoration: none; }
@media (min-width: 760px) {
  .contact__list > div { grid-template-columns: 19rem 1fr; align-items: baseline; }
}

/* ---------- Footer ---------- */
.footer {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 3.5rem var(--gutter) 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
}
.footer img { margin-bottom: 0.8rem; }
.footer p { margin: 0; }

/* ---------- Text pages (personvern, 404) ---------- */
.prose {
  max-width: 40rem;
  margin: 0 auto;
  padding: 9rem var(--gutter) 5rem;
}
.prose h1 { font-size: clamp(3rem, 2rem + 4vw, 5rem); margin-bottom: 1.4rem; }
.prose h2 { font-size: clamp(1.7rem, 1.3rem + 1.2vw, 2.3rem); margin: 2.8rem 0 0.8rem; }
.prose__lede { font-style: italic; font-size: 1.3rem; color: var(--walnut); }
.prose__date { margin-top: 3rem; color: var(--muted); font-style: italic; }
.page--center { min-height: 100vh; display: grid; place-items: center; }
.lost { text-align: center; padding: 3rem var(--gutter); max-width: 34rem; }
.lost img { margin: 0 auto 1.4rem; }
.lost h1 { font-size: clamp(2.8rem, 2rem + 4vw, 4.6rem); margin-bottom: 1rem; }
.lost p { color: var(--muted); }

/* ---------- Lenis (rules copied from lenis 1.3.29 dist/lenis.css, MIT) ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }
.lenis.lenis-autoToggle { transition-property: overflow; transition-duration: 1ms; transition-behavior: allow-discrete; }

/* ---------- Animation start states: ONLY under .motion (see header comment) ---------- */
.motion .reveal { opacity: 0; transform: translateY(42px); filter: blur(6px); }
.motion .hero__title { opacity: 0; }
.motion .media { clip-path: inset(100% 0 0 0); }
.motion .panel__num { opacity: 0; }
