/* The tarot page keeps the site's layout but wears black and gold, under an eclipse. */
.tarot {
  --navfill: #0a0a0a;
  --deep: #000;
  --gold: #e9bd4e;
  --gold-hot: #ffdf8a;
  --ink: #f3ead2;
  --ink-soft: rgba(243, 234, 210, 0.86);
  --line: rgba(233, 189, 78, 0.65);
  --panel: rgba(0, 0, 0, 0.72);
  --shadow: #000;
  min-height: 100vh; display: flex; flex-direction: column;
  background: none;
}
html:has(.tarot) { background: #000; }
/* the eclipse, pinned behind the page and darkened so black and gold stay in charge */
.tarot::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.62) 55%, rgba(0, 0, 0, 0.8)),
    #000 url("assets/eclipse.webp") center top / cover no-repeat;
}
.tarot .topbar { position: static; }
.tarot main { flex: 1; text-align: center; padding: 12px var(--gutter) 64px; }
.tarot h1 { font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); text-shadow: 0 2px 18px #000; }
.tarot footer { background: rgba(0, 0, 0, 0.82); }

/* ---- choosing a spread ---- */
.spreads { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin: 18px auto 0; }
.spreads button {
  font: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer;
  color: var(--gold); background: var(--panel);
  padding: 7px 18px 8px; border: 1.5px solid var(--line); border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.spreads button:hover { background: rgba(233, 189, 78, 0.18); }
.spreads button[aria-pressed="true"] { background: var(--gold); color: #000; }
.spreads button:focus-visible, #gather:focus-visible { outline: 3px solid var(--gold-hot); outline-offset: 3px; }
.tarot .lede { color: var(--ink-soft); margin: 16px auto 0; max-width: 40ch; text-shadow: 0 1px 10px #000; }
.tarot .howto {
  margin: 10px auto 0; color: var(--gold); font-style: italic; font-weight: 600;
  text-shadow: 0 1px 10px #000;
}

/* ---- the cards ---- */
.spread { margin: clamp(18px, 3vh, 30px) auto 0; display: grid; justify-content: center; }
.spread.one { grid-template-columns: min(93vw, 420px, 45vh); }
.spread.three { grid-template-columns: repeat(3, min(29vw, 300px)); gap: clamp(10px, 3vw, 28px); }
/* Celtic cross: a cross of six on the left, a staff of four on the right */
.spread.celtic {
  --w: min(19.5vw, 177px);
  grid-template-columns: repeat(4, var(--w));
  grid-template-rows: repeat(8, calc(var(--w) * 0.8667));
  column-gap: calc(var(--w) * 0.24); row-gap: calc(var(--w) * 0.1);
}
.celtic .s1, .celtic .s2 { grid-area: 4 / 2 / 6 / 3; }
.celtic .s3 { grid-area: 6 / 2 / 8 / 3; }
.celtic .s4 { grid-area: 4 / 1 / 6 / 2; }
.celtic .s5 { grid-area: 2 / 2 / 4 / 3; }
.celtic .s6 { grid-area: 4 / 3 / 6 / 4; }
.celtic .s7 { grid-area: 7 / 4 / 9 / 5; }
.celtic .s8 { grid-area: 5 / 4 / 7 / 5; }
.celtic .s9 { grid-area: 3 / 4 / 5 / 5; }
.celtic .s10 { grid-area: 1 / 4 / 3 / 5; }
.celtic .s2 { z-index: 2; pointer-events: none; rotate: 90deg; scale: 0.8; }
.celtic .s2 .tcard { pointer-events: auto; }
.celtic .s2 .num { rotate: -90deg; }

.slot { position: relative; perspective: 1400px; }
.slot .pos { display: block; margin-top: 10px; color: var(--gold); font-weight: 600; font-size: 1.05em; text-shadow: 0 1px 8px #000; }
.slot .num {
  position: absolute; left: 50%; bottom: -0.55em; translate: -50% 0; z-index: 3;
  min-width: 1.5em; padding: 0 0.3em; line-height: 1.5; font-size: 0.8rem; font-weight: 700;
  color: #000; background: var(--gold); border-radius: 999px; pointer-events: none;
}
.tcard {
  display: block; width: 100%; aspect-ratio: 300 / 520; padding: 0; border: 0; background: none;
  position: relative; cursor: pointer; border-radius: 7% / 4%;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.3, 0.9, 0.3, 1), scale 0.25s ease;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.tcard.shown { transform: rotateY(180deg); }
.tcard.holding { scale: 0.96; }
.tcard:focus-visible { outline: 3px solid var(--gold-hot); outline-offset: 6px; }
.tcard .side {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 30px rgba(233, 189, 78, 0.25);
  transition: box-shadow 0.3s ease;
}
.tcard.holding .side { box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 60px rgba(255, 223, 138, 0.75); transition-duration: 0.2s; }
.tcard .side svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.tcard .front { transform: rotateY(180deg); }
.tcard .art { display: block; width: 100%; height: 100%; }
.tcard .art.reversed { rotate: 180deg; }
/* the bar that fills while the card is held */
.holdbar {
  position: absolute; left: 0; bottom: 0; height: 5%; width: 100%;
  background: var(--gold-hot); transform: scaleX(0); transform-origin: left; opacity: 0.95;
}
.tcard.holding .holdbar { transform: scaleX(1); transition: transform 0.2s linear; }

.tcard .sunrays { transform-origin: 150px 260px; animation: sun-turn 60s linear infinite; }
@keyframes sun-turn { to { transform: rotate(360deg); } }

#gather {
  margin-top: 30px; font: inherit; font-size: 1.05rem; font-weight: 600; cursor: pointer;
  color: var(--gold); background: var(--panel); padding: 8px 20px 9px;
  border: 1.5px solid var(--line); border-radius: 999px;
}
#gather:hover { background: rgba(233, 189, 78, 0.18); }
#gather[hidden] { display: none; }

/* ---- what the cards say ---- */
.reading { max-width: 720px; margin: 22px auto 0; display: grid; gap: 16px; text-align: left; }
.rcard {
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 22px;
  padding: clamp(18px, 3vw, 28px) clamp(18px, 3.5vw, 32px);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: rise 0.6s ease both;
}
.rcard.flash { animation: flash 1.2s ease; }
.rcard .rpos { color: var(--gold); font-weight: 700; letter-spacing: 0.04em; margin-bottom: 0.35em; }
.rcard .rpos b { display: inline-block; min-width: 1.5em; text-align: center; color: #000; background: var(--gold); border-radius: 999px; margin-right: 0.3em; font-size: 0.85em; }
.rcard .rpos span { color: var(--ink-soft); font-weight: 500; font-style: italic; letter-spacing: 0; }
.rcard h2 { font-size: 1.7em; text-shadow: none; margin-bottom: 0.3em; }
.rcard h2 em { font-size: 0.62em; font-weight: 500; color: var(--ink-soft); white-space: nowrap; }
.rcard .verdict { font-size: 3em; font-weight: 700; line-height: 1; color: var(--gold-hot); margin-bottom: 0.15em; }
@keyframes rise { from { opacity: 0; translate: 0 14px; } }
@keyframes flash { 30% { border-color: var(--gold-hot); box-shadow: 0 0 40px rgba(255, 223, 138, 0.5); } }

@media (max-width: 560px) {
  .slot .pos { font-size: 0.95em; }
  .rcard h2 { font-size: 1.45em; }
}
@media (prefers-reduced-motion: reduce) {
  .tcard { transition: none; }
  .tcard .sunrays, .rcard { animation: none; }
}

/* ---- the questions above the generator, and the invitation below it ---- */
.tsub { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 26px; margin: 4px auto 18px; padding: 0 var(--gutter); }
.tsub a {
  color: var(--gold); font-style: italic; font-weight: 600; font-size: 1.1rem; text-decoration: none;
  padding: 4px 2px; border-bottom: 1px solid var(--line); text-shadow: 0 1px 10px #000;
  transition: color 0.2s, border-color 0.2s;
}
.tsub a:hover, .tsub a:focus-visible, .tsub a[aria-current] { color: var(--gold-hot); border-bottom-color: var(--gold-hot); }
.tsub a[aria-current] { border-bottom-width: 2px; }
.tbook {
  display: block; max-width: 720px; margin: 56px auto 0; padding: clamp(22px, 4vw, 36px);
  text-decoration: none; text-align: center;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: 22px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tbook:hover, .tbook:focus-visible { border-color: var(--gold-hot); box-shadow: 0 0 44px rgba(233, 189, 78, 0.35); }
.tbook b { display: block; color: var(--gold); font-size: 1.6em; font-weight: 600; line-height: 1.15; }
.tbook span { display: block; margin-top: 0.4em; color: var(--ink-soft); font-style: italic; }
.tbook i { display: inline-block; margin-top: 0.9em; color: var(--gold); font-style: normal; font-weight: 700; }

/* ---- the tarot subpages ---- */
.tpage { max-width: 720px; margin: 0 auto; }
.tpage .panel {
  margin-top: 26px; text-align: left; background: var(--panel); border: 1.5px solid var(--line); border-radius: 22px;
  padding: clamp(22px, 4vw, 40px); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.tpage .panel.center { text-align: center; }
.tpage .panel p + p { margin-top: 0.9em; }
.tpage .note { font-style: italic; color: var(--ink-soft); }
.tpage .cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 1.6em; }
.tarot .btn { color: #000; box-shadow: 0 5px 0 #000, 0 0 30px rgba(233, 189, 78, 0.35); }
.tarot .btn.ghost { background: rgba(0, 0, 0, 0.6); color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }

/* the Rider-Waite-Smith pictures on the card faces */
.tcard .art img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tcard .front { background: #0b0b0b; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8); }   /* no gold edge or glow on a revealed card */

/* the tarot page without the Art Deco frames */
:root body.clean :is(.rcard, .tbook, .tpage .panel) { border: 0; outline: 0; box-shadow: none; }

/* pictures are placed whole, exactly as scanned: no box, no clipping, no matching to one shape */
.tcard .front { background: none; box-shadow: none; overflow: visible; border-radius: 0; }
.tcard .front .art { overflow: visible; }
.tcard .art img { object-fit: contain; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.75)); }

/* the jacket: the hand and the golden threads */
.tcard .jacket { background: #050706; }
.tcard .jacket .jpic { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

/* the new background picture, with nothing laid over it: no darkening, no frame, no pattern */
.tarot::before { background: #000 url("assets/tarot-bg.jpg") center / cover no-repeat; }
html:has(body.tarot)::before, html:has(body.tarot)::after { display: none; }
body.tarot::after { display: none; }

/* pitch black background */
.tarot::before { background: #000; }

/* the star field canvas sits behind everything on the page */
.sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; pointer-events: none; }

/* black satin background; the star-field canvas is gone */
.sky { display: none; }
.tarot::before { background: #000 url("assets/tarot-satin.jpg") center / cover no-repeat; }

/* uniform deep blue background */
.tarot::before { background: #010048; }
html:has(.tarot) { background: #010048; }

/* pitch black background */
.tarot::before { background: #000; }
html:has(.tarot) { background: #000; }

/* deep green-black background */
.tarot::before { background: #010a05; }
html:has(.tarot) { background: #010a05; }

/* the Past / Present / Future labels: twice the size, bolder, a richer gold */
:root body.tarot .slot .pos {
  font-size: 1.44rem; font-weight: 700; letter-spacing: 0.16em; color: #ffd45e;
  text-shadow: 0 0 14px rgba(255, 200, 60, 0.45), 0 1px 8px #000;
}

/* the page title: bold, a tenth bigger, with as much room below as above */
:root body.tarot h1 {
  font-size: clamp(1.925rem, 0.77rem + 4.84vw, 4.84rem);
  font-weight: 700; -webkit-text-stroke: 1.8px var(--gold);
}
.spreads { margin-top: 30px; }

/* the four spread buttons as Art Deco plaques: chamfered corners, a gold edge and an inner line */
:root body.tarot .spreads button {
  --cut: 13px;
  position: relative; isolation: isolate; border: 0; outline: 0; border-radius: 0;
  background: var(--metal); color: var(--gold);
  font-weight: 700; font-size: 0.82rem; letter-spacing: 0.2em; padding: 16px 30px 14px;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
:root body.tarot .spreads button::before {
  content: ""; position: absolute; inset: 1.5px; z-index: -2; background: #060806;
  clip-path: polygon(calc(var(--cut) - 1px) 0, calc(100% - var(--cut) + 1px) 0, 100% calc(var(--cut) - 1px), 100% calc(100% - var(--cut) + 1px), calc(100% - var(--cut) + 1px) 100%, calc(var(--cut) - 1px) 100%, 0 calc(100% - var(--cut) + 1px), 0 calc(var(--cut) - 1px));
}
:root body.tarot .spreads button::after {
  content: ""; position: absolute; inset: 5px; z-index: -1; border: 1px solid var(--line);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 9px 100%, 0 calc(100% - 9px), 0 9px);
}
:root body.tarot .spreads button:hover { background: var(--metal); filter: brightness(1.2); }
:root body.tarot .spreads button[aria-pressed="true"] { background: var(--metal); color: #000; }
:root body.tarot .spreads button[aria-pressed="true"]::before { background: var(--metal); }
:root body.tarot .spreads button[aria-pressed="true"]::after { border-color: rgba(0, 0, 0, 0.5); }

/* Art Deco rules above and below the title: a line, a diamond, a line */
.titlewrap { display: flex; flex-direction: column; align-items: center; }
.titlewrap::before, .titlewrap::after {
  content: ""; display: block; width: min(460px, 82%); height: 16px; flex: none;
  background: var(--metal);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 16' preserveAspectRatio='none'%3E%3Cpath d='M0 6.5h138v1H0zM0 9.5h118v1H0zM182 6.5h138v1H182zM202 9.5h118v1H202zM160 1l7 7-7 7-7-7zM144 4.5l3.5 3.5-3.5 3.5-3.5-3.5zM176 4.5l3.5 3.5-3.5 3.5-3.5-3.5z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 16' preserveAspectRatio='none'%3E%3Cpath d='M0 6.5h138v1H0zM0 9.5h118v1H0zM182 6.5h138v1H182zM202 9.5h118v1H202zM160 1l7 7-7 7-7-7zM144 4.5l3.5 3.5-3.5 3.5-3.5-3.5zM176 4.5l3.5 3.5-3.5 3.5-3.5-3.5z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.titlewrap::before { margin-bottom: 8px; }
.titlewrap::after { margin-top: 8px; }

/* a little more air between the four spread buttons */
.spreads { gap: 16px 20px; }

/* no rules around the title */
.titlewrap::before, .titlewrap::after { display: none; }

/* the three question links twice as big; 50% more room before and after the title */
.tsub a { font-size: 2.2rem; line-height: 1.2; }
.tsub { gap: 8px 36px; }
.titlewrap { margin-top: 15px; }
.spreads { margin-top: 45px; }

/* the three question links back to half that size */
.tsub a { font-size: 1.1rem; line-height: normal; }
.tsub { gap: 6px 26px; }

/* the five cards: past, present, future in a row, the challenge and the advice centred beneath them */
.spread.five { --w: min(27.5vw, 237px); --g: clamp(10px, 2.5vw, 26px); grid-template-columns: repeat(3, var(--w)); gap: var(--g); }
.five .s1 { grid-area: 1 / 1; }
.five .s2 { grid-area: 1 / 2; }
.five .s3 { grid-area: 1 / 3; }
.five .s4 { grid-area: 2 / 1; translate: calc((var(--w) + var(--g)) / 2) 0; }
.five .s5 { grid-area: 2 / 2; translate: calc((var(--w) + var(--g)) / 2) 0; }


/* ---------- the tarot library: searchable catalogue and one-card page ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lsearch { max-width: 560px; margin: 26px auto 0; }
.lsearch input {
  width: 100%; font: inherit; font-size: 1.25rem; color: var(--ink); text-align: center; padding: 14px 18px;
  background: rgba(0, 0, 0, 0.55); border: 1.5px solid var(--gold); border-radius: 999px; outline: none;
}
.lsearch input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.lsearch input:focus { box-shadow: 0 0 0 3px rgba(233, 189, 78, 0.3), 0 0 28px rgba(233, 189, 78, 0.25); }
.lcount { margin: 14px 0 0; font-family: "Josefin Sans", sans-serif; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.8rem; color: var(--ink-soft); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 22px; max-width: 1100px; margin: 28px auto 0; }
.lcard { display: block; text-decoration: none; color: var(--ink); transition: transform 0.2s; }
.lcard[hidden] { display: none; }
.lcard:hover, .lcard:focus-visible { transform: translateY(-4px); }
.lpic { display: block; aspect-ratio: 3 / 5; }
.lpic img, .lpic .svgface { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.7)); transition: filter 0.2s; }
.lcard:hover .lpic img, .lcard:focus-visible .lpic img, .lcard:hover .lpic .svgface { filter: drop-shadow(0 0 16px rgba(233, 189, 78, 0.6)); }
.lname { display: block; margin-top: 10px; font-size: 1.05rem; line-height: 1.2; text-shadow: 0 1px 8px #000; }
.lcard:hover .lname { color: var(--gold-hot); }
.lnone { margin-top: 40px; font-style: italic; color: var(--ink-soft); }

.cardpage { max-width: 960px; margin: 24px auto 0; display: grid; grid-template-columns: minmax(0, 380px) 1fr; gap: clamp(28px, 6vw, 70px); align-items: start; text-align: left; }
.cpic { margin: 0; }
.cpic img, .cpic .svgface { width: 100%; height: auto; display: block; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8)); }
.ckicker { margin: 0 0 0.4em; font-family: "Josefin Sans", sans-serif; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.8rem; color: var(--gold-hot); }
:root body.tarot .ctext h1 { text-align: left; font-size: clamp(2rem, 1rem + 3vw, 3.4rem); margin: 0 0 0.4em; }
:root body.tarot .ctext h2 { font-family: "Josefin Sans", sans-serif; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.95rem; color: var(--gold); margin: 1.6em 0 0.5em; }
.ctext p:not(.ckicker) { font-size: 1.18rem; line-height: 1.6; max-width: 56ch; }
.cnav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2.2em; }
@media (max-width: 760px) { .cardpage { grid-template-columns: 1fr; } .cpic { width: min(70%, 300px); margin-inline: auto; } .lgrid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 22px 14px; } }
:root body.tarot .ctext h2::after { display: none; }

.lhead { grid-column: 1 / -1; text-align: center; margin-top: 26px; }
.lhead[hidden] { display: none; }
.lgrid > .lhead:first-child { margin-top: 0; }
:root body.tarot .lhead h2 { font-size: clamp(1.7rem, 1rem + 2vw, 2.6rem); font-weight: 700; margin: 0; color: var(--gold); }
:root body.tarot .lhead h2::after { display: none; }
.lhead p { margin: 4px 0 0; font-family: "Josefin Sans", sans-serif; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.8rem; color: var(--ink-soft); }
.lfind { margin: 22px 0 0; }
.cnav .btn[hidden] { display: none; }
