/*
 * Orbit: tokens first, then each surface in the order it appears (the intro, its glass menus, the giver's steps),
 * then the fold and embedded states.
 */

/* ---------- tokens ---------- */

:root {
  --bg: #efeae0;
  --ink: #161513;

  /* one glass material (the intro's menus darken it) */
  /* frosty enough that grey words stay readable over night ground and black space (4.5:1 or better) */
  --panel: linear-gradient(180deg, rgba(252, 250, 246, 0.86), rgba(246, 243, 236, 0.8));
  --edge: rgba(255, 255, 255, 0.72);
  --hi: rgba(255, 255, 255, 0.95);
  --drop: rgba(40, 30, 10, 0.38);

  --sans: 'Manrope', system-ui, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  /* eases: out for moves; snap for quick feedback (presses, menus; EASE_SNAP in motion.js) */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-snap: cubic-bezier(0.23, 1, 0.32, 1);
}

/* ---------- base ---------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* selected text: a light red behind dark words; near-black behind light words (intro, dark menus) */
::selection {
  background: #ffc9c0;
  color: var(--ink);
}

.intro ::selection,
.menu.dark ::selection {
  background: #0c0d10;
  color: #fff;
}

/* keyboard focus: a soft ring of light, never the browser's default */
button:focus-visible,
a:focus-visible {
  outline: 1.5px solid rgba(150, 185, 255, 0.75);
  outline-offset: 3px;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* a phone's visible height, its toolbars showing or not */
  overflow: clip; /* never a scroll container: focusing a field must not move the page */
  /* light in the middle, deepening a little toward the edges, so the globe's glow has room to read */
  background: radial-gradient(1200px 860px at 50% 42%, #f7f4ee 0%, var(--bg) 55%, #e2dccf 100%);
  transition: background 1.2s;
}

.stage.folded {
  background: #06080c;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* the globe's canvas stands above the page's twilight tint */
.globe {
  position: relative;
}

.globe:not(.textured) {
  visibility: hidden; /* until the Earth's colour map and clouds are in (globe.js) */
}

/* near the day/night line, the page leans toward the hour's light: deeper toward the edges */
.twilight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.twilight.dusk {
  background: radial-gradient(1200px 860px at 50% 42%, rgba(250, 214, 180, 0.35) 0%, rgba(240, 188, 160, 0.6) 55%,
    rgba(222, 160, 150, 0.85) 100%);
}

.twilight.dawn {
  background: radial-gradient(1200px 860px at 50% 42%, rgba(240, 214, 230, 0.35) 0%, rgba(222, 196, 226, 0.6) 55%,
    rgba(190, 196, 232, 0.85) 100%);
}

.stage.folded .twilight {
  display: none;
}

/* ride along's plane, drawn above the globe (plane-layer.js) */
.plane-layer {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  pointer-events: none;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: rgba(243, 239, 230, 0.75); /* on the dark page before the globe arrives */
  pointer-events: none;
}

/* ---------- intro ---------- */

.intro {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  text-align: center;
  background: radial-gradient(
    ellipse 62% 70% at 50% 58%,
    rgba(6, 8, 12, 0) 0%,
    rgba(6, 8, 12, 0.35) 45%,
    rgba(6, 8, 12, 0.92) 78%,
    #06080c 100%
  );
  transition: opacity 2.6s ease, visibility 2.6s;
}

.intro.gone {
  opacity: 0;
  visibility: hidden;
}

/* the title cycles through languages; each phrase breathes in and out of a soft blur as one piece */
.title {
  display: grid;
  place-items: center;
  height: 110px;
  margin: 0 0 38px;
  font: italic 400 76px/1 var(--serif);
  letter-spacing: -0.01em;
  color: #f3efe6;
  /* a soft dark halo: readable over bright ice and cloud (3:1 or better) */
  text-shadow:
    0 0 3px rgba(6, 8, 12, 0.5),
    0 0 16px rgba(6, 8, 12, 0.55),
    0 2px 30px rgba(0, 0, 0, 0.6);
}

.title .phrase {
  grid-area: 1 / 1;
  white-space: nowrap;
  will-change: transform, filter, opacity;
  backface-visibility: hidden;
}

.title .phrase:lang(zh) {
  font: 400 62px/1 'Noto Serif SC', serif;
  letter-spacing: 0.08em;
}

.title .phrase:lang(ja) {
  font: 400 62px/1 'Noto Serif JP', serif;
  letter-spacing: 0.06em;
}

.title .phrase:lang(el) {
  font: italic 400 70px/1 'Noto Serif Display', serif;
}

.title .phrase:lang(ar) {
  font: 400 68px/1.35 'Amiri', serif;
  letter-spacing: 0;
}

/* Begin: a glass pill with a point of light orbiting its edge (.orb carries the glow, its ::before is the ring) */
@property --orb {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

@keyframes orb {
  to {
    --orb: 360deg;
  }
}

.begin {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  padding: 0 38px;
  border: 0;
  border-radius: 999px;
  color: #f3efe6;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    inset 0 -14px 24px -16px rgba(110, 160, 230, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 24px 60px -22px rgba(90, 140, 230, 0.6);
  transition:
    transform 0.6s var(--ease-out),
    box-shadow 0.6s,
    color 0.5s ease;
}

/* hover looks only for a pointer that hovers: a tap on a phone left them on (sticky) */
@media (hover: hover) {
  .begin:hover {
    transform: translateY(-2px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.4),
      inset 0 -14px 24px -14px rgba(110, 160, 230, 0.7),
      0 0 0 1px rgba(255, 255, 255, 0.18),
      0 30px 70px -20px rgba(90, 140, 230, 0.8);
  }
}

.begin:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.15s;
}

/* the orbiting light arrives once both ends of the trip are chosen */
.begin:not(.ready) {
  color: rgba(243, 239, 230, 0.72);
}

.begin .orb {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 7px rgba(170, 200, 255, 0.7));
}

.begin.ready .orb {
  opacity: 1;
}

.begin .orb::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.6px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--orb),
    transparent 0 52%,
    rgba(190, 215, 255, 0.35) 64%,
    #fff 76%,
    transparent 84%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: orb 7s linear infinite;
}

