/* ==========================================================================
   Punchcake — design system
   The mark is an isometric punčový řez: four layers, lit from the top-left.
   That gives the whole site its two structural motifs — strata (banded rules
   in icing/cream/jam/cream) and an isometric light rule (top lightest, left
   lit, right shaded) used for every raised surface and hover lift.
   ========================================================================== */

/* --- tokens ------------------------------------------------------------- */

:root {
  /* Brand, sampled from the mark. */
  --icing: #f86fa0;
  --icing-top: #fb7ca9;
  --icing-deep: #e85589;
  --cream: #fbdc92;
  --cream-lit: #ffe7a8;
  --jam: #ba184f;
  --jam-lit: #ca2059;

  /* Layer proportions, measured off the mark's side faces. */
  --band-icing: 9.37%;
  --band-cream-a: 33.96%;
  --band-jam: 28.75%;
  --band-cream-b: 27.92%;

  /* Light — "paper". */
  --paper: #fbfaf7;
  --paper-raised: #fffefc;
  --wash: #faf7f1;
  --ink: #17110f;
  --ink-2: #574d48;
  --ink-3: #8d827b;
  --rule: #e9e3da;
  --rule-strong: #d9d1c5;
  --accent: var(--jam);
  --accent-quiet: var(--icing);
  --shadow-key: 22 17 15;
  --shadow-a: 0.05;
  --shadow-b: 0.08;

  /* Type. */
  --display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --text: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Measure. */
  --page: 1180px;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #100b0d;
    --paper-raised: #191214;
    --wash: #1b1416;
    --ink: #f7f2ee;
    --ink-2: #b3a8a3;
    --ink-3: #7d726d;
    --rule: #2b2225;
    --rule-strong: #3b2f33;
    --icing: #ff8fb8;
    --icing-top: #ffa3c4;
    --icing-deep: #f06d9c;
    --jam: #e6376f;
    --jam-lit: #f04c80;
    --cream: #f6d894;
    --cream-lit: #ffe7a8;
    --accent: var(--icing);
    --shadow-key: 0 0 0;
    --shadow-a: 0.4;
    --shadow-b: 0.55;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #100b0d;
  --paper-raised: #191214;
  --wash: #1b1416;
  --ink: #f7f2ee;
  --ink-2: #b3a8a3;
  --ink-3: #7d726d;
  --rule: #2b2225;
  --rule-strong: #3b2f33;
  --icing: #ff8fb8;
  --icing-top: #ffa3c4;
  --icing-deep: #f06d9c;
  --jam: #e6376f;
  --jam-lit: #f04c80;
  --cream: #f6d894;
  --cream-lit: #ffe7a8;
  --accent: var(--icing);
  --shadow-key: 0 0 0;
  --shadow-a: 0.4;
  --shadow-b: 0.55;
}

/* --- reset -------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  /* The hero bloom bleeds off the right edge on purpose. `clip` contains it
     without creating a scroll container, so `position: sticky` still works. */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(0.9375rem, 0.2vw + 0.9rem, 1rem);
  line-height: 1.62;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

