@font-face { font-family: Poppins; font-weight: 400; font-display: swap; src: url('/assets/poppins-400.ttf') format('truetype'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; src: url('/assets/poppins-500.ttf') format('truetype'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; src: url('/assets/poppins-600.ttf') format('truetype'); }

:root {
  color-scheme: light dark;
  --tile: clamp(6.25rem, 13.4vh, 7.375rem); /* the mosaic's unit: the panel is 4 tiles wide */
  --row: max(3.625rem, calc(var(--tile) * 0.56));
  --text: max(1rem, calc(var(--tile) * 0.142));
  --ground: #e8f0fa;
  --panel: #ffffff;
  --ink: #153a6a;
  --soft: #55698a;
  --well: #ebf1fa;
  --well-hover: #dfe9f7;
  --brand: #2d73c8;
  --brand-hover: #2864af;
  --on-brand: #ffffff;
  --accent: #2d73c8; /* blue as text */
  --danger: #c32a23;
  --leaf: 0.25rem 1.75rem 0.25rem 1.75rem;
  --leaf-turned: 1.75rem 0.25rem 1.75rem 0.25rem;
  --spring: cubic-bezier(0.3, 1.5, 0.5, 1);
  --out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0a192f;
    --panel: #132c50;
    --ink: #eaf2ff;
    --soft: #a9bcd9;
    --well: #1c3a63;
    --well-hover: #234574;
    --brand: #3f86dc;
    --brand-hover: #5a9bea;
    --on-brand: #04101f;
    --accent: #86b7f3;
    --danger: #ff9a93;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--ground); }
body { position: relative; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0; color: var(--ink); font: 400 0.9375rem/1.5 Poppins, system-ui, sans-serif; overflow-x: hidden; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
#birds { z-index: 2; pointer-events: none; }

/* The panel is one big leaf tile of the mosaic. */
main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: calc(4 * var(--tile));
  min-height: calc(5 * var(--tile));
  margin: auto;
  padding: 2.5rem calc(var(--tile) * 0.44);
  border-radius: 0 var(--tile) 0 var(--tile);
  background: var(--panel);
}
body::before { content: ''; flex: none; height: 5.25rem; } /* room for the chick above the panel */
body::after { content: ''; flex: none; height: clamp(1.5rem, 100vh - 5 * var(--tile) - 5.25rem, 5.25rem); }

.logo { display: block; width: max(11.5rem, calc(var(--tile) * 1.85)); height: auto; margin: 0 auto max(1.75rem, calc(var(--tile) * 0.32)); }
section { animation: enter 0.45s var(--out); }
@keyframes enter { from { opacity: 0; transform: translateY(0.75rem); } }

h1:focus { outline: none; }
h1 { margin: 0 0 1.125rem; font-size: calc(var(--text) * 1.4); font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; text-align: center; }
form { display: grid; gap: 0.875rem; }

.field { position: relative; }
.field input {
  width: 100%;
  height: var(--row);
  padding: calc(var(--row) * 0.36) 1.375rem 0;
  border: 2px solid transparent;
  border-radius: var(--leaf);
  background: var(--well);
  color: var(--ink);
  font: 500 var(--text)/1.2 Poppins, system-ui, sans-serif;
  outline: none;
  transition: background 0.2s, border-color 0.2s, border-radius 0.45s var(--spring);
}
.field input:hover { background: var(--well-hover); }
.field input:focus { border-color: var(--accent); border-radius: var(--leaf-turned); background: var(--panel); }
.field input[aria-invalid='true'] { border-color: var(--danger); }
.field input::placeholder { color: transparent; }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 100px var(--well) inset; }
.field input[data-secret] { padding-right: 3.5rem; }
.field label { position: absolute; top: 50%; left: 1.5rem; color: var(--soft); font-size: var(--text); pointer-events: none; transform: translateY(-50%); transform-origin: 0 50%; transition: transform 0.28s var(--spring), color 0.2s; }
.field.filled label,
.field input:focus + label,
.field input:not(:placeholder-shown) + label { transform: translateY(calc(var(--row) * -0.39)) scale(0.78); }
.field input:-webkit-autofill + label { transform: translateY(calc(var(--row) * -0.39)) scale(0.78); }
.field input:autofill + label { transform: translateY(calc(var(--row) * -0.39)) scale(0.78); }
.field input:focus + label { color: var(--accent); }

.reveal { position: absolute; top: 50%; right: 0.5rem; width: 2.75rem; height: 2.75rem; padding: 0.625rem; border: 0; border-radius: 50%; background: transparent; color: var(--soft); cursor: pointer; transform: translateY(-50%); transition: color 0.2s; }
.reveal:hover { color: var(--accent); }
.reveal svg { display: block; width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.reveal .slash { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.25s var(--out); }
.reveal.shown .slash { stroke-dashoffset: 1; }
.reveal.shown .lid { animation: blink 0.35s; transform-origin: center; }
@keyframes blink { 50% { transform: scaleY(0.2); } }

/* The button turns into an egg while the answer is on its way. */
.nest { display: grid; place-items: center; height: var(--row); margin-top: 0.25rem; }
.go {
  position: relative;
  width: 100%;
  height: var(--row);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--leaf);
  background: var(--brand);
  color: var(--on-brand);
  font: 600 var(--text)/1 Poppins, system-ui, sans-serif;
  cursor: pointer;
  transition: width 0.45s var(--out), height 0.45s var(--out), border-radius 0.45s var(--out), background 0.2s, transform 0.15s var(--out);
}
.go:hover { border-radius: var(--leaf-turned); background: var(--brand-hover); }
.go:active { transform: scale(0.98); }
.go span { display: block; white-space: nowrap; transition: opacity 0.15s; }
.crack { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--on-brand); stroke-width: 2.5; stroke-linejoin: round; opacity: 0; }
.crack path { stroke-dasharray: 1; stroke-dashoffset: 1; }
[aria-busy='true'] .go { width: calc(var(--row) * 0.79); height: var(--row); border-radius: 50% / 60% 60% 40% 40%; cursor: progress; animation: wobble 0.9s 0.4s ease-in-out infinite; transform-origin: 50% 90%; }
[aria-busy='true'] .go span { opacity: 0; }
[aria-busy='true'] .crack { opacity: 1; }
[aria-busy='true'] .crack path { animation: crack 3s 0.5s var(--out) forwards; }
@keyframes wobble { 0%, 50%, 100% { transform: rotate(0); } 12%, 32% { transform: rotate(-11deg); } 22%, 42% { transform: rotate(11deg); } }
@keyframes crack { to { stroke-dashoffset: 0; } }

.quiet { display: table; border: 0; background: none; cursor: pointer; font-family: inherit; font-size: inherit; line-height: inherit; margin: 1.25rem auto 0; padding: 0.375rem 0.75rem; border-radius: 0.25rem 0.875rem 0.25rem 0.875rem; color: var(--soft); font-weight: 500; text-decoration: none; transition: color 0.2s, background 0.2s; }
.quiet:hover { background: var(--well); color: var(--accent); }
.error, .note, .message { margin: 0; overflow-wrap: anywhere; }
.error { color: var(--danger); font-size: 0.875rem; }
.error:empty { display: none; }
.note { margin-bottom: 1rem; }
.note, .message { padding: 1rem 1.25rem; border-radius: var(--leaf); background: var(--well); text-align: center; }

nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 0.75rem; margin-bottom: 1rem; }
.product { color: var(--ink); font-weight: 600; text-align: center; text-decoration: none; }
.product svg { display: block; width: 100%; margin-bottom: 0.625rem; border-radius: 0.25rem 2.5rem 0.25rem 2.5rem; transition: border-radius 0.45s var(--spring); }
.product:hover svg, .product:focus-visible svg { border-radius: 2.5rem 0.25rem 2.5rem 0.25rem; }
.product .bob, .product .turn { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 0.5s var(--spring); }
.product:hover .bob, .product:focus-visible .bob { transform: translateY(-9px) rotate(-4deg); }
.product:hover .turn { transform: scale(1.06); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.field input:focus-visible { outline: none; }
.hidden-text { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 40rem) {
  :root { --tile: 25vw; --row: 3.75rem; --text: 1rem; }
  body::before { height: max(5.25rem, min(1.5 * var(--tile), 20vh)); }
  body::after { display: none; }
  main { flex: 1; justify-content: flex-start; width: 100%; min-height: 0; margin: 0; padding: 2.5rem max(1.25rem, 7vw) 2rem; border-radius: 0 var(--tile) 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
  [aria-busy='true'] .go { width: 100%; border-radius: var(--leaf); opacity: 0.75; }
  [aria-busy='true'] .go span { opacity: 1; }
  [aria-busy='true'] .crack { opacity: 0; }
}