/* the answer: where from, where to; the same glass as Begin */
.ask {
  display: flex;
  align-items: center;
  padding: 7px;
  border-radius: 999px;
  /* darker, deeper glass than Begin alone, so the words hold up when bright globe passes behind */
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, rgba(10, 13, 19, 0.5), rgba(10, 13, 19, 0.42));
  backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  -webkit-backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 24px 60px -22px rgba(90, 140, 230, 0.5);
}

/*
 * Fixed-width fields, so typing never moves the row; each city is set against its arrow. The
 * highlight (.hug) is drawn around the words only, in the stop chip's proportions (36 px tall, 15 px
 * either side of the text), 20 px from the arrow, like every chip in the row. JS sets --hug to the
 * text's width.
 */
.slot {
  --inset: 29px; /* the city's text to the slot's edge on the arrow side: 20 px of air + the 15 px inset - 6 */
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  width: 176px; /* the longest city, "Washington DC", fits */
  height: 50px;
  padding: 0 var(--inset) 0 18px;
  text-align: left;
  cursor: text;
}

.slot.to {
  padding: 0 18px 0 var(--inset);
}

.hug {
  position: absolute;
  top: 7px;
  right: calc(var(--inset) - 15px);
  width: calc(var(--hug, 0px) + 30px);
  height: 36px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  transition:
    opacity 0.3s,
    width 0.18s var(--ease-out);
}

.slot.to .hug {
  right: auto;
  left: calc(var(--inset) - 15px);
}

.slot:focus-within .hug {
  opacity: 1;
}

.slot input {
  position: relative; /* above its highlight */
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: 600 17px/1.2 var(--sans);
  color: #f3efe6;
  caret-color: #cfe0ff;
}

