/* Special Gothic, the app's typeface (SIL Open Font License, see fonts/). One
   variable file: weight and width are set on its axes, as the app does. */
@font-face {
  font-family: "Special Gothic";
  src: url("/fonts/SpecialGothic.ttf") format("truetype-variations"), url("/fonts/SpecialGothic.ttf") format("truetype");
  font-weight: 100 900;
  font-stretch: 75% 125%;
  font-display: swap;
}

/* Mirrors Tokens.Palette in the app. */
:root {
  color-scheme: light dark;
  --background: #FAFAF3;
  --surface: #F0F0E9;
  --surface-raised: #E6E6DF;
  --border: #E6E6DF;
  --text-primary: #1F1F1F;
  --text-secondary: #5E5E5A;
  --text-tertiary: #7A7A75;
  --inverted: #1F1F1F;
  --text-on-inverted: #FAFAF3;
  --hibiscus: #F7775D;
  --negative: #F25555;
  /* The holo button: reversed on the light background, softer glow. */
  --holo-base: #1F1F1F;
  --holo-label: #FAFAF3;
  --holo-glow: rgba(247, 119, 93, 0.6);
  --holo-edge: rgba(255, 255, 255, 0.14);
  --holo-sheen: rgba(255, 255, 255, 0.04);

  /* Type, from FMType: labels and paragraphs at weight 420, width 102 with
     1.7% letter spacing; titles at 500, width 100, no spacing. */
  --label-weight: 420;
  --label-width: 102%;
  --label-tracking: 0.017em;
  --title-weight: 500;
  --title-width: 100%;

  /* Presses: PressConfig in Tuning.swift (scale 0.96, spring 0.28 / 0.62),
     sampled into linear() by tools/springs.mjs. */
  --press-scale: 0.96;
  --press-duration: 557ms;
  --press-ease: linear(0, 0.0449, 0.1635, 0.3009, 0.4478, 0.607, 0.7331, 0.8396, 0.9337, 0.9949, 1.0372, 1.0656, 1.0773, 1.0792, 1.0739, 1.0648, 1.0521, 1.0405, 1.0294, 1.0185, 1.0106, 1.0043, 0.9992, 0.9963, 0.9945, 0.9937, 0.9937, 0.9942, 0.9951, 0.996, 0.9971, 0.9979, 0.9986, 0.9993, 0.9998, 1.0001, 1.0003, 1.0005, 1.0005, 1.0005, 1);

  /* The primary (holo) button's own press: HoloConfig (scale 0.95, spring
     0.3 / 0.58). */
  --holo-press-scale: 0.95;
  --holo-press-duration: 685ms;
  --holo-press-ease: linear(0, 0.0589, 0.2086, 0.3804, 0.5565, 0.7177, 0.8646, 0.9657, 1.036, 1.0788, 1.1003, 1.1024, 1.0934, 1.0764, 1.0582, 1.0404, 1.0245, 1.0104, 1.001, 0.9947, 0.9908, 0.9894, 0.9896, 0.9908, 0.9927, 0.9946, 0.9964, 0.9979, 0.9993, 1.0001, 1.0007, 1.001, 1.0011, 1.001, 1.0009, 1.0007, 1.0005, 1.0003, 1.0002, 1, 1);

  /* Pressing in: quick and decisive (releases spring back with the app's
     press springs). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --press-in: 120ms;

  /* Fades in: MotionConfig.enter (0.35 / 0.95). */
  --enter-duration: 535ms;
  --enter-ease: linear(0, 0.0282, 0.0913, 0.1735, 0.2637, 0.3546, 0.4419, 0.5226, 0.5956, 0.6602, 0.7166, 0.7652, 0.8066, 0.8416, 0.871, 0.8954, 0.9156, 0.9322, 0.9458, 0.9568, 0.9657, 0.9737, 0.9793, 0.9838, 0.9874, 0.9902, 0.9925, 0.9942, 0.9956, 0.9966, 0.9975, 0.9981, 0.9986, 0.9989, 0.9992, 0.9994, 0.9996, 0.9997, 0.9998, 0.9999, 1);

  --radius-button: 16px;
  --radius-card: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --background: #1F1F1F;
    --surface: #292929;
    --surface-raised: #333333;
    --border: #333333;
    --text-primary: #FFFFFF;
    --text-secondary: #B8B8B8;
    --text-tertiary: #9A9A9A;
    --inverted: #FAFAF3;
    --text-on-inverted: #1F1F1F;
    --holo-base: #FAFAF3;
    --holo-label: #1F1F1F;
    --holo-glow: rgba(247, 119, 93, 0.9);
    --holo-edge: rgba(255, 255, 255, 0.55);
    --holo-sheen: rgba(255, 255, 255, 0.12);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--text-primary);
}

