/* pinponpanpon — warm paper, ink borders, hard shadows.
 *
 * The design is not decoration chosen from a moodboard: it argues the project's
 * one claim, that a recipe is the asset and a WAV is one render of it. So the
 * page is a workshop notebook of recipe cards on warm stationery, not a
 * dashboard. Cards are physical objects with ink edges and a shadow that never
 * blurs, because a hard offset shadow reads as a real thing lying on paper
 * rather than a rectangle glowing in a void.
 *
 * Three rules hold the whole system together:
 *
 *   1. Ink on every accent fill, never light text. #FFFDF7 on terracotta is
 *      3.4:1 and fails; #262019 on it is 5.6:1 and passes. One rule, no
 *      per-colour exceptions to forget.
 *   2. Colour carries information. Each family owns one accent for the whole
 *      page -- its tab, its chips, its meter. A reader learns the mapping once.
 *   3. Rotation only on things you do not have to read. Stickers and tabs tilt;
 *      paragraphs never do.
 *
 * No webfonts. This is a local-first project whose whole promise is that it
 * still works when every subscription has lapsed, so the page does not phone
 * out to a font CDN to look like itself. The weight, scale and ink do the work.
 */

:root {
  color-scheme: light;

  --paper:  #FFF4DE;
  --card:   #FFFDF7;
  --ink:    #262019;
  --ink-2:  #5A5142;   /* secondary text — 6.6:1 on --card */
  --ink-3:  #8A7E6A;   /* metadata only, never body copy */

  --yellow:     #FFD64A;
  --pink:       #F6B6CA;
  --sky:        #A9DCFA;
  --terracotta: #EB5B32;
  --sage:       #BED7A6;
  --beige:      #EFE2C3;

  --accent: var(--yellow);   /* per-card, set by [data-accent] */

  --b: 3px;
  --r: 22px;
  --r-sm: 14px;

  --shadow:    5px 5px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  --display: ui-rounded, "Segoe UI Variable Display", "Segoe UI",
             system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}

[data-accent="yellow"]     { --accent: var(--yellow); }
[data-accent="pink"]       { --accent: var(--pink); }
[data-accent="sky"]        { --accent: var(--sky); }
[data-accent="terracotta"] { --accent: var(--terracotta); }
[data-accent="sage"]       { --accent: var(--sage); }
[data-accent="beige"]      { --accent: var(--beige); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font: 15.5px/1.62 var(--display);
  background-color: var(--paper);
  /* Stationery grid. Two layers: dots on the 24px rule, then a faint wash so
   * the cream is never a flat fill. */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(38, 32, 25, .13) 1.1px, transparent 0),
    radial-gradient(ellipse 900px 600px at 12% -5%, rgba(255, 214, 74, .22), transparent 65%),
    radial-gradient(ellipse 700px 500px at 92% 8%, rgba(169, 220, 250, .20), transparent 62%);
  background-size: 24px 24px, auto, auto;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain. Cheap, static, and the difference between "cream" and "paper". */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.16'/%3E%3C/svg%3E");
}

body > * { position: relative; z-index: 1; }

.spacer { flex: 1; }
.muted { color: var(--ink-2); }

/* ------------------------------------------------------------ typography */

h1 {
  font-size: clamp(34px, 6.4vw, 62px);
  line-height: 1.02;
  letter-spacing: -1.4px;
  font-weight: 800;
  margin: 0 0 22px;
}
h1 em {
  font-style: normal;
  background: linear-gradient(transparent 62%, var(--yellow) 62%, var(--yellow) 94%, transparent 94%);
  padding: 0 .12em;
}

h2 {
  font-size: clamp(21px, 2.7vw, 27px);
  font-weight: 800;
  letter-spacing: -.5px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

h3 { font-size: 16px; font-weight: 800; letter-spacing: -.2px; margin: 0 0 6px; }

p { margin: 0 0 14px; max-width: 68ch; color: var(--ink-2); }
p b, p strong { color: var(--ink); font-weight: 700; }
.lead { font-size: 17.5px; color: var(--ink); max-width: 62ch; }
.hint { font-size: 13.5px; color: var(--ink-2); }

code, .mono { font-family: var(--mono); }
code {
  background: var(--beige);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 0 5px;
  font-size: .85em;
  white-space: nowrap;
}

/* The monospace metadata label: tiny, uppercase, tracked out. Used for every
 * label that names a measurement rather than speaking a sentence. */
.label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .11em;
  color: var(--ink-2);
  font-weight: 400;
}

/* ------------------------------------------------------------- stickers */

.sticker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.sticker.tilt { transform: rotate(-2deg); }
.sticker.tilt-r { transform: rotate(1.6deg); }

/* --------------------------------------------------------------- chrome */

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px clamp(14px, 3vw, 30px);
  background: var(--card);
  border-bottom: var(--b) solid var(--ink);
  box-shadow: 0 4px 0 rgba(38, 32, 25, .16);
}

