/* giggles.vn. A picture-led page: big flat tiles of the phone (the hero rendered
   by site/render.py, the rest drawn live by phone.js), a few large sentences between. Colours are
   brand/VIS.md 0.3. Geologica is the text; Cherry Bomb One is the voice (the
   child's words, the button). Orange is never text: accent type is B84D00. */

:root {
  --cream: #fff7f0;
  --sand: #f4ebe2;
  --peach: #ffdbba;
  --orange: #ff6b00;
  --button: #f76800;
  --button-down: #eb6200;
  --deep: #b84d00;
  --ink: #2c2927;
  --ink-70: #6b6763;
  --ink-25: #cac4be;
  --white: #fff;
  --red: #a8201a;

  --text: "Geologica", system-ui, -apple-system, "Segoe UI", sans-serif;
  --voice: "Cherry Bomb One", "Geologica", system-ui, sans-serif;
  --gap: 12px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 17px/1.5 var(--text); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, figure, dl, dd, ul, ol { margin: 0; padding: 0; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.wrap { width: 100%; max-width: 1720px; margin: 0 auto; padding: 0 var(--gap); }
@media (min-width: 800px) { :root { --gap: 20px; } }

/* the one canvas every 3D tile is painted through */
#gl { position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; will-change: transform; }

/* ---------- header ---------- */
.head { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--cream) 90%, transparent); backdrop-filter: blur(10px); }
.head .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.head .logo img { height: 28px; width: auto; }
.head nav { display: flex; align-items: center; gap: 16px; font-size: 16px; }
.head nav a { text-decoration: none; padding: 10px 0; }

/* ---------- the one button ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 58px; padding: 8px 32px; border: 0; border-radius: 16px; background: var(--button); color: var(--white); font: 400 22px/1.1 var(--voice); letter-spacing: 0.01em; text-align: center; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform 160ms var(--ease), background-color 160ms ease; }
.btn:active { transform: scale(0.97); background: var(--button-down); }
.btn[disabled] { opacity: 0.7; cursor: default; }
.btn-sm { min-height: 44px; padding: 6px 18px; font-size: 19px; border-radius: 13px; }
@media (hover: hover) and (pointer: fine) { .btn:hover { background: var(--button-down); } }
.offer { font-size: 18px; font-weight: 500; color: var(--deep); }

/* ---------- title block ---------- */
.intro { padding: clamp(28px, 6vw, 72px) 0 clamp(24px, 3vw, 40px); }
h1 { font-size: clamp(42px, 7.4vw, 104px); font-weight: 500; line-height: 0.98; letter-spacing: -0.04em; text-wrap: balance; }
h1 span { display: block; color: var(--deep); }
.sum { margin-top: 22px; font-size: clamp(18px, 1.5vw, 21px); max-width: 30em; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags li { font-size: 14px; padding: 3px 9px; background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 4px; color: var(--ink-70); }

/* ---------- tiles ---------- */
figure { margin-top: var(--gap); }
figcaption { margin-top: 8px; font-size: 15px; color: var(--ink-70); }
.tile { position: relative; overflow: hidden; aspect-ratio: 4 / 5; background: var(--bg); }
.tile.tall { aspect-ratio: 3 / 4; }
.duo { display: grid; gap: 0 var(--gap); }
.duo .tile { aspect-ratio: 1; }
@media (min-width: 800px) { .tile { aspect-ratio: 16 / 10; } .tile.tall { aspect-ratio: 16 / 11; } .duo { grid-template-columns: 1fr 1fr; } .duo .tile { aspect-ratio: 3 / 2; } }
/* until the model is in, and when 3D cannot start: the mark, quietly */
[data-view]::after { content: ""; position: absolute; inset: 0; background: url(/assets/mark.svg) center / 64px no-repeat; opacity: 0.45; }
.has3d [data-view]::after { display: none; }
.t-peach { --bg: var(--peach); }
.t-white { --bg: var(--white); }
.t-orange { --bg: var(--orange); }
.t-ink { --bg: var(--ink); --fg: var(--cream); }
.t-sand { --bg: var(--sand); }

/* a rendered picture, easing back as the page moves */
.shot img { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--s, 1)); will-change: transform; }