body {
  font-family: "Special Gothic", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-weight: var(--label-weight);
  font-stretch: var(--label-width);
  letter-spacing: var(--label-tracking);
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

main {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: max(48px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* On larger screens the actions stay with the text, all centered. */
@media (min-width: 640px) and (min-height: 600px) {
  main { justify-content: center; gap: 40px; }
  main > .hero { flex: 0; padding-bottom: 0; }
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 4px 32px;
  text-align: center;
}

a.home { display: inline-flex; border-radius: 22.5%; }
a.home:focus-visible { outline: 2.5px solid var(--text-primary); outline-offset: 3px; }
.icon {
  width: 72px;
  height: 72px;
  border-radius: 22.5%;
  margin-bottom: 8px;
}

/* "You met in the middle.": the quiet line above a title. */
.eyebrow {
  margin: 0 0 -4px;
  font-size: 16px;
  color: var(--text-secondary);
}

h1 {
  margin: 0;
  font-weight: var(--title-weight);
  font-stretch: var(--title-width);
  letter-spacing: 0;
  font-size: 32px;
  line-height: 1.08;
  text-wrap: balance;
}

.lede {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Buttons: 60 tall, 16 corners, 20pt label, like the app's full-width ones. */
.button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-button);
  font: inherit;
  font-size: 18px;
  letter-spacing: var(--label-tracking);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 180ms ease, transform var(--press-duration) var(--press-ease);
  -webkit-tap-highlight-color: transparent;
}
.button:active { transform: scale(var(--press-scale)); transition: opacity 180ms ease, transform var(--press-in) var(--ease-out); }
.button:focus-visible { outline: 2.5px solid var(--text-primary); outline-offset: 3px; }
.button:disabled { opacity: 0.45; cursor: default; transform: none; }

/* The holo primary: cream with the coral glow on its right (ink in light mode). */
.button.primary {
  color: var(--holo-label);
  background:
    radial-gradient(70% 220% at 95% 60%, var(--holo-glow), transparent 100%),
    linear-gradient(100deg, transparent 40%, var(--holo-sheen) 55%, transparent 70%),
    var(--holo-base);
}
/* With WebGL, holo.js paints the surface (Holo.metal) on a canvas under the
   label; the gradient above is the fallback. The edge highlight sits on top. */
.button.primary {
  isolation: isolate;
  transition: opacity 180ms ease, transform var(--holo-press-duration) var(--holo-press-ease);
}
.button.primary:active { transform: scale(var(--holo-press-scale)); transition: opacity 180ms ease, transform var(--press-in) var(--ease-out); }
.holo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  z-index: -1;
  pointer-events: none;
}
.button.primary:not(.has-holo)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--holo-edge);
  pointer-events: none;
}
.button.primary .label { display: inline-block; }
.button.primary:disabled .holo-canvas { filter: saturate(0); }
/* Saving: the app's WorkingIndicator (a 24px ring, 28% arc, 2.5px round
   stroke, one turn every 0.9s) in the label's color, the label faded out.
   A loading button stays at full strength (it's busy, not unavailable). */