#from {
  text-align: right;
}

.slot input::placeholder {
  color: rgba(243, 239, 230, 0.6);
  font-weight: 500;
}

/* how the chosen trip connects, once both ends are picked */
.route-note {
  min-height: 21px;
  margin: 20px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: #f3efe6;
  /* it sits on the globe itself: a soft dark halo keeps it readable over bright land and ice */
  text-shadow:
    0 0 2px rgba(6, 8, 12, 0.85),
    0 0 6px rgba(6, 8, 12, 0.75),
    0 1px 16px rgba(6, 8, 12, 0.9);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.route-note.on {
  opacity: 1;
}

/* when they leave: the day and the departure, under the route once both cities are chosen */
.when {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 36px;
  margin-top: 14px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0s 0.4s;
}

.when.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease;
}

.when-lead {
  margin-right: 2px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(243, 239, 230, 0.66);
  text-shadow:
    0 0 2px rgba(6, 8, 12, 0.85),
    0 0 6px rgba(6, 8, 12, 0.75),
    0 1px 16px rgba(6, 8, 12, 0.9);
}

/* the stops' glass, with a small chevron: each opens its choices */
.when-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 32px 0 16px;
  border: 0;
  border-radius: 999px;
  white-space: nowrap;
  font: 650 15px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  color: #f3efe6;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s var(--ease-snap);
}

/* hover looks only for a pointer that hovers: a tap on a phone left them on (sticky) */
@media (hover: hover) {
  .when-chip:hover {
    background: rgba(255, 255, 255, 0.16);
  }
}

.when-chip:focus-visible,
.when-chip:has(input:focus-visible) {
  outline: 2px solid rgba(170, 200, 255, 0.8);
  outline-offset: 2px;
}

.when-chip::after {
  content: '';
  position: absolute;
  right: 15px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid rgba(243, 239, 230, 0.72);
  border-bottom: 1.5px solid rgba(243, 239, 230, 0.72);
  transform: rotate(45deg);
}

.when-chip small {
  font-size: 13px;
  font-weight: 500;
  color: rgba(243, 239, 230, 0.7);
}

/* the calendar's field sits under its chip, which opens it (showPicker); on a touch screen it takes the tap
   itself, unseen over the chip, since iOS Safari's showPicker opens nothing for a field that can't be touched */
.when-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  color-scheme: dark;
}

@media (hover: none) and (pointer: coarse) {
  .when-chip input {
    appearance: none;
    pointer-events: auto;
  }
}

/* the departures: the time and when it lands (local); never an airline */
.menu li .time {
  font-size: 15px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.menu.dark li .time {
  color: #f3efe6;
}

.menu li:has(.time) {
  grid-template-columns: 58px 1fr;
}

.menu.dark li:has(.time) span {
  color: rgba(243, 239, 230, 0.66);
}

.route-note b {
  font-weight: 700;
  color: #f3efe6;
}

/* the stops, in the row between the two cities */
/* about the same air on each side of every arrow: city text, chip edge or + ; only this part of
   the row grows or shrinks (smoothly, as stops come and go), so Begin stays at the right end */
.via {
  flex: none;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 6px;
  overflow: clip;
  overflow-clip-margin: 8px;
}

.ask-arrow {
  flex: none;
  width: 18px;
  height: 10px;
  fill: none;
  stroke: rgba(243, 239, 230, 0.45);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ask .begin {
  flex: none;
  height: 50px;
  margin-left: 8px;
  padding: 0 28px;
  white-space: nowrap;
}

/* ---------- glass, the one panel material (the intro's menus are a dark weight of it) ---------- */

.glass {
  background: var(--panel);
  backdrop-filter: blur(30px) saturate(1.5) brightness(1.4);
  -webkit-backdrop-filter: blur(30px) saturate(1.5) brightness(1.4);
  border: 1px solid var(--edge);
  border-radius: 26px;
  box-shadow:
    inset 0 1px 0 var(--hi),
    0 1px 2px rgba(22, 21, 19, 0.05),
    0 30px 70px -34px var(--drop);
}

/* ---------- menus: choices under whatever opened them ---------- */

.menu {
  position: absolute;
  z-index: 8;
  min-width: 260px;
  max-width: 320px;
  padding: 8px;
  border-radius: 20px;
  transform-origin: 24px top;
  animation: menu-in 0.2s var(--ease-snap) both;
}

/* menus grow from what opened them: quick, no bounce */
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.96);
  }
}

