/* =========================================================
   Galbraith 2027 — an envelope that opens
   ========================================================= */

:root {
  /* Stationery palette */
  --blue-100: #e4f0f7;
  --blue-200: #cfe4f0;
  --blue-300: #bcd8e8;
  --blue-400: #a3c6dc;
  --blue-500: #86afca;
  --blue-700: #4c7d9b;

  --ink: #22292e;
  --ink-soft: #5b6a73;
  --accent: #3d7a99;
  --accent-deep: #2b5b74;

  --cream-100: #fffdf8;
  --cream-200: #faf4ea;
  --cream-300: #f1e8da;

  /* Geometry: vertical position of the envelope flap's point.
     On tall phones a height % makes a huge triangle; cap it by width
     so the fold stays an envelope. Wider screens keep a deeper point. */
  --v: min(26vh, 46vw);

  /* Card size, driven by height so it never overflows a phone screen */
  --card-h: min(88vh, 740px);
  --card-w: min(90vw, calc(var(--card-h) * 5 / 7));

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-flap: cubic-bezier(0.62, 0.01, 0.28, 1);

  /* How long the card takes to turn over, and the moment it passes edge-on.
     That moment is not half the duration, because --ease-flap runs quickest
     through the middle: measured, 90 degrees falls at .5s of the 1.05s turn.
     The faces swap then, while the card is side-on and effectively invisible. */
  --flip: 1.05s;
  --flip-half: .5s;

  /* Keyboard offset on mobile, set from JS */
  --kb: 0px;

  --paper-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Small-viewport units keep the card clear of mobile browser chrome. */
@supports (height: 1svh) {
  :root {
    --card-h: min(88svh, 740px);
    --v: min(26svh, 46vw);
  }
}

/* Roomier card on tablets and desktops */
@media (min-width: 700px) and (min-height: 700px) {
  :root { --card-h: min(86vh, 840px); }
  @supports (height: 1svh) {
    :root { --card-h: min(86svh, 840px); }
  }
}

/* The flap point drops further on wider screens, so the fold keeps the angle
   of a real envelope instead of flattening out. */
@media (min-aspect-ratio: 3/4) { :root { --v: 46%; } }
@media (min-aspect-ratio: 1/1) { :root { --v: 48%; } }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  background: var(--blue-300);
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   Stage
   ========================================================= */

/* No perspective here on purpose: a 3D rendering context on the stage would
   sort its children by depth and ignore z-index. Each 3D piece gets its own. */
.scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

/* Envelope back panel + interior, painted straight onto the stage */
.scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 8%, var(--blue-100), transparent 62%),
    linear-gradient(168deg, var(--blue-200) 0%, var(--blue-300) 46%, var(--blue-400) 100%);
}

/* Paper grain + linen weave over everything blue */
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background:
    radial-gradient(135% 105% at 50% 42%, transparent 52%, rgba(29,59,74,.22)),
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgba(0,0,0,.03) 0 1px, transparent 1px 3px),
    var(--paper-noise);
  background-size: auto, auto, auto, 180px 180px;
}

/* =========================================================
   Envelope: interior, front pocket, flap, seal
   ========================================================= */

/* Front pocket: a full-bleed panel with a V notch cut out of the top.
   The notch is exactly the shape the flap covers, so the closed envelope
   reads as one continuous surface. */
.env-front {
  position: absolute;
  inset: 0;
  z-index: 3;
  clip-path: polygon(0 0, 50% var(--v), 100% 0, 100% 100%, 0 100%);
  background:
    radial-gradient(140% 70% at 50% 100%, rgba(255,255,255,.28), transparent 60%),
    linear-gradient(168deg, var(--blue-200) 0%, var(--blue-300) 48%, var(--blue-400) 100%);
  box-shadow: inset 0 2px 14px rgba(43,91,116,.16);
  transition: transform 1.2s var(--ease-out);
}

/* Once the flap is up, the envelope and the card move together:
   the pocket drops away while the card slides to rest. */
body.is-opening .env-front,
body.is-open .env-front {
  transform: translateY(100%);
  transition: transform 1.2s var(--ease-out) .22s;
}