.button .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.button .spinner svg { width: 100%; height: 100%; animation: spin 0.9s linear infinite; }
.button .spinner circle { fill: none; stroke: currentColor; stroke-width: 2.5; }
.button .spinner-track { opacity: 0.2; }
.button .spinner-arc { stroke-linecap: round; stroke-dasharray: 18.91 67.54; transform: rotate(-90deg); transform-origin: center; }
.button .label { transition: opacity 150ms ease; }
.button.loading .label { opacity: 0; }
.button.loading .spinner { opacity: 1; }
.button.loading:disabled { opacity: 1; cursor: progress; }
.button.loading:disabled .holo-canvas { filter: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The secondary: the surface, a little lighter on press. */
.button.secondary { background: var(--surface); color: var(--text-primary); }
.button.secondary:active { background: var(--surface-raised); }

/* The outline button ("Explore with sample data"). */
.button.outline {
  width: auto;
  align-self: center;
  min-height: 52px;
  padding: 0 32px;
  font-size: 17px;
  background: transparent;
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1.5px var(--border);
}

.note {
  margin: 0;
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  text-wrap: pretty;
}
.note a { color: var(--text-primary); text-underline-offset: 3px; }

/* Fields: the onboarding cards' surface, as tall as the buttons, same text size. */
.field { display: flex; flex-direction: column; gap: 12px; text-align: left; }
/* Every label sits the same 12px above its field (inputs and chips alike). */
.field > label, .field-label {
  margin: 0;
  text-wrap: balance; /* a long label splits evenly, no lone word */
  padding: 0 4px;
  font-size: 16px;
  color: var(--text-secondary);
}
.field .optional { color: var(--text-tertiary); }
/* Dropdown: a field with a chevron, the system's own picker when tapped. */
.select { position: relative; }
.select-chevron {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* A question with its answer at the end of the row (like a settings
   switch), and a compact dropdown for it. */
.row-control { display: flex; align-items: center; gap: 16px; }
.field .row-control > label { flex: 1; padding: 0 0 0 4px; font-size: 16px; line-height: 1.4; color: var(--text-secondary); }
.select-compact { flex: none; }
.select-compact select {
  width: 128px; /* fits "Solo a mí", so the row doesn't shift between answers */
  min-height: 44px;
  padding: 0 34px 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 16px;
  letter-spacing: var(--label-tracking);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 0 0 2.5px transparent;
}
.select-compact select:focus { outline: none; }
.select-compact select:focus-visible { box-shadow: inset 0 0 0 2.5px var(--text-primary); }
@media (hover: hover) and (pointer: fine) {
  .select-compact select:hover { background: var(--surface-raised); }
}
.select-compact .select-chevron { right: 12px; width: 14px; height: 14px; margin-top: -7px; }

/* A hint under a field, a little closer to it than the next label. 14px,
   asked for (below the 16px floor, like the spots tag). */
.field-help { margin: -4px 0 0; padding: 0 4px; font-size: 14px; line-height: 1.4; color: var(--text-tertiary); }

.input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-button);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 18px;
  letter-spacing: var(--label-tracking);
  box-shadow: inset 0 0 0 2.5px transparent;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--text-tertiary); opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .input:hover { background: var(--surface-raised); }
}
.input:focus { outline: none; background: var(--surface); box-shadow: inset 0 0 0 2.5px var(--text-primary); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 2.5px var(--negative); }
.input:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 60px var(--surface) inset;
  caret-color: var(--text-primary);
}