.mark {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.6px;
  display: inline-flex;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.mark b { padding: 3px 9px; }
.mark .a { background: var(--pink); }
.mark .b { background: var(--sky); }
.mark .c { background: var(--yellow); }

.vol { display: flex; align-items: center; gap: 9px; }
.vol input { width: clamp(84px, 14vw, 130px); }

footer {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 40px clamp(14px, 3vw, 30px) 46px;
  padding: 20px 24px;
  background: var(--card);
  border: var(--b) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--ink-2);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--ink);
  padding: 1px 6px;
}

/* --------------------------------------------------------------- layout */

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 30px);
}

/* Every section is a card lying on the paper. */
section {
  position: relative;
  background: var(--card);
  border: var(--b) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: clamp(22px, 3.4vw, 40px);
  margin: 34px 0;
}

/* The numbered tab clipped to the top edge of a section, like a divider in a
 * ring binder. */
section[data-step]::before {
  content: attr(data-step);
  position: absolute;
  top: -19px;
  left: 30px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--accent);
  border: var(--b) solid var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  transform: rotate(-4deg);
}

.hero {
  background: var(--card);
  padding-top: clamp(30px, 4.6vw, 52px);
  margin-top: 30px;
}

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

/* ---------------------------------------------------------- bento stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.stat {
  background: var(--accent);
  border: var(--b) solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  padding: 15px 17px 13px;
}
.stat b {
  display: block;
  font-size: clamp(28px, 3.6vw, 38px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1.4px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 7px;
}
.stat span {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  line-height: 1.4;
}
/* Cycle the palette across the bento row so no two neighbours match. */
.stats .stat:nth-child(6n + 1) { --accent: var(--yellow); }
.stats .stat:nth-child(6n + 2) { --accent: var(--sky); }
.stats .stat:nth-child(6n + 3) { --accent: var(--pink); }
.stats .stat:nth-child(6n + 4) { --accent: var(--sage); }
.stats .stat:nth-child(6n + 5) { --accent: var(--beige); }
.stats .stat:nth-child(6n + 6) { --accent: var(--terracotta); }

/* ------------------------------------------------------------- controls */

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 22px 0 4px;
}
.controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-2);
}
label.check { cursor: pointer; }
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
}

button, select {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  background: var(--card);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 11px;
  padding: 8px 15px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  /* Pressing moves the object onto its own shadow. That is the entire
   * tactile trick, and it must be instant -- an eased press feels like a
   * loading state, not a key travelling. */
  transition: transform .04s linear, box-shadow .04s linear, background .12s;
}
button:hover, select:hover { background: var(--beige); }
button:active, select:active,
button.pressed {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}
button.primary { background: var(--yellow); }
button.primary:hover { background: #FFE07A; }
button.stop { background: var(--terracotta); }
button.stop:hover { background: #F2724D; }
button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-sm);
}

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--beige);
  padding: 0;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--terracotta);
  border: 2.5px solid var(--ink);
  margin-top: -1px;
}
input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--terracotta);
  border: 2.5px solid var(--ink);
}

input[type=checkbox] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--ink);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
}
input[type=checkbox]:checked { background: var(--sage); }
input[type=checkbox]:checked::after {
  content: "✓";
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

/* ------------------------------------------------------------- ensemble */

.track {
  display: flex;
  gap: 4px;
  height: 46px;
  align-items: flex-end;
  margin-top: 20px;
  padding: 8px 10px;
  background: var(--beige);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.track span {
  flex: 1 1 0;
  min-width: 3px;
  max-width: 15px;
  height: 8px;
  border-radius: 3px;
  background: rgba(38, 32, 25, .22);
  transition: background .08s, height .08s;
}
.track span.hit {
  background: var(--terracotta);
  height: 30px;
  border: 2px solid var(--ink);
}

/* ---------------------------------------------------------------- nudge */

#axes {
  display: grid;
  grid-template-columns: minmax(96px, 132px) 1fr 56px;
  gap: 14px 16px;
  align-items: center;
  margin: 22px 0;
  padding: 18px 20px;
  background: var(--beige);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
}
#axes .ax b {
  display: block;
  font-weight: 800;
  font-size: 14.5px;
}
#axes .ax span {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-2);
}
#axes .val {
  text-align: right;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
}