body.is-open .env-front { opacity: 0; }

/* The flap */
.flap-stage {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--v);
  z-index: 4;
  perspective: 1500px;
  perspective-origin: 50% 0%;
}

.flap {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 0%;
  transform: rotateX(0deg);
  transition: transform 1s var(--ease-flap);
  will-change: transform;
}

.flap__face {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  backface-visibility: hidden;
}

.flap__outer {
  background:
    linear-gradient(178deg, var(--blue-100) 0%, var(--blue-200) 55%, var(--blue-300) 100%);
}

.flap__lining {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.5) 0 6px, transparent 6px 12px),
    linear-gradient(178deg, var(--blue-300), var(--blue-100));
}

body.is-opening .flap,
body.is-open .flap { transform: rotateX(-179deg); }

/* A slightly oversized copy of the flap sitting beneath it, so only a soft
   sliver shows past the fold — the shadow the closed flap casts. */
.flap-shadow {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--v);
  z-index: 3;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: rgba(43,91,116,.24);
  filter: blur(5px);
  transform: scale(1.02);
  transform-origin: 50% 0%;
  transition: opacity .4s ease;
}
body.is-opening .flap-shadow, body.is-open .flap-shadow { opacity: 0; }

/* The flap stage still covers the top of the viewport after it lifts, so
   drop pointer events once the envelope is gone or Back cannot be tapped. */
body.is-open .flap-stage,
body.is-open .flap-shadow,
body.is-open .env-front {
  pointer-events: none;
}

/* Mother-of-pearl seal at the point of the flap */
.seal {
  position: absolute;
  left: 50%;
  top: var(--v);
  z-index: 6;
  width: clamp(62px, 16vw, 84px);
  font-size: clamp(62px, 16vw, 84px);
  aspect-ratio: 1;
  transform: translate(-50%, -56%);
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  /* Slightly baroque, like a nacre cabochon rather than a perfect disc */
  border-radius: 46% 54% 49% 51% / 52% 47% 53% 48%;
  background:
    radial-gradient(75% 60% at 30% 22%, rgba(255,255,255,.92) 0%, rgba(255,255,255,.28) 34%, transparent 58%),
    conic-gradient(from 205deg at 48% 46%,
      #f7f1e8 0deg,
      #ead4e4 55deg,
      #d4ebe6 115deg,
      #efe4c4 175deg,
      #d5dced 235deg,
      #f1d6cc 295deg,
      #f7f1e8 360deg);
  box-shadow:
    0 8px 18px -6px rgba(36, 62, 80, .4),
    0 1px 0 rgba(255,255,255,.75),
    inset 0 0 0 1px rgba(255,255,255,.6),
    inset 0 -6px 12px rgba(118, 96, 90, .16),
    inset 0 7px 14px rgba(255,255,255,.5);
  transition: transform .55s var(--ease-out), opacity .5s ease, filter .5s ease;
  cursor: pointer;
}

body.is-opening .seal, body.is-open .seal { pointer-events: none; }

/* Carved lip of the cabochon */
.seal::before {
  content: '';
  position: absolute;
  inset: 11%;
  z-index: 3;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,.55);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.7),
    inset 0 -1px 4px rgba(90, 72, 70, .18);
  background: radial-gradient(90% 80% at 50% 50%, transparent 62%, rgba(255,255,255,.35));
  pointer-events: none;
}

.seal::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  pointer-events: none;
  opacity: .7;
  mix-blend-mode: soft-light;
  background: conic-gradient(from 28deg at 38% 32%,
    rgba(255, 168, 188, .7),
    rgba(130, 220, 205, .65),
    rgba(186, 172, 255, .5),
    rgba(255, 216, 130, .6),
    rgba(255, 168, 188, .7));
}

.seal__mark {
  position: relative;
  z-index: 2;
  width: 84%;
  height: 84%;
  overflow: visible;
  pointer-events: none;
}

body.is-opening .seal,
body.is-open .seal {
  transform: translate(-50%, 40%) rotate(-14deg) scale(.72);
  opacity: 0;
  filter: blur(1px);
}

/* =========================================================
   The card
   ========================================================= */

