/* ============================================================
   Mobile story — a separate 9:16 Instagram-Story presentation.
   Shown only on portrait phones; the desktop deck is untouched.
   Per-card brand theming mirrors the deck. Navigation + autoplay
   live in story.js.
   ============================================================ */

.story { display: none; }

/* Default (no-JS / desktop): the deck is the experience. The story is
   revealed only on portrait phones. JS refines autoplay but display is
   driven here so it's correct before JS runs. */
@media (max-width: 820px) and (orientation: portrait) {
  body { overflow: hidden; }
  .deck { display: none; }
  .hud { display: none; }
  .story { display: block; }
}

.story {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ----- Progress bars (one segment per card) ----- */
.story-progress {
  position: absolute;
  top: max(env(safe-area-inset-top), 10px);
  left: max(env(safe-area-inset-left), 10px);
  right: max(env(safe-area-inset-right), 10px);
  z-index: 40;
  display: flex;
  gap: 4px;
  pointer-events: none;
}
.seg {
  flex: 1 1 0;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.seg-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  transform: scaleX(0);
  transform-origin: left center;
}
@keyframes story-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ----- Card stack ----- */
.story-track {
  position: absolute;
  inset: 0;
}
.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 18px);
  padding:
    calc(max(env(safe-area-inset-top), 10px) + 34px)
    max(env(safe-area-inset-right), 26px)
    calc(max(env(safe-area-inset-bottom), 18px) + 14px)
    max(env(safe-area-inset-left), 26px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease;
  overflow: hidden;
}
.card.is-active { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* ----- Interaction surface -----
   Purely a visual hit-area marker; it must NEVER intercept taps, or it
   would sit above links (e.g. the contact card's isolation:isolate
   stacking context traps its QR's z-index). Tap/hold handlers live on the
   .story container and ignore taps that land on a link/button. */
.story-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.story { cursor: pointer; }
.story.is-paused .story-pause-hint { opacity: 1; }
.story-pause-hint {
  position: absolute;
  left: 50%;
  bottom: calc(max(env(safe-area-inset-bottom), 18px) + 10px);
  transform: translateX(-50%);
  z-index: 41;
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
  padding: 5px 10px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 160ms ease;
  pointer-events: none;
}

/* ----- Shared card type ----- */
.card-kick {
  font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.75;
  margin: 0;
}
.card-h {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(32px, 9.4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
}
.card-lede {
  font-size: clamp(17px, 4.6vw, 21px);
  line-height: 1.4;
  margin: 0;
}
.card-body {
  font-size: clamp(14px, 3.8vw, 17px);
  line-height: 1.5;
  margin: 0;
  opacity: 0.92;
}

/* QR sits above the tap surface so it stays tappable */
.card .qr-card {
  position: relative;
  z-index: 30;
  align-self: flex-start;
  margin-top: clamp(6px, 1.6vh, 14px);
}
.card .qr-card img { width: 72px; height: 72px; }

/* ----- Product screenshot in a card ----- */
.card-shot {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: 0 1 auto;
}
.card-shot img {
  width: auto;
  max-width: min(58vw, 240px);
  max-height: 42vh;
  object-fit: contain;
  border-radius: 26px;
  box-shadow: 0 24px 50px -24px rgba(0, 0, 0, 0.6);
}
.card-shot .shot-placeholder {
  width: min(58vw, 240px);
  aspect-ratio: 9 / 19.5;
  border-radius: 26px;
  min-height: 0;
}

/* Cards that lead with a screenshot center the image and keep copy tight */
.card--shotlead { gap: clamp(8px, 1.8vh, 14px); }
.card--shotlead .card-h { font-size: clamp(28px, 8vw, 44px); }

/* ============================================================
   Per-card brand themes (mirror the deck)
   ============================================================ */

/* Cover */
.card--cover {
  background:
    radial-gradient(circle at 24% 16%, rgba(184,134,46,0.22), transparent 55%),
    linear-gradient(180deg, #faf8f5 0%, #f0ebe3 100%);
  color: #0a0a0a;
}
.card--cover .card-h {
  font-size: clamp(44px, 15vw, 96px);
  line-height: 0.94;
}
.card--cover .card-lede {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: clamp(19px, 5.2vw, 26px);
}
.card--cover .byline {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #b8862e;
  margin: 0;
}

/* What I do */
.card--what { background: #faf8f5; color: #0a0a0a; }
.card--what .what-list { display: grid; gap: clamp(12px, 2.6vh, 20px); margin: 0; counter-reset: w; }
.card--what .what-list li {
  border-top: 2px solid #0a0a0a;
  padding-top: 10px;
  position: relative;
  counter-increment: w;
}
.card--what .what-list li::before {
  content: counter(w, decimal-leading-zero);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #b8862e;
  position: absolute;
  top: -16px;
  left: 0;
}
.card--what h3 {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(20px, 5.4vw, 26px);
  margin: 0 0 0.2em;
}
.card--what .small { font-size: clamp(12px, 3.4vw, 14px); opacity: 0.7; margin: 0; }

/* Expensive problems */
.card--xp {
  background:
    radial-gradient(circle at 80% 12%, rgba(212,160,82,0.18), transparent 55%),
    radial-gradient(circle at 12% 90%, rgba(212,160,82,0.10), transparent 55%),
    #15110d;
  color: #f5efe3;
}
.card--xp .card-kick { color: #d4a052; opacity: 0.95; }
.card--xp .card-lede {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  color: rgba(245,239,227,0.85);
}
.card--xp .xp-points { display: grid; gap: 12px; margin: 0; counter-reset: xp; }
.card--xp .xp-points li {
  position: relative;
  counter-increment: xp;
  padding: 10px 0 0 32px;
  border-top: 1px solid rgba(245,239,227,0.16);
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.45;
  color: rgba(245,239,227,0.92);
}
.card--xp .xp-points li::before {
  content: counter(xp, decimal-leading-zero);
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #d4a052;
  position: absolute;
  top: 13px;
  left: 0;
}

/* StrollCraft */
.card--stroll {
  background: #f3ece0;
  color: #1a1511;
  font-family: 'Fraunces', Georgia, serif;
}
.card--stroll .card-kick { color: #b83828; }
.card--stroll .card-h {
  font-family: 'Fraunces', serif;
  font-weight: 800;
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.card--stroll .card-lede { font-family: 'Fraunces', serif; font-style: italic; }

/* either.fm */
.card--either {
  background: #0a0a0a;
  color: #fff;
  font-family: 'Fraunces', serif;
}
.card--either .card-kick {
  color: rgba(255,255,255,0.6);
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 20px;
  letter-spacing: -0.01em;
  text-transform: none;
}
.card--either .card-h { font-family: 'Fraunces', serif; font-weight: 800; }
.card--either .card-lede { font-family: 'Fraunces', serif; font-style: italic; color: rgba(255,255,255,0.92); }
.card--either .card-body { color: rgba(255,255,255,0.82); }
.slash {
  display: inline-block;
  transform: skewX(-22deg) translateY(-1px);
  font-style: normal;
  margin: 0 0.06em;
  color: #fff;
}

/* CardCard */
.card--cardcard {
  background: #f5f0e6;
  color: #16110f;
  font-family: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}
.card--cardcard .card-kick { color: #b24a2c; letter-spacing: 0.2em; }
.card--cardcard .card-h {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-weight: 600;
}
.card--cardcard .card-lede {
  font-family: 'Iowan Old Style', Georgia, serif;
  font-style: italic;
  color: #2a221e;
}
.card--cardcard .card-body { color: #2a221e; }

/* Three iOS apps — shared dark base, per-app accent */
.card--app { color: #f8fafc; font-family: 'DM Sans', system-ui, sans-serif; }
.card--app .app-brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(30px, 9vw, 46px);
  margin: 0;
  letter-spacing: -0.01em;
}
.card--app .app-tag {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-size: clamp(18px, 4.8vw, 23px);
  margin: 0;
}
.card--app .app-status {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}

.card--linden {
  background:
    radial-gradient(circle at 80% 6%, rgba(229,169,19,0.22), transparent 55%),
    linear-gradient(180deg, #2A2523, #1A1715);
  color: #FAFAF9;
}
.card--linden .app-brand, .card--linden .app-status { color: #E5A913; }

.card--chord {
  background:
    radial-gradient(circle at 18% 96%, rgba(34,197,94,0.24), transparent 55%),
    linear-gradient(180deg, #0f2233, #060d12);
  color: #f8fafc;
  font-family: 'Inter', system-ui, sans-serif;
}
.card--chord .app-brand { font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; color: #facc15; }
.card--chord .app-tag { font-family: 'Nunito', system-ui, sans-serif; font-style: normal; color: #cbd5e1; }
.card--chord .app-status { color: #86efac; }

.card--patchpond {
  background:
    radial-gradient(circle at 50% 4%, rgba(255,176,46,0.18), transparent 60%),
    linear-gradient(180deg, #1c1c1c, #0e0e0e);
  color: #e7e3da;
  font-family: 'Space Mono', ui-monospace, monospace;
}
.card--patchpond .app-brand {
  font-family: 'Space Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ffb02e;
  font-size: clamp(26px, 7.6vw, 36px);
}
.card--patchpond .app-tag { font-family: 'Space Mono', ui-monospace, monospace; font-style: normal; color: #d8d3c7; }
.card--patchpond .app-status { color: #ffb02e; }

/* Packaged consulting */
.card--consult { background: #faf8f5; color: #0a0a0a; }
.card--consult .consult-list { display: grid; gap: clamp(10px, 2vh, 16px); margin: 0; }
.card--consult .consult-list li {
  border-top: 3px solid #b8862e;
  padding-top: 8px;
}
.card--consult .consult-list .brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(20px, 5.4vw, 26px);
  margin: 0 0 2px;
}
.card--consult .consult-list p { font-size: clamp(13px, 3.6vw, 15px); line-height: 1.4; margin: 0; color: #1f1f1f; }
.card--consult .consult-list .price {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8862e;
}

/* Contact (final, lingers) */
.card--contact {
  background: #faf8f5;
  color: #0a0a0a;
  isolation: isolate;
}
.card--contact .card-h { font-size: clamp(48px, 16vw, 104px); line-height: 0.94; }
.card--contact .contact-bg-m {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  opacity: 0.1;
  filter: grayscale(1) contrast(1.05);
  z-index: 0;
  pointer-events: none;
  mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 100%);
}
.card--contact .contact-list { display: grid; gap: 8px; margin: 0; position: relative; z-index: 1; }
.card--contact .contact-list li {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(10,10,10,0.12);
  font-size: clamp(15px, 4.2vw, 18px);
}
.card--contact .contact-list .label {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b8862e;
}
.card--contact .contact-list a { font-weight: 500; }
.card--contact .contact-qrs { display: flex; flex-wrap: wrap; gap: 12px; position: relative; z-index: 1; }
