/* ---------------------------------------------------------------------------
   Squish My Face — one stylesheet, no framework, no build step.

   Warm paper, one accent, thin rules, a lot of air. If you're adding
   something: reach for a border before a shadow, and a word before an icon.
--------------------------------------------------------------------------- */

:root {
  --paper: #faf7f2;
  --plate: #ffffff;
  --ink: #12100e;
  --ink-60: #5c574f;
  --ink-40: #8b857b;
  --rule: #12100e;
  --hair: #e4ded4;
  --accent: #ff5c35;
  --accent-ink: #2a0d05;
  --radius: 12px;
  --wrap: 1080px;
  --pad: 0.3;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
[id] { scroll-margin-top: 24px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }
canvas { display: block; max-width: none; }

a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 6.2vw, 4.1rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.015em; line-height: 1.3; }
p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  z-index: 100;
  font-size: 0.85rem;
}
.skip:focus { left: 12px; top: 12px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-40);
  margin: 0 0 1.2em;
}

.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--ink-60); max-width: 34em; }

/* --- header --------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-block: 22px;
}
.brand {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}
.site-nav { display: flex; gap: 22px; font-size: 0.92rem; }
.site-nav a { text-decoration: none; color: var(--ink-60); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 620px) {
  .site-header { padding-block: 16px; gap: 10px; }
  .brand { font-size: 0.95rem; }
  .site-nav { gap: 12px; font-size: 0.8rem; }
  .site-nav a.is-optional { display: none; }
  .hero h1 { font-size: clamp(1.9rem, 9.5vw, 2.8rem); }
  .hero .sub { font-size: 1rem; }
  .hero .how { font-size: 0.95rem; }
}

/* --- hero ----------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1fr 1.02fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-copy { order: 1; }
  .hero-toy { order: 2; }
}

.hero h1 { margin-bottom: 0.35em; }
.hero .sub { font-size: clamp(1.05rem, 2vw, 1.3rem); font-weight: 600; margin-bottom: 0.9em; }
.hero .how { color: var(--ink-60); max-width: 33em; margin-bottom: 1.6em; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.privacy-line { font-size: 0.82rem; color: var(--ink-40); margin-top: 14px; }

/* --- buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: #2a2620; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: rgba(18, 16, 14, 0.06); }
.btn--accent { background: var(--accent); border-color: var(--ink); color: var(--accent-ink); }
.btn--accent:hover { background: #ff7250; }
.btn--small { padding: 7px 14px; font-size: 0.82rem; border-width: 1.5px; }
.btn[disabled], .btn.is-busy { opacity: 0.55; pointer-events: none; }

.linkish {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* --- the toy -------------------------------------------------------------- */
.hero-toy { position: relative; width: 100%; max-width: 470px; margin-left: auto; }
@media (max-width: 860px) { .hero-toy { margin-inline: auto; max-width: 400px; } }

.toy-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 0.82;  /* keep in sync with ASPECT in toy.js */
  margin: 0 auto;
  touch-action: pan-y pinch-zoom;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  contain: layout;
}
.toy-disk {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  background: var(--accent);
}
.toy-canvas {
  position: absolute;
  z-index: 1;
  left: calc(var(--pad) * -100%);
  top: calc(var(--pad) * -100%);
  width: calc(100% + var(--pad) * 200%);
  height: calc(100% + var(--pad) * 200%);
  max-width: none;
  touch-action: none;
  pointer-events: none;   /* the button below takes the pointer instead */
}

/* What actually takes the pointer: the picture's own box, not the padded
   canvas. A button, so the toy can be reached without a mouse. */
.toy-hit {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: grab;
  touch-action: none;
  -webkit-appearance: none;
  appearance: none;
  outline: 0;
}
.toy-hit:active { cursor: grabbing; }
.toy-hit:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 3px; border-radius: 10px; }

.toy.is-held .toy-hit { cursor: grabbing; }