.card-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  pointer-events: none;
}

.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  transform: translateY(56%);
  transition: transform 1.2s var(--ease-out);
  perspective: 1600px;
  will-change: transform;
}

body.is-opening .card {
  transform: translateY(0);
  transition: transform 1.2s var(--ease-out) .22s;
}

body.is-open .card,
body.is-unlocked .card {
  transform: translateY(calc(var(--kb) * -1));
  pointer-events: auto;
}

.card__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform var(--flip) var(--ease-flap);
}

body.is-unlocked .card__inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
  border-radius: 3px;
  /* Type inside the card scales with the card, not the window.
     Note that this containment is why the faces cannot rely on backface
     culling alone: WebKit flattens a contained element into its own layer
     and then paints its back face anyway. They are swapped by visibility
     below, which holds regardless. */
  container-type: inline-size;
  background:
    radial-gradient(120% 85% at 50% 0%, #fffefb, transparent 72%),
    linear-gradient(165deg, var(--cream-100) 0%, var(--cream-200) 62%, var(--cream-300) 100%);
  box-shadow:
    0 1px 1px rgba(43,91,116,.10),
    0 18px 40px -12px rgba(30,60,80,.45),
    0 40px 80px -30px rgba(30,60,80,.35);
  /* Discrete, so the swap lands exactly when the card is edge-on. */
  transition: box-shadow .6s ease, visibility 0s linear var(--flip-half);
}

/* Grain + a letterpress plate line inside the edge */
.face::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  mix-blend-mode: multiply;
  background: var(--paper-noise);
  background-size: 180px 180px;
}
.face::after {
  content: '';
  position: absolute;
  inset: clamp(9px, 2.6vw, 15px);
  pointer-events: none;
  border: 1px solid rgba(61,122,153,.22);
  border-radius: 1px;
}

/* Tucked inside the envelope, the card should not float above it. */
body.is-sealed .face {
  box-shadow: 0 1px 3px rgba(30,60,80,.28);
}

/* Only ever one face on show, and only that one takes taps. */
.face--front { visibility: visible; }
.face--back {
  transform: rotateY(180deg);
  visibility: hidden;
  pointer-events: none;
}
body.is-unlocked .face--front { visibility: hidden; pointer-events: none; }
body.is-unlocked .face--back { visibility: visible; pointer-events: auto; }

/* Both faces: centered when there is room, scrollable when there is not.
   The flexible pseudo-element spacers do the centering, because
   justify-content: center would clip the top of overflowing content. */