.menu ul {
  position: relative;
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  overscroll-behavior: contain;
}

.menu li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14.5px;
  cursor: pointer;
}

/* every press answers at once: a slight give, released quickly */
.menu li:active {
  transform: scale(0.97);
  transition: transform 0.1s ease-out;
}

.menu li b {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.menu li.hi {
  background: rgba(255, 255, 255, 0.72);
}

.menu li.on span::after {
  content: ' ✓';
  color: #2457d6;
}

/* on the intro the menu is dark glass, like the night around it */
.menu.dark {
  z-index: 25;
  background: rgba(20, 24, 32, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 20px 40px -20px rgba(0, 0, 0, 0.8);
  color: #f3efe6;
}

.menu.dark li b {
  color: rgba(243, 239, 230, 0.6);
}

.menu.dark li.hi {
  background: rgba(255, 255, 255, 0.1);
}

.menu.dark li.on span::after {
  color: #9dbbff;
}

/* ?embed=1 (embed.js): inside a host page only the globe and the flight show; the host frames the view */
.embedded .intro > div,
.embedded .loading {
  display: none;
}

/* ?still=1: no transitions, so a capture shows the settled state */
.still *,
.still *::before,
.still *::after {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .begin .orb::before {
    animation: none;
  }
}

/* ===================== small windows (below 1020 × 640) ===================== */

/* the intro's title and row alone scale down, so the row fits (layout.js) */
.intro > div {
  zoom: var(--intro-zoom, 1);
}

/* ---------- the gift giver's steps: where, the card, the link (src/send/steps.js) ---------- */

/* the steps share one place over the globe; one shows at a time, the others breathe out of the way */
.intro > .step {
  grid-area: 1 / 1;
  display: grid;
  justify-items: center;
  opacity: 0;
  visibility: hidden;
  filter: blur(6px);
  transform: translateY(12px);
  transition:
    opacity 0.5s ease,
    filter 0.5s ease,
    transform 0.6s var(--ease-out),
    visibility 0s 0.6s;
}

.intro > .step.back {
  transform: translateY(-12px);
}

.intro > .step.on {
  opacity: 1;
  visibility: visible;
  filter: none;
  transform: none;
  transition:
    opacity 0.8s ease 0.25s,
    filter 0.8s ease 0.25s,
    transform 0.9s var(--ease-out) 0.25s,
    visibility 0s;
}

.step-title {
  margin: 0 0 34px;
  font: italic 400 58px/1.1 var(--serif);
  letter-spacing: -0.01em;
  color: #f3efe6;
  text-shadow:
    0 0 3px rgba(6, 8, 12, 0.5),
    0 0 16px rgba(6, 8, 12, 0.55),
    0 2px 30px rgba(0, 0, 0, 0.6);
}

/* the card's words: the intro row's dark glass, opened out into a writing panel */
.note {
  display: grid;
  width: 560px;
  padding: 22px 26px 16px;
  border-radius: 28px;
  text-align: left;
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, rgba(10, 13, 19, 0.5), rgba(10, 13, 19, 0.42));
  backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  -webkit-backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 24px 60px -22px rgba(90, 140, 230, 0.5);
}

.note textarea,
.note input,
.share input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: #f3efe6;
  background: none;
  font: 500 17px/1.55 var(--sans);
  resize: none;
}

.note textarea::placeholder,
.note input::placeholder {
  color: rgba(243, 239, 230, 0.45);
}