::selection { background: var(--cream-lit); color: #17110f; }

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

a { color: inherit; text-decoration: none; }

/* --- primitives --------------------------------------------------------- */

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

.eyebrow {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* The cake, flattened into a rule. Four equal hairlines so it stays crisp. */
.strata {
  height: 6px;
  border: 0;
  background: linear-gradient(
    to bottom,
    var(--icing) 0 25%,
    var(--cream) 25% 50%,
    var(--jam) 50% 75%,
    var(--cream) 75% 100%
  );
  opacity: 0.9;
}

/* Vertical spine on the project rows — here the true layer proportions fit. */
.spine {
  background: linear-gradient(
    to bottom,
    var(--icing) 0 var(--band-icing),
    var(--cream) var(--band-icing) calc(var(--band-icing) + var(--band-cream-a)),
    var(--jam) calc(var(--band-icing) + var(--band-cream-a))
      calc(100% - var(--band-cream-b)),
    var(--cream) calc(100% - var(--band-cream-b)) 100%
  );
}

/* --- masthead ----------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.masthead[data-stuck='true'] { border-bottom-color: var(--rule); }

.masthead__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.012em;
}

.brand__mark {
  width: 1.5rem;
  flex: none;
  transition: transform 0.45s var(--ease-out);
}

.brand:hover .brand__mark { transform: translate(1.5px, -2px); }

.themetoggle {
  display: grid;
  place-items: center;
  width: 2.125rem;
  height: 2.125rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-raised);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.themetoggle:hover { border-color: var(--rule-strong); transform: translateY(-1px); }
.themetoggle svg { width: 0.9375rem; height: 0.9375rem; }
.themetoggle .i-sun { display: none; }

:root[data-theme='dark'] .themetoggle .i-sun { display: block; }
:root[data-theme='dark'] .themetoggle .i-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .themetoggle .i-sun { display: block; }
  :root:not([data-theme='light']) .themetoggle .i-moon { display: none; }
}

/* --- hero --------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 8rem) clamp(3rem, 7vw, 6.5rem);
}

/* A warm bloom behind the mark, angled along the isometric light. */
.hero::before {
  content: '';
  position: absolute;
  inset: -20% -10% auto auto;
  width: min(70vw, 720px);
  aspect-ratio: 1;
  background: radial-gradient(
    circle at 62% 38%,
    color-mix(in srgb, var(--icing) 26%, transparent),
    transparent 64%
  );
  filter: blur(28px);
  opacity: 0.5;
  pointer-events: none;
  z-index: -1;
}

.hero__in {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

@media (max-width: 56rem) {
  .hero__in {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.5rem, 5vw, 2.5rem);
  }
  .hero__art { order: -1; }
}

.hero__title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-variation-settings: 'SOFT' 20, 'WONK' 1;
  font-size: clamp(3.25rem, 10vw, 6.5rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.032em;
  margin-top: 1rem;
}

.hero__tagline {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(1.375rem, 3vw, 2.125rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.18;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
  max-width: 22ch;
}

.hero__tagline em {
  font-style: inherit;
  color: var(--jam);
}

.hero__lead {
  margin-top: 1.25rem;
  max-width: 46ch;
  font-size: clamp(1rem, 0.4vw + 0.95rem, 1.125rem);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.125rem;
  margin-top: clamp(1.75rem, 3.5vw, 2.5rem);
}

.hero__meta li {
  display: flex;
  align-items: center;
  gap: 1.125rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.hero__meta li + li::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--icing);
  transform: rotate(45deg);
  flex: none;
}

.hero__meta b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* The mark, on an isometric ground plane. */
.hero__art {
  position: relative;
  width: min(100%, 24rem);
  justify-self: end;
}

.hero__art svg { width: 100%; height: auto; overflow: visible; }

.hero__art::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -5%;
  height: 12%;
  background: radial-gradient(
    ellipse at center,
    rgb(var(--shadow-key) / calc(var(--shadow-a) * 2.4)),
    transparent 72%
  );
  filter: blur(6px);
  z-index: -1;
}

/* Narrow screens lead with the wordmark, so the mark stays a supporting note. */
@media (max-width: 56rem) {
  .hero__art {
    justify-self: start;
    width: min(56%, 14.5rem);
  }
}

/* Layers assemble bottom-up on load. Scoped to the hero so the masthead mark
   stays still, and driven by data-layer so no inline styles are needed. */
.hero__cake .pc-layer {
  animation: layer-in 0.72s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 110ms + 120ms);
}

.hero__cake .pc-layer[data-layer='cream-lower'] { --i: 0; }
.hero__cake .pc-layer[data-layer='jam']         { --i: 1; }
.hero__cake .pc-layer[data-layer='cream-upper'] { --i: 2; }
.hero__cake .pc-layer[data-layer='icing']       { --i: 3; }

/* A fixed lift in user units, not a percentage: the layers have different
   bounding boxes, so a percentage would drop each one a different distance.
   Opacity finishes early so a slab is solid for nearly all of its fall —
   otherwise falling layers show through each other and the stack goes muddy. */
@keyframes layer-in {
  from { opacity: 0; transform: translateY(-26px); }
  10%  { opacity: 1; }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- section scaffolding ------------------------------------------------ */

.section { padding-block: clamp(3.5rem, 7vw, 6rem); }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section__title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(1.75rem, 3.6vw, 2.75rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.026em;
  margin-top: 0.625rem;
}

.section__aside {
  max-width: 34ch;
  font-size: 0.9375rem;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* --- filters ------------------------------------------------------------ */

.filters {
  display: flex;
  width: max-content;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.3125rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-raised);
}

.filter {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.004em;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.24s var(--ease);
}

.filter:hover { color: var(--ink); }

.filter[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}

.filter__n {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.55;
  margin-left: 0.375rem;
}

/* --- project index ------------------------------------------------------ */

.index { border-top: 1px solid var(--rule); }

.row {
  position: relative;
  border-bottom: 1px solid var(--rule);
  transition: background 0.32s var(--ease);
}

.row__link {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr) minmax(0, 16.5rem);
  gap: 0.5rem clamp(1rem, 2.5vw, 2.5rem);
  align-items: start;
  padding: clamp(1.5rem, 2.6vw, 2.125rem) 0;
  padding-inline: clamp(0.5rem, 1.5vw, 1.25rem);
  transition: transform 0.4s var(--ease-out);
}