.face__pad,
.detail,
.page {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.face__pad::before, .face__pad::after,
.detail::before, .detail::after {
  content: '';
  flex: 1 1 0;
  min-height: 0;
}

.face__pad::-webkit-scrollbar,
.detail::-webkit-scrollbar,
.page::-webkit-scrollbar { display: none; }

.face__pad {
  gap: clamp(.5rem, 2.4cqi, 1rem);
  padding: clamp(1.4rem, 7cqi, 2.6rem);
}

/* =========================================================
   Type
   ========================================================= */

.rings {
  width: clamp(42px, 12vw, 56px);
  width: clamp(38px, 12cqi, 58px);
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.1;
  opacity: .85;
}

.smallcaps {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: .28em;
  color: var(--accent);
}

/* =========================================================
   Intro (printed on the closed envelope)
   ========================================================= */

.intro {
  position: absolute;
  left: 50%;
  /* Centred in the pocket below the flap's point, biased low so the title
     keeps clear of the seal on short, wide screens. */
  top: calc(var(--v) + (100% - var(--v)) * 0.5);
  transform: translate(-50%, -50%);
  z-index: 5;
  width: min(88vw, 34rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 1rem calc(env(safe-area-inset-bottom));
  transition: opacity .4s ease, transform .6s var(--ease-out);
}

body.is-opening .intro,
body.is-open .intro {
  opacity: 0;
  transform: translate(-50%, -46%) scale(.96);
  pointer-events: none;
}

.intro__title {
  font-family: 'Italianno', cursive;
  font-weight: 400;
  font-size: min(clamp(3.2rem, 16vw, 5.8rem), 16vh);
  line-height: 1;
  color: #1d3b4a;
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}

.intro__rule {
  display: block;
  width: clamp(90px, 34vw, 190px);
  height: 1px;
  margin: clamp(1.1rem, 3.4vh, 1.8rem) 0 clamp(1.4rem, 4vh, 2.2rem);
  background: linear-gradient(90deg, transparent, rgba(43,91,116,.55), transparent);
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.72rem, 3vw, .8rem);
  letter-spacing: .2em;
  text-indent: .2em;
  text-transform: uppercase;
  min-height: 50px;
  padding: 0 clamp(1.6rem, 7vw, 2.4rem);
  border-radius: 2px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .18s ease, background-color .25s ease, color .25s ease, box-shadow .25s ease;
}

.btn:active { transform: scale(.97); }

/* A quiet cue printed on the envelope, not a card of its own */
.btn--ghost {
  color: var(--accent-deep);
  background: none;
  border: 0;
  box-shadow: none;
  letter-spacing: .28em;
  text-indent: .28em;
  min-height: 44px;
  padding: 0 .2rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
  text-decoration-color: rgba(43,91,116,.4);
}

.btn--solid {
  color: var(--cream-100);
  background: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 6px 16px -8px rgba(43,91,116,.8);
}

.btn:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

@media (hover: hover) {
  .btn--ghost:hover {
    color: var(--ink);
    text-decoration-color: var(--accent-deep);
  }
  .btn--solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
}

/* =========================================================
   Lock face
   ========================================================= */

.lock__title {
  font-family: 'Italianno', cursive;
  font-weight: 400;
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-size: min(clamp(2.2rem, 12cqi, 4rem), 12vh);
  line-height: 1;
  color: var(--ink);
}

.lock__note {
  font-size: clamp(.9rem, 3.6vw, 1.02rem);
  font-size: clamp(.9rem, 4.4cqi, 1.1rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 22ch;
}

.lock__form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(.7rem, 2.2vh, 1.1rem);
  width: 100%;
  margin-top: clamp(.4rem, 1.6vh, .9rem);
}

.lock__label {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  font-size: .6rem;
  letter-spacing: .3em;
  text-indent: .3em;
  text-transform: uppercase;
  color: var(--accent);
}

.lock__input {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 16px; /* keeps iOS from zooming on focus */
  letter-spacing: .1em;
  text-align: center;
  width: min(100%, 15rem);
  min-height: 48px;
  padding: .5rem .75rem;
  color: var(--ink);
  /* A ruled line to write on, rather than a form field */
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(61,122,153,.45);
  border-radius: 0;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.lock__input::placeholder { color: rgba(91,106,115,.45); letter-spacing: .3em; }

.lock__input:focus {
  border-bottom-color: var(--accent-deep);
  box-shadow: 0 1px 0 0 var(--accent-deep);
}

.card.is-wrong .lock__input { border-bottom-color: #b4534f; }

.lock__error {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: .68rem;
  letter-spacing: .1em;
  min-height: 1.1em;
  color: #a2453f;
  opacity: 0;
  transition: opacity .2s ease;
}
.lock__error.is-shown { opacity: 1; }

/* =========================================================
   Details face
   ========================================================= */

.detail {
  gap: clamp(.26rem, 1.3cqi, .5rem);
  padding: clamp(1.05rem, 4.8cqi, 1.85rem) clamp(1.3rem, 6.5cqi, 2.4rem);
}

.detail__art {
  width: min(70%, 250px);
  width: min(64cqi, 275px);
  margin-bottom: clamp(.38rem, 2.4cqi, .85rem);
  display: grid;
  place-items: center;
}

.detail__art img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 16vh;
  object-fit: contain;
  mix-blend-mode: multiply;
  opacity: .92;
}

.detail__art .rings { display: none; }
.detail__art.is-missing img { display: none; }
.detail__art.is-missing .rings { display: block; }

.detail__eyebrow {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(.56rem, 2.6vw, .66rem);
  font-size: clamp(.56rem, 2.5cqi, .72rem);
  letter-spacing: .34em;
  text-indent: .34em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail__name {
  font-family: 'Italianno', cursive;
  font-weight: 400;
  font-size: min(clamp(1.5rem, 9cqi, 2.85rem), 6.6vh);
  line-height: 1.08;
  text-wrap: balance;
  color: var(--ink);
}

.detail__amp {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(.85rem, 4cqi, 1.12rem);
  line-height: 1.15;
  color: var(--accent);
  opacity: .85;
  margin: -.12em 0 0;
}

.detail__date {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(.56rem, 2.5vw, .7rem);
  font-size: clamp(.56rem, 2.7cqi, .78rem);
  letter-spacing: .16em;
  text-indent: .16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: clamp(.9rem, 3.4cqi, 1.4rem);
}

.detail__venue {
  font-family: 'Italianno', cursive;
  font-size: min(clamp(1.4rem, 7.6cqi, 2.5rem), 5.8vh);
  line-height: 1.12;
  color: var(--ink);
  margin-top: clamp(.28rem, 1.5cqi, .55rem);
}

.detail__meta {
  font-size: clamp(.85rem, 4.2cqi, 1.05rem);
  line-height: 1.5;
  color: var(--ink-soft);
  margin-top: .15rem;
}

.detail__bullet {
  display: inline-block;
  margin: 0 .55em;
  color: var(--accent);
}

.detail__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(.32rem, 1.5cqi, .5rem);
  width: 100%;
  max-width: 22rem;
  margin-top: clamp(.5rem, 2.4cqi, .9rem);
}

.detail__link {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.48rem, 2.15cqi, .6rem);
  letter-spacing: .14em;
  text-indent: .14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background:
    linear-gradient(180deg, var(--cream-100) 0%, var(--cream-200) 100%);
  border: 1px solid rgba(61,122,153,.2);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    0 3px 8px -3px rgba(30,60,80,.28);
  cursor: pointer;
  min-height: 40px;
  padding: .48rem .45rem;
  -webkit-appearance: none;
  appearance: none;
}

.detail__link:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    0 2px 5px -2px rgba(30,60,80,.22);
}

