/* The toy box shelf. Same paper, ink and lettering as chringles.dev (its
   tokens are copied from that repo's src/styles/globals.css @theme). */

@font-face { font-family: 'Caveat'; font-weight: 500 700; font-display: swap; src: url('fonts/caveat.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 500 800; font-display: swap; src: url('fonts/nunito.woff2') format('woff2'); }
@font-face { font-family: 'Gaegu'; font-weight: 400; font-display: swap; src: url('fonts/gaegu-latin-400.woff2') format('woff2'); }
@font-face { font-family: 'Gaegu'; font-weight: 700; font-display: swap; src: url('fonts/gaegu-latin-700.woff2') format('woff2'); }

:root {
  --paper: #ecebe6;
  --surface: #fffefb;
  --elevated: #f5f4ef;
  --ink: #0d0f14;
  --text: #2b2a30;
  --muted: #605f66;
  --marker: #e11d2e;      /* fills and large type only */
  --marker-ink: #c8102e;  /* small red text */
  --tape: #d6c49b;
  --highlight: #fde047;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --hand: 'Caveat', cursive;
  --label: 'Gaegu', cursive;
  --body: 'Nunito', system-ui, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper) radial-gradient(#2b2a3014 1px, transparent 1.2px) 0 0 / 22px 22px;
  color: var(--text);
  font: 500 18px/1.6 var(--body);
  overflow-x: clip; /* tilted cards can poke past a phone's edge */
}

a { color: inherit; }

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

/* ---- top: the only tie back to the portfolio ---- */
.top {
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 0;
}
.made-by {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font: 700 19px/1 var(--label);
  color: var(--text);
  text-decoration: none;
}
.made-by span { display: inline-block; color: var(--muted); transition: transform 0.3s var(--ease-out-quart), color 0.15s; }
.made-by:hover span { color: var(--ink); transform: translate(2px, -2px); }

/* The paper wordmark, as in the chringles.dev header: ink letters over a red
   marker stroke, wobbling through the ink filters. */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.wordmark { display: block; height: 40px; width: auto; transition: transform 0.3s var(--ease-out-quart); }
.ink { filter: url(#ink-0); }
.made-by:hover .wordmark { transform: rotate(-2deg) translateY(-2px); }
@keyframes ink-boil {
  0% { filter: url(#ink-0); }
  33% { filter: url(#ink-1); }
  66% { filter: url(#ink-2); }
}
@media (prefers-reduced-motion: no-preference) {
  .made-by:hover .wordmark, .made-by:focus-visible .wordmark { animation: ink-boil 0.3s steps(1) infinite; }
}
@media (min-width: 640px) { .wordmark { height: 44px; } }

/* ---- heading ---- */
.page {
  flex: 1;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  padding: 56px 16px 72px;
}
.title {
  position: relative;
  display: inline-block;
  margin: 0;
  font: 700 clamp(58px, 8vw, 96px)/1 var(--hand);
  color: var(--ink);
}
.squiggle {
  position: absolute;
  left: 0;
  bottom: -14px;
  width: 100%;
  height: 18px;
}
.squiggle path, .pick path, .star path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.squiggle path { stroke: var(--marker); stroke-width: 3; }

.intro {
  max-width: 48ch;
  margin: 34px 0 0;
  font-size: 19px;
  line-height: 1.65;
}
.highlight {
  background: linear-gradient(var(--highlight), var(--highlight)) no-repeat 0 88% / 100% 60%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 0.12em;
  margin: 0 -0.12em;
}

.pick {
  display: none;
  margin: 40px 0 0 24%;
  font: 700 28px/1 var(--hand);
  color: var(--marker-ink);
  transform: rotate(-3deg);
}
.pick svg { width: 60px; height: 40px; margin: 0 0 -22px 4px; vertical-align: bottom; }
.pick path { stroke-width: 2.5; }

/* ---- the pile ---- */
.pile {
  list-style: none;
  margin: 64px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 56px 32px;
  align-items: start; /* cards keep their own height */
}
@media (min-width: 640px) { .pile { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) {
  .pile { grid-template-columns: repeat(3, 1fr); margin-top: 56px; }
  .pick { display: block; }
}

.pile > li { width: min(92%, 420px); justify-self: center; }
@media (min-width: 640px) { .pile > li { width: 100%; } }

/* Taped polaroid, as on chringles.dev. --r and --tr: card and tape tilt. */
.polaroid {
  position: relative;
  display: block;
  padding: 12px 12px 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 10px 24px #2b2a301f, 0 1px 2px #2b2a301a;
  transform: rotate(var(--r, 0deg));
  transition: transform 0.5s var(--ease-out-quart), box-shadow 0.5s var(--ease-out-quart);
}
.polaroid::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  z-index: 1;
  width: 78px;
  height: 24px;
  background: color-mix(in oklab, var(--tape) 85%, transparent);
  transform: translateX(-50%) rotate(var(--tr, -3deg));
  mix-blend-mode: multiply;
}
.polaroid:hover,
.polaroid:focus-visible {
  z-index: 3;
  transform: rotate(0deg) translateY(-8px) scale(1.02);
  box-shadow: 0 22px 40px #2b2a302e;
}
.polaroid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--elevated);
}
.polaroid h2 {
  margin: 10px 0 0;
  font: 700 23px/1.1 var(--label);
  color: var(--text);
}
.polaroid p {
  margin: 2px 0 0;
  font: 400 18px/1.2 var(--label);
  color: var(--muted);
}

/* The empty slot at the end: where the next toy goes */
.slot {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  aspect-ratio: 16 / 12;
  padding: 24px;
  text-align: center;
  border: 3px dashed #0d0f1440;
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  transform: rotate(1.5deg);
}
.star { width: 40px; height: 40px; color: var(--marker); }
.star path { stroke-width: 2.5; }
.slot-title { font: 700 34px/1 var(--hand); color: var(--muted); }
.slot-sub { font: 400 18px/1.2 var(--label); color: var(--muted); }

/* ---- footer ---- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  padding: 24px 16px 32px;
  font: 400 18px/1.4 var(--label);
  color: var(--muted);
}
.foot a { text-decoration-color: var(--marker); text-underline-offset: 4px; }
.foot a:hover { color: var(--ink); }

/* ---- entrances: paper lands, ink draws itself ---- */
@media (prefers-reduced-motion: no-preference) {
  .pile > li {
    animation: land 0.8s var(--ease-out-quart) both;
    animation-delay: calc(0.25s + var(--i, 0) * 0.1s);
  }
  .squiggle path, .pick path, .star path {
    stroke-dasharray: 1 1.1; /* a plain 1 leaves a dot at the end */
    animation: draw 0.9s var(--ease-out-quart) both;
  }
  .squiggle path { animation-delay: 0.15s; }
  .pick path { animation-delay: 0.9s; }
  .star path { animation-delay: 1.1s; }
  .pick { animation: fade 0.5s ease-out 0.7s both; }
}
@keyframes land {
  from { opacity: 0; translate: 0 -18px; scale: 1.04; }
}
@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes fade {
  from { opacity: 0; }
}