/* words that appear over a tile: on hover, on focus, or on a tap */
.over { position: absolute; inset: 0; z-index: 3; display: flex; align-items: flex-end; padding: clamp(18px, 3vw, 44px); background: color-mix(in srgb, var(--bg) 88%, transparent); color: var(--fg, var(--ink)); opacity: 0; transition: opacity 260ms ease; }
.over p { font-size: clamp(24px, 2.9vw, 44px); font-weight: 500; line-height: 1.1; letter-spacing: -0.025em; max-width: 15em; text-wrap: balance; transform: translateY(10px); transition: transform 320ms var(--ease); }
.has-over { cursor: pointer; }
.has-over.is-open .over, .has-over:focus-visible .over { opacity: 1; }
.has-over.is-open .over p, .has-over:focus-visible .over p { transform: none; }
@media (hover: hover) and (pointer: fine) { .has-over:hover .over { opacity: 1; } .has-over:hover .over p { transform: none; } }
.plus { position: absolute; top: 14px; right: 14px; z-index: 4; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--fg, var(--ink)) 12%, transparent); transition: transform 320ms var(--ease); }
.plus::before, .plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 2px; margin: -1px 0 0 -7px; background: var(--fg, var(--ink)); }
.plus::after { transform: rotate(90deg); }
.has-over.is-open .plus { transform: rotate(45deg); }
@media (hover: hover) and (pointer: fine) { .has-over:hover .plus { transform: rotate(45deg); } }

/* ---------- how it works: three steps ---------- */
.how { padding: clamp(48px, 7vw, 104px) 0; }
.kicker { font-size: 15px; font-weight: 500; color: var(--deep); margin-bottom: 20px; }
.how ol { list-style: none; display: grid; gap: var(--gap); }
.how li { border-top: 1.5px solid var(--ink); padding-top: 14px; display: grid; grid-template-columns: 64px 1fr; align-items: baseline; }
.how b { font: 400 44px/1 var(--voice); color: var(--deep); }
.how span { font-size: clamp(22px, 2.3vw, 34px); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
@media (min-width: 800px) {
  .how ol { grid-template-columns: repeat(3, 1fr); }
  .how li { grid-template-columns: 1fr; gap: 28px; padding-right: 24px; }
  .how b { font-size: 64px; }
}
.js .how li { opacity: 0; transform: translateY(18px); transition: opacity 420ms ease, transform 620ms var(--ease); }
.js .how.is-seen li { opacity: 1; transform: none; }
.js .how.is-seen li:nth-child(2) { transition-delay: 160ms; }
.js .how.is-seen li:nth-child(3) { transition-delay: 320ms; }

/* ---------- the two things said ---------- */
.talk { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 8%; }
.talk p { max-width: 70%; padding: 16px 26px 18px; border-radius: 30px; font: 400 clamp(22px, 3.6vw, 56px)/1.15 var(--voice); color: var(--ink); }
.talk .b1 { align-self: flex-start; background: var(--white); border-bottom-left-radius: 6px; transform-origin: bottom left; }
.talk .b2 { align-self: flex-end; background: var(--peach); border-bottom-right-radius: 6px; transform-origin: bottom right; }
.js .talk p { opacity: 0; transform: scale(0.88) translateY(14px); transition: opacity 300ms ease, transform 520ms var(--ease); }
.js .talk.is-seen p { opacity: 1; transform: none; }
.js .talk.is-seen .b2 { transition-delay: 700ms; }

/* ---------- the app, four screens drifting at different speeds ---------- */
.apps { overflow: hidden; background: var(--sand); padding: clamp(36px, 6vw, 96px) 0 clamp(28px, 4vw, 56px); }
.apps-track { display: flex; gap: 20px; padding: 0 20px; width: max-content; will-change: transform; }
.ph { margin: 0; width: 58vw; max-width: 300px; }
.ph img { width: 100%; height: auto; border-radius: clamp(22px, 2.4vw, 36px); border: 6px solid var(--ink); background: var(--cream); }
.ph figcaption { margin-top: 14px; font-size: 16px; font-weight: 500; color: var(--ink); text-align: center; }
@media (min-width: 800px) {
  .apps-track { width: auto; justify-content: center; gap: clamp(20px, 3vw, 56px); padding: 0 clamp(20px, 4vw, 72px); }
  .ph { flex: 1 1 0; width: auto; }
  .ph:nth-child(even) { margin-top: 72px; }
}

/* ---------- the large sentences ---------- */
.say { margin: clamp(56px, 9vw, 128px) 0; font-size: clamp(26px, 3.4vw, 48px); font-weight: 400; line-height: 1.14; letter-spacing: -0.025em; max-width: 17em; text-wrap: balance; }
.say span { transition: opacity 200ms linear; }
@media (min-width: 800px) { .say { margin-left: calc(50% + var(--gap) / 2); } }

/* ---------- the facts ---------- */
.spec { margin-top: clamp(56px, 9vw, 128px); border-top: 1px solid var(--ink-25); font-size: 16px; }
.spec div { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); padding: 11px 0; border-bottom: 1px solid var(--ink-25); }
.spec dt { color: var(--ink-70); }
@media (min-width: 800px) { .spec { margin-left: calc(50% + var(--gap) / 2); } .spec div { grid-template-columns: 180px 1fr; } }