.page__back {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.52rem, 2.4cqi, .64rem);
  letter-spacing: .18em;
  text-indent: 0;
  text-transform: uppercase;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  min-height: 40px;
  padding: 0 .4rem 0 0;
  -webkit-appearance: none;
  appearance: none;
}

.detail__address {
  font-size: clamp(.88rem, 3.5vw, 1rem);
  font-size: clamp(.85rem, 4.2cqi, 1.05rem);
  line-height: 1.5;
  color: var(--ink-soft);
}

.detail__map {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-size: clamp(.56rem, 2.6vw, .64rem);
  font-size: clamp(.56rem, 2.5cqi, .7rem);
  letter-spacing: .22em;
  text-indent: .22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  margin-top: clamp(.2rem, 1.4cqi, .6rem);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: rgba(61,122,153,.45);
}

@media (hover: hover) {
  .detail__map:hover,
  .page__back:hover { color: var(--accent-deep); text-decoration-color: var(--accent-deep); }
  .detail__link:hover {
    background: var(--cream-100);
    border-color: rgba(61,122,153,.32);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.9),
      0 6px 12px -4px rgba(30,60,80,.34);
  }
}

.detail__link:focus-visible,
.page__back:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

/* =========================================================
   Inner pages
   ========================================================= */

.page {
  gap: clamp(.35rem, 1.8cqi, .7rem);
  padding: clamp(1rem, 4.6cqi, 1.8rem) clamp(1.35rem, 6cqi, 2.1rem);
  justify-content: flex-start;
  align-items: stretch;
}

.page__back {
  align-self: start;
  flex: 0 0 auto;
  width: auto;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  text-decoration-color: rgba(61,122,153,.45);
}

.page__title {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(1.05rem, 5.4cqi, 1.5rem);
  letter-spacing: .2em;
  text-indent: .2em;
  text-transform: uppercase;
  color: var(--ink);
}

.page__lede {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 300;
  font-size: clamp(.56rem, 2.7cqi, .78rem);
  letter-spacing: .16em;
  text-indent: .16em;
  text-transform: uppercase;
  color: var(--ink);
}