/* Choice chips: surface pills, the pick in the inverted fill. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 16px;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform var(--press-duration) var(--press-ease);
  -webkit-tap-highlight-color: transparent;
}
.chip span:active { transform: scale(var(--press-scale)); transition: background 180ms ease, color 180ms ease, transform var(--press-in) var(--ease-out); }
.chip input:checked + span { background: var(--inverted); color: var(--text-on-inverted); }
.chip input:checked:focus-visible + span { box-shadow: inset 0 0 0 2.5px var(--hibiscus); }
.chip input:focus-visible + span { box-shadow: inset 0 0 0 2.5px var(--text-primary); }

.error {
  margin: 0;
  padding: 0 4px;
  font-size: 16px;
  color: var(--negative);
}

/* Off-screen for people, still there for bots that fill every field. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Spots left: a small tag above the avatars (10px corners on a ~30px tag:
   round, but still a tag, not a pill). It keeps its place while the
   count loads, then fades in on the enter spring. */
.tag {
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  /* Smaller than the site's 16px floor on purpose (asked for), a step
     heavier than labels (420 + 50) so it stays readable. */
  font-size: 14px;
  font-weight: calc(var(--label-weight) + 50);
  line-height: 1.25;
  font-variant-numeric: proportional-nums;
  opacity: 0;
  transition: opacity var(--enter-duration) var(--enter-ease);
}
.tag.loaded { opacity: 1; }

/* Avatars (AvatarArt in the app): an initial on a member color, in one of
   four shapes. The pair overlaps by 28%: you tilted -6°, them +6° and 6px
   lower, with a ring of the page color so they sit in front. */
.pair { display: flex; justify-content: center; align-items: flex-start; margin-bottom: 8px; }
.avatar {
  --side: 84px;
  position: relative;
  width: var(--side);
  height: var(--side);
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--press-duration) var(--press-ease);
}
.avatar:active { transform: scale(var(--press-scale)); transition: transform var(--press-in) var(--ease-out); }
.avatar:focus-visible { outline: none; }
.avatar:focus-visible .avatar-shape { stroke: var(--text-primary); }
.avatar-them { margin-left: calc(var(--side) * -0.28); z-index: 1; }
.avatar-pop, .avatar-tilt, .avatar-body { display: block; width: 100%; height: 100%; }
.avatar-me .avatar-tilt { transform: rotate(-6deg); }
.avatar-them .avatar-tilt { transform: translateY(6px) rotate(6deg); }
.avatar-body { position: relative; }
.avatar svg { position: absolute; inset: -8%; width: 116%; height: 116%; overflow: visible; }
.avatar-shape {
  fill: var(--avatar-fill, #FFDEB0);
  transform-box: fill-box;
  transform-origin: center;
  transition: fill 250ms ease, stroke 150ms ease;
  stroke: transparent;
  stroke-width: 3;
}
/* Their ring: the page color, around their shape. */
.avatar-them .avatar-shape { stroke: var(--background); stroke-width: 9.5; paint-order: stroke; }
.avatar-them:focus-visible .avatar-shape { stroke: var(--text-primary); }
.avatar-letter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--side) * 0.45);
  line-height: 1;
  letter-spacing: 0;
  color: var(--avatar-ink, #E0451F);
  transition: color 250ms ease;
  pointer-events: none;
}
/* On the confirmation: room between the (tilted, offset) pair and its text. */
.pair-slot { margin-bottom: 20px; }
.pair-slot .pair { margin-bottom: 0; }
.pair-slot .avatar { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .avatar, .avatar:active { transition: none; transform: none; }
}

[hidden] { display: none !important; }

/* Entrances rise 8px as they fade in (the enter spring). Backwards fill only,
   so nothing pins the transform afterwards (the FLIP springs need it). */
.fade { animation: fade var(--enter-duration) var(--enter-ease) backwards; }
.fade.later { animation-delay: 40ms; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-only { from { opacity: 0; } to { opacity: 1; } }
/* Reduced motion: still fade, never move. */
@media (prefers-reduced-motion: reduce) {
  .fade { animation-name: fade-only; }
  .button, .chip span, .button:active, .chip span:active { transition: none; }
  .button:active, .button.primary:active, .chip span:active { transform: none; }
}
