:root {
  --wine: #071d27;
  --wine-light: #123b45;
  --ink: #111817;
  --cream: #f4e8ca;
  --paper: #ead5a5;
  --gold: #d99a31;
  --gold-bright: #f3c35d;
  --rust: #9f271d;
  --shadow: rgba(10, 2, 2, .55);
}

@font-face {
  font-family: "Jacobine Display";
  src: url("assets/fonts/P052-Roman.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Jacobine Display";
  src: url("assets/fonts/P052-Italic.otf") format("opentype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% -10%, rgba(27, 87, 96, .6), transparent 38rem),
    radial-gradient(circle at 15% 55%, rgba(130, 43, 28, .22), transparent 30rem),
    linear-gradient(145deg, #031117, var(--wine) 55%, #020c11);
  font-family: Georgia, "Times New Roman", serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-radial-gradient(circle at 15% 40%, rgba(255,255,255,.025) 0 1px, transparent 1px 5px);
  mix-blend-mode: soft-light;
  opacity: .65;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
}

button { font: inherit; }

.masthead {
  position: relative;
  text-align: center;
  padding: 0;
}

.masthead::after {
  content: "";
  display: block;
  width: min(32rem, 78vw);
  height: 1px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.sigil {
  color: var(--gold-bright);
  font-size: 2rem;
  text-shadow: 0 0 24px rgba(243,195,93,.55);
  animation: breathe 3.5s ease-in-out infinite;
}

.eyebrow, .step, .card-roman {
  margin: .8rem 0;
  color: var(--gold-bright);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
}

h1 {
  margin: .35rem 0 .5rem;
  color: var(--gold-bright);
  font-family: "Jacobine Display", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 400;
  font-size: clamp(3.15rem, 10vw, 7rem);
  line-height: .86;
  letter-spacing: -.055em;
  text-shadow: 0 5px 26px rgba(0,0,0,.45), 0 0 30px rgba(217,154,49,.13);
}

h1 span {
  display: block;
  color: var(--gold);
  font-size: .42em;
  font-style: italic;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.subtitle {
  width: min(38rem, 90vw);
  margin: 1.25rem auto 0;
  color: #ddcba7;
  font-style: italic;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
}

main { padding: 0 1rem 5rem; }

.opening-frame {
  position: relative;
  width: min(100%, 1536px);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  color: #111d1e;
  overflow: hidden;
}

.opening-art,
.opening-art img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.opening-art img { object-fit: contain; }

.opening-content {
  position: absolute;
  z-index: 1;
  inset: 10% 21% 8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.opening-frame .eyebrow { margin: 0 0 .35rem; color: #17343a; }

.opening-frame h1 {
  margin: 0;
  color: #bd701b;
  font-size: clamp(3.4rem, 7.2vw, 6.6rem);
  line-height: .78;
  text-shadow: 0 1px 0 #ffe09a, 0 2px 0 #102f38, 0 4px 15px rgba(91,45,8,.22);
}

.opening-frame h1 span { color: #a94e13; }

.opening-frame .subtitle {
  margin-top: .75rem;
  color: #263e3d;
  font-size: clamp(.82rem, 1.5vw, 1.1rem);
}

.opening-frame .masthead::after {
  width: min(24rem, 70%);
  background: linear-gradient(90deg, transparent, #8a541e, transparent);
}

.opening-frame .intro { margin-top: .55rem; }
.opening-frame .ornament { color: #a64a17; font-size: .8rem; }

.opening-frame .intro h2 {
  margin: .4rem 0 .35rem;
  color: #102c33;
  font-family: "Jacobine Display", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.opening-frame .intro p {
  max-width: 38rem;
  margin: .35rem auto;
  color: #1f3839;
  font-size: clamp(.82rem, 1.35vw, 1.02rem);
  line-height: 1.45;
}

.opening-frame .intro .aside {
  color: #74401f;
  font-size: clamp(.72rem, 1.1vw, .87rem);
}

.opening-frame .primary-button {
  margin-top: 0;
  color: #f6df9b;
  border-color: #0b313a;
  background: linear-gradient(180deg, #164954, #082b35);
  box-shadow: 0 7px 18px rgba(31,25,8,.25), inset 0 1px rgba(255,255,255,.15);
}

.opening-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .65rem;
  margin-top: .75rem;
}

.gallery-entry-button {
  padding: .88rem 1.15rem;
  cursor: pointer;
  color: #0b3038;
  border: 1px solid #0b3038;
  background: rgba(240,198,111,.42);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}

.gallery-entry-button:hover {
  color: #f6df9b;
  background: #0b3038;
  transform: translateY(-2px);
}

.gallery-entry-button:focus-visible {
  outline: 3px solid #8c2d18;
  outline-offset: 3px;
}

.panel {
  width: min(49rem, 100%);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem);
  text-align: center;
  border: 1px solid rgba(217,154,49,.5);
  outline: 1px solid rgba(217,154,49,.15);
  outline-offset: -9px;
  background: linear-gradient(155deg, rgba(13,54,64,.84), rgba(3,21,29,.94));
  box-shadow: 0 28px 70px var(--shadow), inset 0 0 50px rgba(217,154,49,.04);
}

.ornament { color: var(--gold); letter-spacing: .25em; }

h2 {
  margin: .85rem 0 1rem;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.intro p, .section-heading p {
  max-width: 38rem;
  margin: 1rem auto;
  color: #eadfc7;
  font-size: clamp(1rem, 2.3vw, 1.18rem);
  line-height: 1.7;
}

.intro .aside {
  color: #c6ad82;
  font-size: .95rem;
  font-style: italic;
}

.method {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.3rem;
  align-items: start;
  width: min(54rem, calc(100% - 1rem));
  margin: 2rem auto 4rem;
  padding: clamp(1.5rem, 4vw, 2.4rem);
  text-align: left;
  color: #142d31;
  border: 1px solid #b46a1d;
  outline: 1px solid rgba(9,44,52,.5);
  outline-offset: -8px;
  background: linear-gradient(145deg, #e7b75e, #f0c977 55%, #dca34c);
  box-shadow: 0 20px 45px rgba(0,0,0,.35);
}

.method-seal {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  color: var(--wine);
  background: var(--gold-bright);
  border: 3px double var(--wine);
  border-radius: 50%;
  font-family: "Jacobine Display", Georgia, serif;
  font-size: 1.65rem;
  font-style: italic;
  box-shadow: 0 0 0 3px rgba(217,154,49,.18);
}

.method-kicker {
  margin: 0 0 .25rem !important;
  color: #8c2d18 !important;
  font-size: .66rem !important;
  font-style: normal !important;
  font-weight: 700;
  letter-spacing: .14em;
  line-height: 1.4 !important;
  text-transform: uppercase;
}

.method h3 {
  margin: 0 0 .65rem;
  color: #0b3038;
  font-family: "Jacobine Display", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 400;
}

.method p:not(.method-kicker) {
  margin: .55rem 0;
  color: #273b39;
  font-size: .91rem;
  line-height: 1.62;
}

.method strong { color: #8c2d18; font-weight: 700; }

.method-facts {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.method-facts li {
  padding: .38rem .58rem;
  color: #0b3038;
  border: 1px solid rgba(11,48,56,.45);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.primary-button, .secondary-button {
  cursor: pointer;
  border: 1px solid var(--gold-bright);
  color: #250708;
  background: linear-gradient(180deg, #f4ca71, #d89a32);
  box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px rgba(255,255,255,.5);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.primary-button {
  margin-top: 1.3rem;
  padding: 1rem 1.55rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.primary-button:hover, .secondary-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 14px 34px rgba(0,0,0,.45), 0 0 24px rgba(217,154,49,.15);
}

.primary-button:focus-visible, .secondary-button:focus-visible, .card-choice:focus-visible, .close-reading:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 4px;
}

.button-star { display: inline-block; margin-right: .4em; }
.primary-button.shuffling .button-star { animation: spin .65s linear infinite; }

.deck-section {
  width: min(78rem, 100%);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.section-heading { text-align: center; margin: 1rem auto 2.2rem; }
.section-heading .step { font-size: .7rem; line-height: 1.4; }

.deck {
  display: grid;
  grid-template-columns: repeat(11, minmax(62px, 1fr));
  justify-content: center;
  align-items: start;
  gap: clamp(.35rem, .8vw, .8rem);
  perspective: 1200px;
}

.card-choice {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 0;
  cursor: pointer;
  border: 0;
  border-radius: 5px;
  background: url('assets/card-back.webp') center / cover;
  box-shadow: 0 7px 16px rgba(0,0,0,.46);
  transition: transform .24s ease, filter .24s ease, box-shadow .24s ease;
  animation: deal .55s cubic-bezier(.2,.8,.25,1) both;
  animation-delay: calc(var(--i) * 25ms);
}

.card-choice::after {
  content: "";
  position: absolute;
  inset: 4%;
  border: 1px solid rgba(255,211,110,.45);
  border-radius: 3px;
}

.card-choice:hover {
  z-index: 2;
  transform: translateY(-10px) rotate(var(--tilt));
  filter: brightness(1.13);
  box-shadow: 0 18px 25px rgba(0,0,0,.55), 0 0 18px rgba(227,168,53,.23);
}

.reading {
  position: relative;
  width: min(66rem, 100%);
  margin: 1rem auto 0;
  display: grid;
  grid-template-columns: minmax(240px, .78fr) minmax(300px, 1.22fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding: clamp(1.25rem, 5vw, 4rem);
  border-top: 1px solid rgba(217,154,49,.6);
  border-bottom: 1px solid rgba(217,154,49,.6);
  background: radial-gradient(circle at 18% 45%, rgba(36,101,105,.34), transparent 45%);
}

.close-reading {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 2.7rem;
  height: 2.7rem;
  cursor: pointer;
  border: 0;
  color: var(--gold-bright);
  background: transparent;
  font-size: 2rem;
}

.reading-card-wrap { perspective: 1400px; }

.revealed-card {
  transform-style: preserve-3d;
  animation: reveal .9s cubic-bezier(.2,.75,.2,1) both;
}

.revealed-card img {
  display: block;
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--gold);
  box-shadow: 0 30px 55px rgba(0,0,0,.58), 0 0 45px rgba(217,154,49,.12);
}

.reading-copy h2 { color: var(--gold-bright); }

.reading-copy h3 {
  margin: 1.6rem 0 .7rem;
  color: var(--gold);
  font-size: .76rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.divider { display: flex; align-items: center; gap: .6rem; color: var(--gold); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.divider::after { background: linear-gradient(90deg, var(--gold), transparent); }

blockquote {
  margin: 0;
  color: #f3e8d0;
  font-size: clamp(1.13rem, 2.4vw, 1.4rem);
  font-style: italic;
  line-height: 1.62;
}

.meaning { color: #deceb0; line-height: 1.65; }

.secondary-button {
  margin-top: 1.25rem;
  padding: .8rem 1rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.reading-actions, .gallery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem 1.1rem;
}

.text-button {
  padding: .6rem .15rem;
  cursor: pointer;
  color: var(--gold-bright);
  border: 0;
  border-bottom: 1px solid rgba(217,154,49,.45);
  background: transparent;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.text-button:hover { color: var(--cream); border-color: var(--cream); }
.text-button:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; }

.gallery {
  width: min(66rem, 100%);
  margin: 4.5rem auto 0;
  padding: 3.5rem clamp(1rem, 4vw, 3rem);
  border: 1px solid rgba(217,154,49,.35);
  background: linear-gradient(155deg, rgba(13,57,66,.62), rgba(2,20,28,.82));
  box-shadow: 0 25px 60px rgba(0,0,0,.28);
}

.gallery-heading {
  max-width: 42rem;
  margin: 0 auto 2.2rem;
  text-align: center;
}

.gallery-heading h2 {
  color: var(--gold-bright);
  font-family: "Jacobine Display", Georgia, serif;
}

.gallery-heading > p:last-child {
  color: #d6c5a7;
  line-height: 1.65;
}

.carousel {
  display: grid;
  grid-template-columns: 3.5rem minmax(220px, 390px) 3.5rem;
  justify-content: center;
  align-items: center;
  gap: clamp(.5rem, 3vw, 2rem);
}

.gallery-stage {
  position: relative;
  outline: none;
  touch-action: pan-y;
}

.gallery-stage:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 7px;
}

.gallery-stage img {
  display: block;
  width: 100%;
  border: 1px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 25px 48px rgba(0,0,0,.52);
  transition: opacity .18s ease, transform .18s ease;
}

.gallery-stage.changing img { opacity: .3; transform: scale(.975); }

.gallery-caption {
  margin-top: 1rem;
  text-align: center;
}

.gallery-caption p {
  margin: 0 0 .2rem;
  color: var(--gold);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.gallery-caption h3 {
  margin: 0;
  color: var(--cream);
  font-family: "Jacobine Display", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 400;
}

.gallery-caption .gallery-keywords {
  max-width: 34rem;
  margin: .65rem auto 0;
  color: #d9bb78;
  font-size: .74rem;
  font-weight: 400;
  letter-spacing: .09em;
  line-height: 1.55;
  text-transform: uppercase;
}

.carousel-arrow {
  display: grid;
  place-items: center;
  width: 3.3rem;
  height: 3.3rem;
  cursor: pointer;
  color: var(--gold-bright);
  border: 1px solid rgba(217,154,49,.65);
  border-radius: 50%;
  background: rgba(38,7,9,.8);
  font-size: 1.35rem;
  transition: background .2s ease, transform .2s ease;
}

.carousel-arrow:hover { background: var(--wine-light); transform: scale(1.07); }
.carousel-arrow:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }

.gallery-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .42rem;
  max-width: 28rem;
  margin: 1.8rem auto 0;
}

.gallery-actions {
  justify-content: center;
  margin-top: 1.5rem;
}

.gallery-dot {
  width: .55rem;
  height: .55rem;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: transparent;
}

.gallery-dot[aria-current="true"] { background: var(--gold-bright); transform: scale(1.25); }

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: #9f8665;
  text-align: center;
  font-size: .78rem;
  line-height: 1.5;
}

footer span { color: var(--gold); }

[hidden] { display: none !important; }

@keyframes breathe { 50% { opacity: .55; transform: scale(.82) rotate(18deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes deal { from { opacity: 0; transform: translateY(-45px) rotate(3deg) scale(.86); } }
@keyframes reveal { from { opacity: 0; transform: rotateY(95deg) scale(.82); } to { opacity: 1; transform: rotateY(0) scale(1); } }

@media (max-width: 820px) {
  .deck { grid-template-columns: repeat(7, minmax(45px, 1fr)); }
  .reading { grid-template-columns: minmax(210px, .72fr) minmax(280px, 1.28fr); gap: 2rem; }
}

@media (max-width: 620px) {
  main { padding-inline: .25rem; }
  .opening-frame { aspect-ratio: 9 / 16; }
  .opening-content { inset: 13% 11% 8%; }
  .opening-frame h1 { font-size: clamp(3rem, 15vw, 4.5rem); }
  .opening-frame h1 span { font-size: .37em; }
  .opening-frame .subtitle { width: 88%; font-size: .79rem; line-height: 1.25; }
  .opening-frame .masthead::after { margin-top: .65rem; }
  .opening-frame .intro { margin-top: .35rem; }
  .opening-frame .intro h2 { font-size: clamp(1.45rem, 7vw, 2rem); }
  .opening-frame .intro p { max-width: 92%; font-size: .82rem; line-height: 1.4; }
  .opening-frame .intro .aside { font-size: .7rem; }
  .opening-actions { gap: .45rem; margin-top: .55rem; }
  .opening-frame .primary-button,
  .gallery-entry-button { padding: .72rem .82rem; font-size: .64rem; }
  .panel { padding: 2.2rem 1.35rem; }
  .method { grid-template-columns: 1fr; text-align: center; }
  .method-seal { margin: 0 auto; }
  .method-facts { justify-content: center; }
  .deck { grid-template-columns: repeat(6, minmax(42px, 1fr)); gap: .45rem; }
  .card-choice:hover { transform: translateY(-5px); }
  .reading { grid-template-columns: 1fr; padding: 2.7rem 1rem 2rem; }
  .reading-card-wrap { width: min(74vw, 330px); margin: 0 auto; }
  .reading-copy { text-align: center; }
  .reading-actions { justify-content: center; }
  .meaning { text-align: left; }
  blockquote { text-align: left; }
  .gallery { margin-top: 3rem; padding: 2.6rem .8rem; }
  .carousel { grid-template-columns: 2.65rem minmax(0, 1fr) 2.65rem; gap: .45rem; }
  .carousel-arrow { width: 2.55rem; height: 2.55rem; }
  .gallery-stage { max-width: 74vw; margin: auto; }
  footer { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
