:root {
  --paper: oklch(0.975 0.008 85);
  --ink: oklch(0.28 0.02 65);
  --ink-soft: oklch(0.4 0.018 65);
  --line: oklch(0.88 0.012 80);
  --mark: oklch(0.48 0.11 48);
  --sheet: oklch(0.995 0.004 85);
  --font: "Familjen Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --pad: clamp(1.25rem, 4vw, 4.5rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

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

::selection {
  background: oklch(0.9 0.04 55);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 4;
  background: var(--ink);
  color: var(--paper);
  padding: 0.45rem 0.75rem;
  text-decoration: none;
}

.skip:focus {
  top: 0.6rem;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 2rem;
  padding: 0.85rem var(--pad);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  font-weight: 600;
}

.bar a {
  text-decoration: none;
}

.bar-name:hover,
.bar-index:hover {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.bar-nav {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.bar-nav a {
  position: relative;
  padding: 0.1rem 0;
  color: var(--ink-soft);
  transition: color 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  height: 2px;
  background: var(--mark);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-nav a:hover,
.bar-nav a[aria-current="true"] {
  color: var(--ink);
}

.bar-nav a[aria-current="true"]::after {
  transform: scaleX(1);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2.5rem clamp(2rem, 5vw, 5rem);
  align-items: start;
  padding: clamp(2.5rem, 6vw, 5rem) var(--pad) 0;
}

.hero-photo {
  margin: 0;
  min-width: 0;
}

.hero-photo img {
  width: 100%;
  height: auto;
}

.hero-photo figcaption {
  margin-top: 0.65rem;
  text-align: right;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.hero-copy {
  min-width: 0;
}

.kicker {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 500;
}

h1 {
  margin: 0;
  font-size: clamp(3rem, 6.6vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-wrap: balance;
}

.lede {
  max-width: 30rem;
  margin: 1.5rem 0 0;
  font-size: 1.2rem;
}

.index {
  padding: clamp(2.75rem, 5vw, 4.5rem) 0 0;
}

.index ol {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 24rem;
}

.index li + li {
  margin-top: 0.15rem;
}

.index a {
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.28rem 0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.index a:hover {
  border-bottom-color: var(--ink);
}

.index span,
.num {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink-soft);
}

.work {
  display: flex;
  flex-direction: column;
  gap: clamp(5.5rem, 12vw, 10rem);
  padding: clamp(5rem, 12vw, 9rem) var(--pad) clamp(5rem, 10vw, 8rem);
}

.project {
  scroll-margin-top: 4.25rem;
}

.head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1rem clamp(1.5rem, 4vw, 4rem);
  align-items: baseline;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(1.5rem, 3.5vw, 3rem);
}

.head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.num {
  display: inline-block;
  min-width: 2.2em;
  font-size: 0.6em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.brief {
  max-width: 44ch;
}

.brief p {
  margin: 0;
}

.tools {
  margin-top: 0.3rem !important;
  color: var(--ink-soft);
  font-size: 1rem;
}

.comp {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 2.25rem) clamp(0.75rem, 2vw, 1.75rem);
  align-items: end;
}

.comp figure {
  margin: 0;
  min-width: 0;
}

.comp img,
.comp video {
  width: 100%;
  height: auto;
}

.comp video {
  background: var(--ink);
}

.comp figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  transition: color 0.25s var(--ease-out);
}

/* Plates: every piece opens on the light table. */
.plate {
  display: block;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.plate img {
  transition: transform 0.5s var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  figure:has(.plate:hover) figcaption {
    color: var(--ink);
  }

  .plate:hover img {
    transform: translateY(-4px);
  }
}

.plate:focus-visible {
  outline-offset: 6px;
}

/* Reveal on scroll. Only when JS runs; no-JS readers see everything at once. */
@media (prefers-reduced-motion: no-preference) {
  .js .work .head,
  .js .work .comp > figure,
  .js .work .comp > div {
    transition:
      opacity 0.8s var(--ease-out),
      transform 0.8s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 70ms);
  }

  .js .work .head:not(.in),
  .js .work .comp > figure:not(.in),
  .js .work .comp > div:not(.in) {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* Holographic print: tilts toward the pointer, foil sheen follows. */
.foil {
  --rx: 0deg;
  --ry: 0deg;
  --x: 50%;
  --y: 50%;
  position: relative;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-out);
}

.foil.live {
  transition: transform 0.12s linear;
}

.foil::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at var(--x) var(--y), oklch(0.98 0.02 90 / 0.55), transparent 42%),
    conic-gradient(
      from calc(var(--x) * 3.6) at var(--x) var(--y),
      oklch(0.8 0.17 20),
      oklch(0.85 0.17 90),
      oklch(0.82 0.16 150),
      oklch(0.8 0.15 230),
      oklch(0.78 0.17 300),
      oklch(0.8 0.17 20)
    );
  mix-blend-mode: color-dodge;
  transition: opacity 0.4s var(--ease-out);
}

.foil.live::after {
  opacity: 0.45;
}

/* Light table */
.table {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  display: none;
  grid-template-columns: 4.5rem minmax(0, 1fr) 4.5rem;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
}

.table[open] {
  display: grid;
}

.table::backdrop {
  background: transparent;
}

.table-figure {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1rem;
  margin: 0;
  height: 100%;
  padding: clamp(1.25rem, 4vh, 3rem) 0 clamp(1rem, 3vh, 2rem);
  min-width: 0;
}

.table-figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  justify-self: center;
  align-self: center;
  object-fit: contain;
  transition:
    opacity 0.18s var(--ease-out),
    transform 0.32s var(--ease-out);
}

.table-figure img.out {
  opacity: 0;
  transform: translateX(calc(var(--dir, 0) * -14px));
  transition-timing-function: var(--ease-in);
  transition-duration: 0.12s;
}

.table-figure figcaption {
  display: flex;
  gap: 0.6rem 1.25rem;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 0.95rem;
  line-height: 1.35;
}

.table-project {
  font-weight: 600;
}

.table-caption {
  color: var(--ink-soft);
}

.table-count {
  margin-left: auto;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.table button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 999px;
  transition:
    color 0.2s var(--ease-out),
    background-color 0.2s var(--ease-out);
}

.table button:hover {
  color: var(--ink);
  background: oklch(0.93 0.012 85);
}

.table button:active {
  background: oklch(0.9 0.014 85);
}

.table-prev {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
}

.table-next {
  grid-column: 3;
  grid-row: 1;
  justify-self: center;
}

.table-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

@media (prefers-reduced-motion: no-preference) {
  .table[open] {
    animation: table-in 0.32s var(--ease-out);
  }

  .table[open] .table-figure {
    animation: rise 0.45s var(--ease-out) both;
  }

  .table.closing {
    animation: table-out 0.18s var(--ease-in) forwards;
  }
}

@keyframes table-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes table-out {
  to { opacity: 0; }
}

@media (max-width: 700px) {
  .table {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-figure {
    grid-column: 1;
    padding: 3.5rem var(--pad) 1.25rem;
  }

  .table-prev,
  .table-next {
    position: absolute;
    bottom: 0.5rem;
  }

  .table-prev { left: 0.75rem; }
  .table-next { right: 0.75rem; }

  .table-figure figcaption {
    padding: 0 3.5rem;
  }
}

.devices {
  display: flex;
  align-items: flex-end;
  gap: clamp(1rem, 3vw, 2.5rem);
  min-width: 0;
}

.devices .laptop { flex: 921 1 0; }
.devices .tablet { flex: 356 1 0; }
.devices .phone { flex: 189 1 0; }

.stack {
  display: grid;
  gap: 1.5rem;
  min-width: 0;
}

/* 01 Meltberg */
.comp-meltberg .truck { grid-column: 1 / 9; }
.comp-meltberg .logo { grid-column: 10 / 13; padding-bottom: 6%; }
.comp-meltberg .penguin { grid-column: 1 / 3; padding: 0 10%; }
.comp-meltberg .menu { grid-column: 3 / 9; }
.comp-meltberg .uniform { grid-column: 9 / 11; }
.comp-meltberg .pint { grid-column: 11 / 13; }

/* 02 Fall Harvest */
.comp-fall .posters { grid-column: 1 / 13; }
.comp-fall .devices { grid-column: 1 / 12; }
.comp-fall .wall { grid-column: 1 / 8; }
.comp-fall .stack { grid-column: 8 / 13; align-self: center; }

/* 03 Clancys */
.comp-clancys .hoodie { grid-column: 1 / 8; }
.comp-clancys .parrot { grid-column: 8 / 13; padding: 0 4%; }

/* 04 TL Woodworks */
.comp-tl .logos { grid-column: 1 / 10; }
.comp-tl .site { grid-column: 4 / 13; }

/* 05 Grün Watt */
.comp-grun .glogo { grid-column: 1 / 5; }
.comp-grun .newsletter { grid-column: 5 / 13; }
.comp-grun .brochure { grid-column: 1 / 7; }
.comp-grun .fliers { grid-column: 7 / 13; }

/* 06 Yellowstone, 08 video, 09 poster */
.comp-single figure { grid-column: 2 / 12; }
.comp-video figure { grid-column: 1 / 13; }
.comp-poster .art { grid-column: 1 / 8; }
.comp-poster .print { grid-column: 9 / 13; }

/* 07 Final Fantasy */
.comp-ff figure { grid-column: span 3; }

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.4rem var(--pad) 2.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.foot p {
  margin: 0;
}

.foot a {
  text-decoration: none;
  font-weight: 600;
}

.foot a:hover {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

@media (max-width: 1100px) {
  .bar-nav {
    display: none;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .hero-copy {
    display: contents;
  }

  .hero-photo {
    order: 2;
    margin-top: 2.5rem;
  }

  .index {
    order: 3;
    padding-top: 2.5rem;
  }

  .head {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .comp {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .comp-meltberg .truck { grid-column: 1 / 7; }
  .comp-meltberg .logo { grid-column: 1 / 4; padding: 0 8% 0 0; }
  .comp-meltberg .penguin { grid-column: 4 / 7; padding: 0 18%; }
  .comp-meltberg .menu { grid-column: 1 / 7; }
  .comp-meltberg .uniform { grid-column: 1 / 4; }
  .comp-meltberg .pint { grid-column: 4 / 7; }

  .comp-fall .posters,
  .comp-fall .devices,
  .comp-fall .wall,
  .comp-fall .stack { grid-column: 1 / 7; }

  .comp-clancys .hoodie { grid-column: 1 / 7; }
  .comp-clancys .parrot { grid-column: 1 / 5; padding: 0; }

  .comp-tl .logos { grid-column: 1 / 7; }
  .comp-tl .site { grid-column: 1 / 7; }

  .comp-grun .glogo { grid-column: 1 / 4; }
  .comp-grun .newsletter,
  .comp-grun .brochure,
  .comp-grun .fliers { grid-column: 1 / 7; }

  .comp-single figure { grid-column: 1 / 7; }
  .comp-poster .art { grid-column: 1 / 7; }
  .comp-poster .print { grid-column: 1 / 5; }
  .comp-ff figure { grid-column: span 3; }
}

@media (max-width: 560px) {
  .comp-poster .print { grid-column: 1 / 7; }

  .foot {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .kicker,
  h1,
  .lede,
  .index,
  .hero-photo {
    animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  h1 { animation-delay: 0.06s; }
  .lede { animation-delay: 0.12s; }
  .index { animation-delay: 0.18s; }
  .hero-photo { animation-delay: 0.1s; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}