.toy-hint {
  position: absolute;
  z-index: 3;
  left: 4%;
  bottom: 4%;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 11px;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform-origin: left bottom;
}
.toy-hint.is-gone { opacity: 0; transform: translateY(4px); }

.toy-status {
  position: absolute;
  z-index: 4;
  inset: auto 0 0 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0 auto;
  width: max-content;
  max-width: 92%;
  text-align: center;
  font-size: 0.85rem;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
}
.toy-status.is-error { border-color: var(--accent); }

.toy-drop {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  border: 2px dashed var(--ink);
  border-radius: 18px;
  background: rgba(250, 247, 242, 0.9);
  font-weight: 700;
  pointer-events: none;
}
.toy.is-dragging .toy-drop { display: grid; }

.toy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--ink-60);
  cursor: pointer;
  user-select: none;
}
.switch input { accent-color: var(--accent); width: 15px; height: 15px; }
.select {
  font: inherit;
  font-size: 0.82rem;
  padding: 7px 28px 7px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.toy.is-calm .toy-hint { display: none; }

/* --- sections ------------------------------------------------------------- */
.section { padding: clamp(48px, 8vw, 96px) 0; border-top: 1.5px solid var(--hair); }
.section--tight { padding: clamp(32px, 5vw, 56px) 0; }
.section-head { max-width: 38em; margin-bottom: 2.4em; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; counter-reset: step; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 22px; } }
.step { border-top: 1.5px solid var(--ink); padding-top: 14px; }
.step-num { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-40); display: block; margin-bottom: 8px; }
.step p { color: var(--ink-60); font-size: 0.95rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; }
.card {
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--plate);
}
.card h3 { margin-bottom: 0.35em; }
.card p { font-size: 0.9rem; color: var(--ink-60); max-width: 44em; }
.card--quiet { background: transparent; border-style: dashed; }

.tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.tips li { padding-left: 22px; position: relative; color: var(--ink-60); font-size: 0.95rem; }
.tips li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); }
.tips strong { color: var(--ink); }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }

.formula {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: #f1ece3;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
.terms { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.terms li { font-size: 0.95rem; color: var(--ink-60); }
.terms code { font-family: var(--mono); font-size: 0.86rem; color: var(--ink); background: #f1ece3; padding: 1px 5px; border-radius: 4px; }
.terms strong { color: var(--ink); }

/* --- FAQ ------------------------------------------------------------------ */
.faq { max-width: 44em; }
.faq details { border-bottom: 1.5px solid var(--hair); }
.faq summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--ink-40); }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding: 0 0 18px; color: var(--ink-60); font-size: 0.95rem; max-width: 40em; }