.page__place {
  font-family: 'Italianno', cursive;
  font-size: min(clamp(1.4rem, 7.6cqi, 2.5rem), 6vh);
  line-height: 1.1;
  color: var(--ink);
}

.page__copy {
  font-size: clamp(.88rem, 4.2cqi, 1.05rem);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: none;
}

.page__copy--lead,
.page__section {
  text-align: left;
  width: 100%;
}

.page__section + .page__section {
  margin-top: clamp(.15rem, 1cqi, .35rem);
}

.page__sub {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(.72rem, 3.2cqi, .88rem);
  letter-spacing: .16em;
  text-indent: .16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: clamp(.55rem, 2.4cqi, .9rem);
}

.page__section .page__copy {
  margin-top: .35rem;
}

.page__times {
  list-style: none;
  width: 100%;
  max-width: none;
  margin: clamp(.2rem, 1cqi, .5rem) 0;
}

.page__slot {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: .6rem;
  align-items: baseline;
  text-align: left;
  padding: .28rem 0;
}

.page__time {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.56rem, 2.5cqi, .68rem);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}

.page__event {
  font-size: clamp(.9rem, 4.4cqi, 1.1rem);
  color: var(--ink);
}

.page__shops {
  display: flex;
  flex-direction: column;
  gap: clamp(.4rem, 1.8cqi, .6rem);
  width: 100%;
  margin-top: clamp(.35rem, 2cqi, .7rem);
}

.page__shop {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.52rem, 2.3cqi, .64rem);
  letter-spacing: .14em;
  text-indent: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-deep);
  background:
    linear-gradient(180deg, var(--cream-100) 0%, var(--cream-200) 100%);
  border: 1px solid rgba(61,122,153,.2);
  border-radius: 2px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    0 3px 8px -3px rgba(30,60,80,.28);
  min-height: 44px;
  padding: .55rem .6rem;
}

.page__shop.is-soon {
  opacity: .5;
  cursor: default;
  box-shadow: none;
}

@media (hover: hover) {
  a.page__shop:hover {
    background: var(--cream-100);
    border-color: rgba(61,122,153,.32);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.9),
      0 6px 12px -4px rgba(30,60,80,.34);
  }
}

a.page__shop:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
}

.page__faq {
  width: 100%;
  max-width: none;
  text-align: left;
}

.page__q {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(.52rem, 2.4cqi, .64rem);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: clamp(.7rem, 3cqi, 1.1rem);
}

.page__q:first-child { margin-top: .2rem; }

.page__a {
  font-size: clamp(.88rem, 4.2cqi, 1.05rem);
  line-height: 1.45;
  color: var(--ink-soft);
  margin: .25rem 0 0;
}

/* =========================================================
   Landscape phones: shorter card, tighter type
   ========================================================= */

/* A phone on its side gets a landscape card, so names stay on one line. */
@media (orientation: landscape) and (max-height: 560px) {
  :root {
    --card-h: 90vh;
    --card-w: min(94vw, calc(var(--card-h) * 7 / 5));
    --v: 44%;
  }
  @supports (height: 1svh) {
    :root { --card-h: 90svh; }
  }
  .detail, .page { gap: .18rem; padding: .45rem 1.6rem; }
  .detail__art { width: min(44cqi, 220px); margin-bottom: .2rem; }
  .detail__art img { max-height: 12vh; }
  .detail__venue { margin-top: .15rem; }
  .detail__nav { margin-top: .2rem; gap: .3rem; }
  .detail__link { min-height: 34px; padding: .28rem .35rem; }
  .page__back { min-height: 34px; }
  .detail__map { margin-top: 0; min-height: 40px; }
  .rings { width: clamp(32px, 7cqi, 44px); }
  .intro__rule { margin: .6rem 0 .9rem; }
  .lock__form { margin-top: 0; }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  /* The turn is instant here, so the faces swap immediately too. */
  :root { --flip-half: 0s; }
  .flap, .card, .card__inner, .env-front, .intro, .seal, .scene::before {
    transition-duration: .001s !important;
  }
}