.note .signed {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(243, 239, 230, 0.6);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.note .signed input {
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

/* the pass's headline above the words, and the passenger, the seat and who it's from in a row under them */
.note .note-headline {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font: 700 19px/1.3 var(--sans);
}

.note-fields {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 18px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.note-fields .signed {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.note-fields .signed input {
  min-width: 0;
}

.step-hint {
  margin: 12px 0 0;
  min-height: 18px;
  color: rgba(243, 239, 230, 0.78);
  /* on the globe itself, like the route note: a soft dark halo over bright land and ice */
  text-shadow:
    0 0 2px rgba(6, 8, 12, 0.85),
    0 0 6px rgba(6, 8, 12, 0.75),
    0 1px 16px rgba(6, 8, 12, 0.9);
  font: 500 12px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}

/* the link to send: the intro's row, holding the link and its Copy */
.share {
  width: 560px;
}

.share input {
  flex: 1;
  min-width: 0;
  padding: 0 14px 0 18px;
  font-size: 14px;
  text-overflow: ellipsis;
}

.step-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 30px;
}

/* Back, Share and Preview it: quieter than the orb, the same glass */
.quiet {
  height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  color: rgba(243, 239, 230, 0.85);
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background 0.3s ease, color 0.3s ease;
}

/* hover looks only for a pointer that hovers: a tap on a phone left them on (sticky) */
@media (hover: hover) {
  .quiet:hover {
    color: #f3efe6;
    background: rgba(255, 255, 255, 0.12);
  }
}

a.quiet {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.begin:disabled {
  cursor: default;
}

/* a part of the pass still empty when Next is pressed: a soft glow for a moment, then gone */
@keyframes missing {
  from {
    background: rgba(170, 200, 255, 0.12);
    box-shadow: 0 0 0 6px rgba(170, 200, 255, 0.12), inset 0 0 0 1px rgba(170, 200, 255, 0.35);
  }
}

.note .missing {
  border-radius: 8px;
  animation: missing 1.2s ease-out;
}

/* ---------- Edit the note (src/send/card-preview.js): the pass up close, its faces under it ---------- */

/* over the intro, breathing in and out as the steps do; the destination's plate behind, blurred to its colours */
.card-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  background: #f4ece7;
  opacity: 0;
  visibility: hidden;
  filter: blur(6px);
  pointer-events: auto;
  transition:
    opacity 0.5s ease,
    filter 0.5s ease,
    visibility 0s 0.5s;
}

.card-preview.on {
  opacity: 1;
  visibility: visible;
  filter: none;
  transition:
    opacity 0.8s ease,
    filter 0.8s ease,
    visibility 0s;
}

.cp-plate {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100vw, 150vh);
  translate: -50% -50%;
  filter: blur(14px) brightness(0.62) saturate(1.05);
}

.cp-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 30px;
}

.cp-frame {
  position: relative;
  filter: drop-shadow(0 30px 40px rgba(10, 8, 30, 0.45)) drop-shadow(0 3px 4px rgba(10, 8, 30, 0.3));
}

.cp-frame .env-pass {
  will-change: auto;
}

/* the gift giver's words are typed right on the pass: a faint well on hover and while typing, never a box */
.cp-frame [contenteditable] {
  margin-left: -6px;
  margin-right: -6px;
  padding-left: 6px;
  padding-right: 6px;
  border-radius: 6px;
  outline: 0;
  cursor: text;
  caret-color: #9a6a5a;
  transition:
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.cp-frame .pass-signed [contenteditable] {
  margin: 0;
  padding: 0 4px;
}

.cp-frame [contenteditable]:focus {
  background: rgba(36, 42, 74, 0.045);
  box-shadow: inset 0 0 0 1px rgba(36, 42, 74, 0.12);
}

@media (hover: hover) {
  .cp-frame [contenteditable]:hover {
    background: rgba(36, 42, 74, 0.045);
    box-shadow: inset 0 0 0 1px rgba(36, 42, 74, 0.12);
  }
}

.cp-frame [contenteditable]:empty::before {
  content: attr(data-empty);
  color: rgba(45, 47, 62, 0.4);
}

/* Heading / Words, the five faces as "Aa" (each named on hover), and Save: the intro's dark glass */
.cp-faces,
.cp-close {
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, rgba(10, 13, 19, 0.66), rgba(10, 13, 19, 0.58));
  backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  -webkit-backdrop-filter: blur(24px) saturate(1.3) brightness(0.75);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 24px 60px -22px rgba(20, 30, 60, 0.6);
}

.cp-faces {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border-radius: 999px;
}

.cp-parts,
.cp-swatches {
  display: flex;
  gap: 2px;
}

.cp-parts {
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.cp-faces button {
  height: 50px;
  border: 0;
  border-radius: 999px;
  color: rgba(243, 239, 230, 0.75);
  background: none;
  transition:
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease;
}

.cp-parts button {
  padding: 0 18px;
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.03em;
}

.cp-swatches button {
  width: 50px;
  padding: 0;
  line-height: 1;
}

/* hover looks only for a pointer that hovers: a tap on a phone left them on (sticky) */
@media (hover: hover) {
  .cp-faces button:hover {
    color: #f3efe6;
    background: rgba(255, 255, 255, 0.06);
  }
}

.cp-faces button[aria-pressed='true'] {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

/* Save: the bar's one primary control, in Begin's brighter glass (no orbiting light), set apart by a hairline */
.cp-faces .cp-save {
  position: relative;
  margin-left: 9px;
  padding: 0 24px;
  color: #f3efe6;
  font: 600 14px/1 var(--sans);
  letter-spacing: 0.03em;
  background:
    radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.07));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -14px 22px -12px rgba(110, 160, 230, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.22),
    0 10px 28px -10px rgba(90, 140, 230, 0.7);
}

.cp-save::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: rgba(255, 255, 255, 0.12);
}