/* --- prose pages ---------------------------------------------------------- */
.prose { max-width: 40em; }
.prose h2 { font-size: clamp(1.28rem, 2.2vw, 1.68rem); margin-top: 2.4em; letter-spacing: -0.02em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.02rem; }
.narrow { max-width: 44em; }
.prose ul { padding-left: 1.1em; }
.prose li { margin-bottom: 0.5em; color: var(--ink-60); }
.prose li strong { color: var(--ink); }
.prose code { font-family: var(--mono); font-size: 0.86em; background: #f1ece3; padding: 1px 5px; border-radius: 4px; }
.prose pre {
  background: #f1ece3; border-radius: 10px; padding: 14px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.5;
}

.page-head { padding: clamp(28px, 5vw, 56px) 0 clamp(20px, 4vw, 36px); }
.page-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.page-head .lede { max-width: 40em; }

.cta-band {
  border: 1.5px solid var(--ink);
  border-radius: 16px;
  padding: clamp(22px, 4vw, 38px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--plate);
}
.cta-band h2 { margin: 0; font-size: clamp(1.3rem, 2.6vw, 1.8rem); }
.cta-band p { margin: 6px 0 0; color: var(--ink-60); font-size: 0.95rem; }

/* --- footer --------------------------------------------------------------- */
.site-footer {
  border-top: 1.5px solid var(--hair);
  padding: 34px 0 46px;
  font-size: 0.85rem;
  color: var(--ink-40);
}
.footer-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: baseline; justify-content: space-between; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.footer-links a { text-decoration: none; color: var(--ink-60); }
.footer-links a:hover { color: var(--ink); }
.footer-joke { margin-top: 14px; font-style: italic; }

/* --- toasts --------------------------------------------------------------- */
.toasts {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.toast.is-out { opacity: 0; transform: translateY(6px); }

/* --- 404 ------------------------------------------------------------------ */
.center-page {
  min-height: 62vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 6px;
}

/* --- motion --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* Focus, visibly, for people who need it. */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
/* --- props: somebody else's hand, a fly, a puff of breath, a note ---------
   Sizes are fractions of the picture's width (cqw) with a rem fallback, so
   they keep their proportions on a phone. */
.toy-stage { container-type: inline-size; }

.ghost, .fly, .note, .puff {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  left: 0;
  top: 0;
  opacity: 0;
}
.ghost.is-here, .fly.is-here { opacity: 1; }

.ghost {
  width: 46px; height: 46px;
  width: clamp(34px, 9.5cqw, 58px); height: clamp(34px, 9.5cqw, 58px);
  filter: drop-shadow(0 3px 6px rgba(18, 16, 14, .28));
}
.ghost path { fill: #fff; stroke: #12100e; stroke-width: 1.6; stroke-linejoin: round; }
.ghost .grab, .ghost.is-gripping .open { display: none; }
.ghost.is-gripping .grab { display: block; }

.fly {
  width: 34px; height: 34px;
  width: clamp(24px, 7cqw, 40px); height: clamp(24px, 7cqw, 40px);
}
.fly .body { fill: #12100e; stroke: rgba(255, 255, 255, .7); stroke-width: .7; paint-order: stroke; }
.fly .wing { fill: rgba(255, 255, 255, .9); stroke: #12100e; stroke-width: 1; transform-box: view-box; }
.fly .wing.left { transform-origin: 15px 15px; }
.fly .wing.right { transform-origin: 17px 15px; }
.fly.is-here .wing.left { animation: fly-left 40ms linear infinite alternate; }
.fly.is-here .wing.right { animation: fly-right 40ms linear infinite alternate; }
.fly.is-landed .wing.left { animation: none; transform: rotate(-62deg); }
.fly.is-landed .wing.right { animation: none; transform: rotate(62deg); }
@keyframes fly-left { from { transform: rotate(24deg); } to { transform: rotate(-20deg); } }
@keyframes fly-right { from { transform: rotate(-24deg); } to { transform: rotate(20deg); } }

.puff {
  width: 44px; height: 44px;
  width: clamp(32px, 9cqw, 52px); height: clamp(32px, 9cqw, 52px);
  margin: -22px 0 0 -22px;
  opacity: 1;
  animation: puff 380ms ease-out forwards;
}
.puff path { fill: none; stroke-linecap: round; }
.puff .under { stroke: #12100e; stroke-width: 5.5; }
.puff .over { stroke: #fff; stroke-width: 2.6; }
@keyframes puff {
  from { transform: translateY(4px) scale(.7); opacity: 0; }
  30% { opacity: 1; }
  to { transform: translateY(-14px) scale(1.15); opacity: 0; }
}

.note {
  font-family: var(--mono);
  font-size: clamp(1rem, 5cqw, 1.6rem);
  color: var(--ink);
  opacity: 1;
  text-shadow: 0 0 6px var(--paper), 0 0 2px var(--paper);
  animation: note 1.9s ease-out forwards;
}
@keyframes note {
  from { transform: translate(0, 0) rotate(-6deg); opacity: 0; }
  15% { opacity: 1; }
  to { transform: translate(28px, -56px) rotate(10deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .fly.is-here .wing, .puff, .note { animation: none; }
  .puff, .note { display: none; }
}