/* The spine: a slice of cake standing on its edge. */
.row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.42s var(--ease-out);
  background: linear-gradient(
    to bottom,
    var(--icing) 0 var(--band-icing),
    var(--cream) var(--band-icing) calc(var(--band-icing) + var(--band-cream-a)),
    var(--jam) calc(var(--band-icing) + var(--band-cream-a))
      calc(100% - var(--band-cream-b)),
    var(--cream) calc(100% - var(--band-cream-b)) 100%
  );
}

.row:hover { background: var(--wash); }
.row:hover::before,
.row:focus-within::before { transform: scaleY(1); }

/* Lift along the isometric axis, not straight up. */
.row:hover .row__link { transform: translate(3px, -1px); }

.row__n {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding-top: 0.5rem;
  transition: color 0.24s var(--ease);
}

.row:hover .row__n { color: var(--jam); }

.row__name {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(1.3125rem, 1.9vw, 1.75rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.row__name .arrow {
  font-family: var(--text);
  font-size: 0.75em;
  color: var(--ink-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease-out);
}

.row:hover .row__name .arrow { opacity: 1; transform: translateX(0); }

.row__line {
  margin-top: 0.4375rem;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.58;
  text-wrap: pretty;
}

.row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.625rem;
  padding-top: 0.3125rem;
  text-align: right;
}

.row__metric {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3125rem;
}

.stack li {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0.1875rem 0.4375rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper-raised);
  white-space: nowrap;
}

/* Status chip — the dot carries the colour so the ladder reads at a glance. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 0.25rem 0.5625rem 0.25rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-raised);
  white-space: nowrap;
}

.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  flex: none;
  background: var(--ink-3);
}

.chip[data-status='beta'] .chip__dot { background: var(--jam); }
.chip[data-status='building'] .chip__dot { background: var(--icing); }
.chip[data-status='prototype'] .chip__dot {
  background: var(--cream);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--jam) 22%, transparent);
}

@media (max-width: 46rem) {
  .row__link {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    row-gap: 0.875rem;
  }
  .row__meta {
    grid-column: 2;
    align-items: flex-start;
    text-align: left;
    padding-top: 0;
  }
  .stack { justify-content: flex-start; }
  .row__name { font-size: 1.1875rem; }
}

/* Filtering. */
.row[hidden] { display: none; }

/* Scroll reveal — gated on .js so a JS failure cannot hide the index. */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
  transition-delay: var(--d, 0ms);
}

.js .reveal.is-in { opacity: 1; transform: none; }

/* --- legend ------------------------------------------------------------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
  padding-top: 1.5rem;
}

.legend li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--ink-3);
}

.legend b {
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* --- outro -------------------------------------------------------------- */

.outro__in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
}

@media (max-width: 52rem) {
  .outro__in { grid-template-columns: minmax(0, 1fr); }
}

.outro__note {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(1.375rem, 2.8vw, 2rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 26ch;
  text-wrap: balance;
}

.mailto {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  padding: 0.75rem 0;
  position: relative;
  color: var(--ink);
}

.mailto::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.5rem;
  height: 1.5px;
  background: var(--accent);
  transform-origin: left;
  transition: transform 0.36s var(--ease-out);
}

.mailto:hover::after { transform: scaleX(0.35); }

.mailto svg {
  width: 0.75rem;
  transition: transform 0.36s var(--ease-out);
}

.mailto:hover svg { transform: translate(3px, -3px); }

/* --- footer ------------------------------------------------------------- */

.foot { padding-block: clamp(2rem, 4vw, 3rem) clamp(2.5rem, 4vw, 3.5rem); }

.foot__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.foot p,
.foot li {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.foot ul { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.foot a { transition: color 0.2s var(--ease); }
.foot a:hover { color: var(--ink); }

/* --- motion preferences ------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .row:hover .row__link { transform: none; }
}

/* --- 404 ---------------------------------------------------------------- */

.gone {
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: start;
  gap: 1.25rem;
  padding-block: 4rem;
}

.gone__mark { width: 4.5rem; }
.gone__title { margin: 0; }
.gone__body { max-width: 38ch; }

/* Internal navigation moves back, so the arrow leads rather than trails. */
.gone__back:hover svg { transform: translate(-3px, 0); }

/* --- generated: reveal stagger (13 rows) --- */
.index .row:nth-child(1) { --d: 0ms; }
.index .row:nth-child(2) { --d: 45ms; }
.index .row:nth-child(3) { --d: 90ms; }
.index .row:nth-child(4) { --d: 135ms; }
.index .row:nth-child(5) { --d: 180ms; }
.index .row:nth-child(6) { --d: 225ms; }
.index .row:nth-child(7) { --d: 270ms; }
.index .row:nth-child(8) { --d: 315ms; }
.index .row:nth-child(9) { --d: 360ms; }
.index .row:nth-child(10) { --d: 405ms; }
.index .row:nth-child(11) { --d: 450ms; }
.index .row:nth-child(12) { --d: 495ms; }
.index .row:nth-child(13) { --d: 540ms; }
