/* Shared foundation for both themes. Theme files set the tokens. */

@font-face {
  font-family: "Gloock";
  src: url("/fonts/gloock-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Anybody";
  src: url("/fonts/anybody-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 150%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-var-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
/* Metric-matched fallbacks keep layout from jumping while fonts load. */
@font-face {
  font-family: "Gloock Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
}
@font-face {
  font-family: "Instrument Fallback";
  src: local("Helvetica Neue"), local("Arial");
  size-adjust: 98%;
  ascent-override: 96%;
  descent-override: 24%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}
a {
  color: inherit;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
::selection {
  background: var(--select);
  color: var(--ink);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}
.skip:focus {
  top: 1rem;
}

@media (max-width: 59.99em) {
  .lede-more {
    display: none;
  }
}

.testbar {
  padding: 0.55rem 1.25rem;
  background: oklch(28% 0.03 280);
  color: oklch(96% 0.02 95);
  font-family: system-ui, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: center;
}

.wrap {
  width: min(100% - 2.5rem, var(--max, 72rem));
  margin-inline: auto;
}
@media (min-width: 48em) {
  .wrap {
    width: min(100% - 4rem, var(--max, 72rem));
  }
}

/* Tarot card: the scans already include the printed border, so the frame only rounds and lifts it. */
.tcard {
  display: block;
  aspect-ratio: 480 / 826;
  border-radius: 4.5% / 2.6%;
  overflow: hidden;
  background: oklch(93% 0.02 85);
  box-shadow: var(--card-shadow);
}
.tcard img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Native disclosure for FAQs: accessible, works without JS. */
.faq details {
  border-top: 1px solid var(--rule);
}
.faq details:last-child {
  border-bottom: 1px solid var(--rule);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.25rem 0;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "";
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  align-self: center;
  background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  transition: transform 0.3s var(--ease-out);
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq summary:active {
  opacity: 0.7;
}
.faq details > div {
  padding: 0 0 1.5rem;
  max-width: 62ch;
}
@media (prefers-reduced-motion: no-preference) {
  :root {
    interpolate-size: allow-keywords;
  }
  .faq details[open] > div {
    animation: faq-open 0.35s var(--ease-out) both;
  }
  @keyframes faq-open {
    from {
      opacity: 0;
      translate: 0 -0.4rem;
    }
  }
  /* Where supported, the answer's height eases open too. */
  .faq details::details-content {
    block-size: 0;
    overflow: clip;
    transition: block-size 0.35s var(--ease-out), content-visibility 0.35s allow-discrete;
  }
  .faq details[open]::details-content {
    block-size: auto;
  }
}
.faq details > div p + p {
  margin-top: 0.75rem;
}

/* Free card draw: shared mechanics, themes restyle the surfaces.
   States: idle -> shuffling -> drawing -> drawn -> settled (phones: card shrinks into a thumbnail
   beside its name so the image and the meaning stay on screen together). */
.pull-stage {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1.25rem;
  padding-block: 1.75rem 0.5rem;
}
.pull-pile {
  --card-w: clamp(12.5rem, 9rem + 8vw, 15.5rem);
  display: grid;
  perspective: 1400px;
}
.pull-pile > * {
  grid-area: 1 / 1;
}
.pull-deck {
  position: relative;
  width: var(--card-w);
  aspect-ratio: 480 / 826;
  padding: 0;
  border: 0;
  background: none;
  transition: scale 0.15s var(--ease-out);
}
.pull-deck:active {
  scale: 0.98;
}
.pull-deck .back:nth-child(1) { --i: 3; }
.pull-deck .back:nth-child(2) { --i: 2; }
.pull-deck .back:nth-child(3) { --i: 1; }
.pull-deck .back:nth-child(4) { --i: 0; }
.pull-deck .back {
  position: absolute;
  inset: 0;
  border-radius: 4.5% / 2.6%;
  background: var(--back) center / cover no-repeat;
  box-shadow: var(--card-shadow);
  transform: translate(calc(var(--i) * -3px), calc(var(--i) * -3px)) rotate(calc(var(--i) * -1.4deg));
  transition: transform 0.5s var(--ease-out), opacity 0.4s var(--ease-out);
}
@media (hover: hover) {
  .pull[data-state="idle"] .pull-deck:hover .back {
    transform: translate(calc(var(--i) * -5px), calc(var(--i) * -6px)) rotate(calc(var(--i) * -2.6deg));
  }
}
.pull[data-state="idle"] .pull-deck:focus-visible .back {
  transform: translate(calc(var(--i) * -5px), calc(var(--i) * -6px)) rotate(calc(var(--i) * -2.6deg));
}
/* The drawn card starts exactly where the deck's top card sits, at the same size. */
.pull-card {
  width: var(--card-w);
  aspect-ratio: 480 / 826;
  transform-style: preserve-3d;
  pointer-events: none;
}
.pull-flip {
  position: relative;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s var(--ease-out) 0.12s;
}
.pull-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 4.5% / 2.6%;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.pull-face.is-back {
  background: var(--back) center / cover no-repeat;
}
.pull-face.is-front {
  transform: rotateY(180deg);
}
.pull-face.is-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pull[data-state="idle"] .pull-card,
.pull[data-state="shuffling"] .pull-card {
  visibility: hidden;
}
.pull:is([data-state="drawing"], [data-state="drawn"], [data-state="settled"]) .back:nth-child(4) {
  visibility: hidden;
}
.pull:is([data-state="drawing"], [data-state="drawn"], [data-state="settled"]) .pull-flip {
  transform: rotateY(180deg);
}
.pull:is([data-state="drawn"], [data-state="settled"]) .back {
  opacity: 0.55;
}
.pull:not([data-state="idle"]) .pull-deck {
  pointer-events: none;
}
.pull:not([data-state="idle"]) .pull-hint {
  visibility: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .pull[data-state="shuffling"] .back:nth-child(odd) {
    animation: shuffle-left 0.38s cubic-bezier(0.65, 0, 0.35, 1);
  }
  .pull[data-state="shuffling"] .back:nth-child(even) {
    animation: shuffle-right 0.38s cubic-bezier(0.65, 0, 0.35, 1);
  }
  .pull[data-state="drawing"] .pull-card {
    animation: pull-lift 0.95s var(--ease-out) both;
  }
}
@keyframes shuffle-left {
  45% {
    translate: -22% 2%;
    rotate: -7deg;
  }
}
@keyframes shuffle-right {
  45% {
    translate: 22% -2%;
    rotate: 7deg;
  }
}
@keyframes pull-lift {
  35% {
    translate: 0 -7%;
    scale: 1.06;
  }
  to {
    translate: 0 0;
    scale: 1;
  }
}

/* Result header: the thumbnail only appears once the card has settled (phones). */
.pull-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1.1rem;
}
.pull-name:focus {
  outline: none;
}
.pull-name:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.pull-thumb {
  display: none;
  width: 5.75rem;
  aspect-ratio: 480 / 826;
  border-radius: 4.5% / 2.6%;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  rotate: -3deg;
}
.pull-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pull-ghost {
  position: fixed;
  z-index: 60;
  margin: 0;
  border-radius: 4.5% / 2.6%;
  box-shadow: var(--card-shadow);
  transform-origin: 0 0;
  pointer-events: none;
  object-fit: cover;
}
.pull-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
@media (max-width: 51.99em) {
  .pull[data-state="settled"] .pull-stage {
    display: none;
  }
  .pull[data-state="settled"] .pull-thumb {
    display: block;
  }
}

/* The section wrapper is the grid; .pull uses display: contents so its parts land in it.
   Intro and result share one cell, so revealing the result never shifts the layout. */
.pull-layout {
  display: grid;
  grid-template-areas: "head" "stage" "text";
  gap: 1.5rem 4rem;
}
@media (min-width: 52em) {
  .pull-layout {
    grid-template-columns: minmax(0, 1fr) 22rem;
    grid-template-areas: "head stage" "text stage";
  }
  .pull-head {
    align-self: end;
  }
  .pull-intro,
  .pull-result {
    align-self: start;
  }
}
.pull {
  display: contents;
}
.pull-head {
  grid-area: head;
}
.pull-stage {
  grid-area: stage;
}
.pull-intro,
.pull-result {
  grid-area: text;
  transition: opacity 0.5s var(--ease-out), translate 0.5s var(--ease-out), visibility 0.5s;
}
.pull-result {
  scroll-margin-top: 1.25rem;
}
.pull[data-state="drawing"] .pull-result {
  transition-delay: 0.55s;
}
.pull-result[hidden] {
  display: block;
  visibility: hidden;
  opacity: 0;
  translate: 0 1rem;
}
.pull:not([data-state="idle"]) .pull-intro {
  visibility: hidden;
  opacity: 0;
  translate: 0 -0.5rem;
}

/* Sticky mobile call to action. */
.sticky-cta {
  position: fixed;
  z-index: 40;
  inset: auto 0.75rem max(0.75rem, env(safe-area-inset-bottom)) 0.75rem;
  translate: 0 calc(100% + 2rem);
  visibility: hidden;
  transition: translate 0.45s var(--ease-out), visibility 0s linear 0.45s;
}
.sticky-cta.is-on {
  translate: 0 0;
  visibility: visible;
  transition: translate 0.45s var(--ease-out), visibility 0s;
}
@media (min-width: 60em) {
  .sticky-cta {
    display: none;
  }
}

/* Scroll-linked entrances, CSS only, skipped where unsupported or reduced motion is set.
   .rise lifts content in; the small card fans in the reading menus spread out as they arrive. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    :is(.menu-fan, .ticket-fan) .tcard {
      animation: fan-in linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 40%;
    }
    :is(.menu-fan, .ticket-fan) .tcard:nth-child(1) {
      animation-name: fan-in-left;
    }
    :is(.menu-fan, .ticket-fan) .tcard:nth-child(3) {
      animation-name: fan-in-right;
    }
    @keyframes fan-in-left {
      from {
        translate: 90% 0.4rem;
        rotate: 0deg;
      }
    }
    @keyframes fan-in {
      from {
        translate: 0 0.6rem;
      }
    }
    @keyframes fan-in-right {
      from {
        translate: -90% 0.4rem;
        rotate: 0deg;
      }
    }
  }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .rise {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
    @keyframes rise {
      from {
        opacity: 0;
        translate: 0 2.5rem;
      }
      to {
        opacity: 1;
        translate: 0 0;
      }
    }
  }
}