/* The recipe card: what the page is arguing about, drawn as an index card. */
.recipe {
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.recipe-head {
  padding: 9px 16px;
  background: var(--sky);
  border-bottom: 2.5px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
}
.recipe pre {
  margin: 0;
  padding: 15px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
}

/* ---------------------------------------------------------- family board */

#families { display: grid; gap: 20px; }

.family {
  position: relative;
  background: var(--card);
  border: var(--b) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.family > header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.family h3 {
  margin: 0;
  font-size: 19px;
  background: var(--accent);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  padding: 3px 12px;
  box-shadow: var(--shadow-sm);
}
.family .tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.family p { font-size: 14px; margin: 12px 0 16px; max-width: 74ch; }

.roles { display: flex; flex-wrap: wrap; gap: 11px; }
.role {
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 10px 12px 11px;
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  min-width: 146px;
}
.role .rn { font-size: 14px; font-weight: 800; margin-bottom: 2px; }
.role .rs {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-2);
  margin-bottom: 9px;
}
.role .takes { display: flex; gap: 5px; flex-wrap: wrap; }
.role .takes button {
  padding: 2px 10px;
  font-size: 13px;
  border-radius: 8px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  min-width: 30px;
}
.role .takes button:active,
.role .takes button.on {
  background: var(--accent);
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

details.src { margin-top: 16px; }
details.src summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-weight: 700;
  background: var(--beige);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 14px;
  box-shadow: var(--shadow-sm);
}
details.src summary::-webkit-details-marker { display: none; }
details.src summary:hover { background: var(--accent); }
details.src[open] summary { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
details.src pre {
  margin: 12px 0 0;
  padding: 16px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ cat */

.cat-head { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.cat-mark {
  font-size: 46px;
  line-height: 1;
  background: var(--pink);
  border: var(--b) solid var(--ink);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 10px 16px 14px;
  transform: rotate(-3deg);
  flex: none;
}
#paws { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.paw {
  flex: 1 1 168px;
  max-width: 260px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  padding: 12px 13px 13px;
}
.paw .pn { font-weight: 800; font-size: 15px; }
.paw .pd {
  font-size: 12.5px;
  color: var(--ink-2);
  margin: 3px 0 10px;
  line-height: 1.45;
}
.paw .takes { display: flex; gap: 5px; flex-wrap: wrap; }
.paw .takes button {
  padding: 3px 11px;
  font-size: 13px;
  border-radius: 8px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--ink);
  min-width: 30px;
}
/* Walking is the thing you actually came to hear, so it gets its own line
   rather than trailing after however many takes happened to fit. */
.paw .takes button.primary { flex: 1 0 100%; margin-top: 3px; }
.paw .takes button:active, .paw .takes button.on {
  background: var(--pink);
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}
.cat-note {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--sage);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}
/* Two columns on a wide card, so a 68ch measure does not leave half the
   sticker empty. */
.cat-note { display: grid; gap: 14px 26px; }
@media (min-width: 900px) { .cat-note { grid-template-columns: 1fr 1fr; } }
.cat-note p { color: var(--ink); margin: 0; font-size: 14px; max-width: 60ch; }

/* -------------------------------------------------------------- context */

.tiles { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.tile {
  flex: 1 1 128px;
  max-width: 200px;
  background: var(--card);
  border: var(--b) solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  padding: 18px 14px;
  text-align: center;
  font-weight: 800;
  font-size: 15px;
}
.tiles .tile:nth-child(4n + 1) { background: var(--yellow); }
.tiles .tile:nth-child(4n + 2) { background: var(--pink); }
.tiles .tile:nth-child(4n + 3) { background: var(--sky); }
.tiles .tile:nth-child(4n + 4) { background: var(--sage); }

.meter {
  height: 16px;
  background: var(--beige);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
}
.meter i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--terracotta);
  border-right: 2.5px solid var(--ink);
  transition: width .05s linear;
}

.log {
  margin-top: 16px;
  height: 128px;
  overflow-y: auto;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
}
.log div { white-space: pre; }
.log .warn { color: var(--terracotta); font-weight: 700; }

/* --------------------------------------------------------------- honest */

.honest-card {
  background: var(--accent);
  border: var(--b) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.honest-card h3 { margin-bottom: 8px; }
.honest-card p { color: var(--ink); font-size: 14px; margin: 0; }
.cols > .honest-card:nth-child(1) { --accent: var(--sage);  transform: rotate(-.7deg); }
.cols > .honest-card:nth-child(2) { --accent: var(--yellow); }
.cols > .honest-card:nth-child(3) { --accent: var(--pink);  transform: rotate(.8deg); }

/* ----------------------------------------------------------- responsive */

@media (max-width: 700px) {
  #axes { grid-template-columns: 84px 1fr 46px; gap: 10px 11px; padding: 14px; }
  section { border-radius: 18px; }
  .stat b { font-size: 30px; }
  .paw, .tile { max-width: none; }
}

@media (max-width: 480px) {
  :root { --shadow-lg: 5px 5px 0 var(--ink); --shadow: 4px 4px 0 var(--ink); }
  .cat-mark { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  .sticker.tilt, .sticker.tilt-r, .cat-mark,
  section[data-step]::before, .cols > .honest-card { transform: none; }
}

/* Printing a page about sound is a strange thing to do, but a notebook should
 * survive it: drop the shadows, keep the ink. */
@media print {
  body { background: #fff; }
  body::before { display: none; }
  section, .stat, .family, .role { box-shadow: none; }
  .top, footer, .controls { display: none; }
}