@media (hover: hover) {
  .cp-faces .cp-save:hover {
    color: #fff;
    background:
      radial-gradient(120% 150% at 50% 0%, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 62%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.21), rgba(255, 255, 255, 0.09));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.5),
      inset 0 -14px 22px -10px rgba(110, 160, 230, 0.85),
      0 0 0 1px rgba(255, 255, 255, 0.26),
      0 12px 32px -10px rgba(90, 140, 230, 0.85);
  }
}

.cp-faces .cp-save:active {
  transform: scale(0.98);
}

.cp-close {
  position: absolute;
  top: 24px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #f3efe6;
}

.cp-close svg {
  width: 14px;
  height: 14px;
}

/* a narrow window: the tall pass, and the faces wrapping under it */
@media (max-width: 759px) {
  .cp-stage {
    gap: 18px;
    padding-top: 56px; /* the × above the pass, not on it */
  }

  .cp-faces {
    flex-wrap: wrap;
    justify-content: center;
    max-width: calc(100vw - 24px);
    border-radius: 28px;
  }

  .cp-parts {
    border-right: 0;
  }

  /* Save beside Heading and Words, the faces on the row under them: two rows, as before */
  .cp-faces .cp-save {
    order: 1;
  }

  .cp-swatches {
    order: 2;
  }

  .cp-close {
    top: 12px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-preview,
  .card-preview.on {
    filter: none;
    transition-property: opacity, visibility;
  }
}

/* ===================== phones (src/shared/phone.js has the same two queries) ===================== */

/*
 * The gift giver's steps work either way up on a phone: sideways (a short window) the steps tighten and sit
 * high, so a menu has room under its field; upright (a narrow window) the row stands as a column. Every
 * control is at least 44 px tall to the touch, nothing sits under the notch or the home indicator, and a step
 * taller than the window (the keyboard up) scrolls inside itself.
 */
@media (orientation: landscape) and (max-height: 500px), (orientation: portrait) and (max-width: 500px) {
  .intro {
    padding:
      max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }

  .intro > .step {
    max-width: 100%;
    max-height: 100%;
    /* the column is the step's width, so a title wider than the row (Wohin geht die Reise?) can't push the row
       off centre as it cycles */
    grid-template-columns: minmax(0, 1fr);
    padding: 4px 8px 16px; /* room for the glass's glow inside the scroller */
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .title {
    height: 56px;
    margin-bottom: 14px;
    font-size: 46px;
  }

  .title .phrase:lang(zh),
  .title .phrase:lang(ja) {
    font-size: 38px;
  }

  .title .phrase:lang(el) {
    font-size: 42px;
  }

  .title .phrase:lang(ar) {
    font-size: 41px;
  }

  .step-title {
    margin-bottom: 14px;
    font-size: 36px;
  }

  .route-note {
    margin-top: 10px;
    font-size: 14px;
  }

  .when {
    min-height: 44px;
    margin-top: 6px;
  }

  .when-chip {
    height: 44px;
  }

  .when-chip::after {
    top: 17px;
  }

  .menu li {
    padding: 14px 12px;
  }

  .note {
    padding: 14px 20px 12px;
    border-radius: 24px;
  }

  .note .note-headline {
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .note textarea {
    height: calc(2 * 1.55em);
  }

  .note-fields {
    margin-top: 8px;
    padding-top: 4px;
  }

  .note-fields .signed {
    align-items: center;
    min-height: 44px;
  }

  .step-hint {
    margin-top: 6px;
  }

  .step-nav {
    margin-top: 12px;
  }

  .quiet {
    height: 44px;
    padding: 0 20px;
  }
}

/* sideways: the steps sit high, so the cities' menus open into the room under the row */
@media (orientation: landscape) and (max-height: 500px) {
  .intro {
    align-items: start;
  }

  .title {
    height: 50px;
    margin-bottom: 10px;
    font-size: 40px;
  }

  .step-title {
    margin-bottom: 10px;
    font-size: 30px;
  }

  /* Edit the note: the pass as large as the height allows, the faces close under it, the × in the corner */
  .cp-stage {
    gap: 10px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .cp-faces {
    padding: 4px;
  }

  .cp-faces button {
    height: 44px;
  }

  .cp-swatches button {
    width: 46px;
  }

  .cp-close {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }
}

/* upright: the row stands as a column, the pass's fields one under another, the step's buttons two by two */
@media (orientation: portrait) and (max-width: 500px) {
  .title {
    font-size: min(46px, 10.5vw);
  }

  .step-title {
    font-size: min(36px, 8.6vw);
  }

  .ask:not(.share) {
    flex-direction: column;
    align-items: stretch;
    /* from the window, not its step: the step hugs the cycling title, so 100% grew and shrank with each language
       (the intro's 16 px and the step's 8 px either side) */
    width: min(400px, calc(100vw - 48px));
    border-radius: 28px;
  }

  .slot,
  .slot.to {
    width: auto;
    padding: 0 18px 0 var(--inset);
  }

  #from {
    text-align: left;
  }

  .slot .hug {
    right: auto;
    left: calc(var(--inset) - 15px);
  }

  /* between the cities, a hairline from the words' first letter to the slots' far padding (no arrow, upright) */
  .via {
    height: 18px;
    padding: 0 18px 0 29px; /* the slots' padding: 29 px --inset, 18 px on the right */
  }

  .via::before {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(243, 239, 230, 0.14);
  }

  .via .ask-arrow {
    display: none;
  }

  .ask:not(.share) .begin {
    margin: 6px 0 0;
  }

  .note,
  .share {
    width: min(460px, 100%);
  }

  .note textarea {
    height: calc(4 * 1.55em);
  }

  .note-fields {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .note-fields .signed + .signed {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .step-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 340px;
  }

  .step-nav > * {
    flex: 1 1 140px;
    justify-content: center;
  }

  .cp-stage {
    padding-top: max(56px, env(safe-area-inset-top));
  }

  .cp-close {
    top: max(12px, env(safe-area-inset-top));
  }
}