/* ---------- final CTA ---------- */
.last { padding: clamp(72px, 12vw, 168px) 0 clamp(56px, 8vw, 112px); display: grid; gap: 36px; align-items: end; }
.last h2 { font-size: clamp(34px, 5.6vw, 80px); font-weight: 500; line-height: 1; letter-spacing: -0.035em; max-width: 12em; text-wrap: balance; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; }
@media (min-width: 900px) { .last { grid-template-columns: 1fr auto; gap: 48px; } }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--ink-25); padding: 20px 0 40px; font-size: 14px; color: var(--ink-70); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 28px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot nav a { padding: 6px 0; }

/* ---------- the sign-up popup ---------- */
.pop { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 28px 24px 24px; border: 0; border-radius: 24px; background: var(--cream); color: var(--ink); overflow: auto; }
.pop::backdrop { background: rgb(44 41 39 / 0.55); }
.pop[open] { animation: rise 260ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.pop h2 { font: 400 30px/1.1 var(--voice); padding-right: 40px; }
.pop .offer { margin-top: 6px; font-size: 16px; }
.pop label, .pop .lbl { display: block; margin: 18px 0 6px; font-size: 15px; font-weight: 500; }
.pop input[type="text"] { width: 100%; min-height: 52px; padding: 0 16px; border: 1.5px solid var(--ink-25); border-radius: 14px; background: var(--white); font: 400 17px/1 var(--text); color: var(--ink); }
.pop textarea { display: block; width: 100%; padding: 12px 16px; border: 1.5px solid var(--ink-25); border-radius: 14px; background: var(--white); font: 400 17px/1.4 var(--text); color: var(--ink); resize: vertical; }
.pop input[type="text"]:focus, .pop textarea:focus { outline: none; border-color: var(--ink); }
.pop input[aria-invalid="true"] { border-color: var(--red); }
.pop .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.ages { display: flex; flex-wrap: wrap; gap: 6px; }
.ages button { min-height: 44px; padding: 0 15px; border-radius: 12px; border: 1.5px solid var(--ink-25); background: var(--white); color: var(--ink); font: 500 15px/1 var(--text); cursor: pointer; touch-action: manipulation; }
.ages button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.pop-err { min-height: 22px; margin: 10px 0 4px; font-size: 15px; font-weight: 500; color: var(--red); }
.pop .btn { width: 100%; }
.pop-x { position: absolute; top: 14px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 8%, transparent); cursor: pointer; }
.pop-x::before, .pop-x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; margin: -1px 0 0 -8px; background: var(--ink); transform: rotate(45deg); }
.pop-x::after { transform: rotate(-45deg); }
.pop-done { display: none; text-align: center; padding: 12px 0 0; }
.pop-done img { margin: 0 auto 12px; }
.pop-done p { margin: 8px 0 22px; }
.pop.is-done .pop-form { display: none; }
.pop.is-done .pop-done { display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pop[open] { animation: none; }
  .js .talk p, .js .how li, .over, .over p, .plus, .btn { transition: none; }
}

/* the header on a phone: the button keeps to one line */
.btn-sm { white-space: nowrap; }
@media (max-width: 480px) { .head nav { gap: 10px; font-size: 15px; } .btn-sm { font-size: 16px; padding: 6px 12px; min-height: 40px; } .head .logo img { height: 24px; } }
