/* ——— Tarot Birth Cards · an almanac of the Major Arcana ——— */
/* Self-hosted Latin subsets (the same files Google Fonts served before). SIL Open Font License, see fonts/OFL-*.txt. */
@font-face { font-family: "IM Fell English"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/im-fell-english-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/im-fell-english-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/im-fell-english-sc-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/spectral-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/spectral-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/spectral-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/spectral-600-normal.woff2") format("woff2"); }

:root {
  --paper: #efe5d0;
  --paper-hi: #f7f0e1;
  --paper-lo: #e3d4b6;
  --ink: #231c15;
  --ink-soft: #5c4e3e;
  --ink-faint: #74644f;
  --oxblood: #8b2c20;
  --oxblood-deep: #5e1c14;
  --gilt: #a8812f;
  --display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --caps: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --text: "Spectral", "Iowan Old Style", Georgia, serif;
  --symbol: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols", "Noto Sans Symbols 2", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font: 400 18px/1.72 var(--text);
  font-variant-numeric: oldstyle-nums;
  background:
    radial-gradient(ellipse at 50% -10%, var(--paper-hi) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 120%, var(--paper-lo) 0%, transparent 60%),
    var(--paper);
  min-height: 100vh;
}
/* Paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  opacity: .38; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .17 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* Vignette */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 99;
  box-shadow: inset 0 0 140px rgba(94, 60, 25, .22);
}

a { color: var(--oxblood); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--oxblood-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 800px; margin: 0 auto; padding: 0 22px; }
.muted { color: var(--ink-faint); }
::selection { background: var(--oxblood); color: var(--paper-hi); }

/* ——— Masthead ——— */
.masthead { text-align: center; padding: 26px 0 10px; }
.masthead-rule {
  display: flex; align-items: center; gap: 14px; margin: 0 0 6px;
  font: 400 .78rem var(--caps); letter-spacing: .18em; color: var(--ink-soft);
}
.masthead-rule::before, .masthead-rule::after { content: ""; flex: 1; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); height: 3px; }
.masthead-rule span:nth-child(2) { color: var(--oxblood); }
.logo {
  display: inline-block; font: 400 clamp(2rem, 6vw, 3.1rem)/1.1 var(--caps);
  letter-spacing: .06em; color: var(--ink); text-decoration: none; margin: 6px 0 4px;
}
.logo:hover { color: var(--ink); }
.masthead nav {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px;
  padding: 8px 0 12px; border-bottom: 1px solid var(--ink);
  font: 400 1rem var(--caps); letter-spacing: .06em; color: var(--ink-faint);
}
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover { color: var(--oxblood); }

/* ——— Typography ——— */
h1, h2, h3 { font-weight: 400; color: var(--ink); }
h1 { font: 400 clamp(2.4rem, 7vw, 4rem)/1.04 var(--display); letter-spacing: -.01em; margin: 40px 0 16px; }
h1 em { color: var(--oxblood); }
h2 {
  font: 400 clamp(1.6rem, 4vw, 2.1rem)/1.15 var(--display);
  margin: 72px 0 18px; display: flex; align-items: baseline; gap: 14px;
}
h2::before { content: "☙"; color: var(--oxblood); font-size: .8em; flex: none; }
h3 { font: 400 1.35rem/1.3 var(--display); font-style: italic; margin: 34px 0 6px; }
p, li { hyphens: auto; text-wrap: pretty; }
h1, h2, h3, .lead, summary { text-wrap: balance; }
/* Keep running text near 70 characters per line; tables and the calculator stay full width. */
main > p, main > ul, main > ol, .faq details p { max-width: 38em; }
ul, ol { padding-left: 1.3em; }
li { margin: 6px 0; }
li::marker { color: var(--oxblood); }
strong { font-weight: 600; }
.lead { font-size: 1.18rem; color: var(--ink-soft); max-width: 36em; }
.breadcrumb { font: 400 .92rem var(--caps); letter-spacing: .05em; color: var(--ink-faint); margin: 26px 0 0; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--oxblood); }

/* Drop cap on the first section of each page */
main > h2:first-of-type + p::first-letter {
  float: left; font: 400 4.6em/.8 var(--display); color: var(--oxblood);
  margin: .08em .1em 0 -.02em;
}

/* ——— Hero (home) ——— */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: center; }
.hero h1 { margin-top: 36px; }
.fan { position: relative; height: 330px; perspective: 900px; }
.fan .tcard { position: absolute; left: 50%; top: 18px; width: 150px; margin-left: -75px; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.fan .tcard:nth-child(1) { transform: translateX(-62px) rotate(-14deg); }
.fan .tcard:nth-child(2) { transform: translateY(-10px); z-index: 2; }
.fan .tcard:nth-child(3) { transform: translateX(62px) rotate(14deg); }
.fan:hover .tcard:nth-child(1) { transform: translateX(-92px) rotate(-20deg); }
.fan:hover .tcard:nth-child(2) { transform: translateY(-22px); }
.fan:hover .tcard:nth-child(3) { transform: translateX(92px) rotate(20deg); }
.fan-caption { position: absolute; bottom: 0; width: 100%; text-align: center; font: italic .9rem var(--display); color: var(--ink-faint); margin: 0; }

/* Load-in */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero > *, .calc { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero > :nth-child(2) { animation-delay: .15s; }
.calc { animation-delay: .3s; }

/* ——— Calculator: the ledger ——— */
.calc {
  position: relative; margin: 34px 0 0; padding: 34px clamp(18px, 5vw, 46px) 26px;
  background: var(--paper-hi);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink); outline-offset: 5px;
  box-shadow: 0 1px 0 var(--paper-hi), 0 22px 40px -22px rgba(60, 35, 15, .45);
}
.calc::before, .calc::after {
  content: "✦"; position: absolute; color: var(--oxblood); font-size: .9rem; line-height: 1;
  background: var(--paper); padding: 0 6px;
}
.calc::before { top: -12px; left: 50%; transform: translateX(-50%); }
.calc::after { bottom: -12px; left: 50%; transform: translateX(-50%); }
.calc-title { font: 400 .85rem var(--caps); letter-spacing: .2em; text-align: center; color: var(--oxblood); margin: 0 0 10px; }
.sentence {
  font: 400 clamp(1.3rem, 3.6vw, 1.75rem)/2.1 var(--display); text-align: center; margin: 0;
}
.sentence select, .sentence input {
  font: inherit; color: var(--oxblood); background: transparent;
  border: 0; border-bottom: 1.5px solid var(--ink); border-radius: 0;
  padding: 0 4px; margin: 0 2px; text-align: center; text-align-last: center;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.sentence input { width: 3.4em; cursor: text; -moz-appearance: textfield; }
.sentence input::-webkit-outer-spin-button, .sentence input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sentence input::placeholder { color: var(--ink-faint); opacity: .7; }
.sentence select:hover, .sentence input:hover { border-bottom-color: var(--oxblood); }
.sentence select:focus-visible, .sentence input:focus-visible { outline: none; background: rgba(139, 44, 32, .08); border-bottom: 2px solid var(--oxblood); }
.calc-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 18px; }
.btn {
  font: 400 1.1rem var(--caps); letter-spacing: .12em; color: var(--paper-hi);
  background: var(--oxblood); border: 0; padding: 12px 30px 13px; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--oxblood), inset 0 0 0 3px var(--paper-hi), inset 0 0 0 4px var(--oxblood);
  transition: background .2s, transform .2s;
}
.btn:hover { background: var(--oxblood-deep); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.error { color: var(--oxblood); font-style: italic; margin: 0; min-height: 1.4em; text-align: center; }
.privacy-note { text-align: center; font: italic .88rem var(--text); color: var(--ink-faint); margin: 0; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ——— Results ——— */
.result { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--ink); scroll-margin-top: 20px; }
.result[hidden] { display: none; }
.result-title { font: 400 1.9rem var(--display); text-align: center; margin: 0; display: block; }
.result-title::before { content: none; }
.result-sub { text-align: center; font: italic 1rem var(--display); color: var(--ink-faint); margin: 2px 0 0; }
.spread { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; margin: 26px 0 18px; perspective: 1100px; }
.readings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 28px; margin: 6px 0 16px; }
.reading h3 { margin: 0 0 2px; font-style: normal; }
.reading .kw { font: italic .92rem var(--display); color: var(--oxblood); margin: 0 0 4px; }
.reading p { margin: 0; }
.ledger { margin: 18px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 8px 0; }
.ledger-title { font: 400 .8rem var(--caps); letter-spacing: .18em; color: var(--ink-faint); margin: 0 0 4px; }
.ledger ol { list-style: none; padding: 0; margin: 0; font-variant-numeric: lining-nums tabular-nums; counter-reset: step; }
.ledger li { margin: 2px 0; display: flex; gap: 10px; counter-increment: step; }
.ledger li::before { content: counter(step, upper-roman) "."; color: var(--oxblood); font: 400 .95rem var(--display); min-width: 2.2em; }
.pair-link { text-align: center; font: italic 1.1rem var(--display); }
.second {
  margin-top: 22px; padding: 14px 18px; background: rgba(168, 129, 47, .1);
  border-left: 3px double var(--oxblood); font-size: .97rem;
}
.second p { margin: 0 0 4px; }
.second .ledger { border: 0; padding: 0; margin: 8px 0 0; }

/* ——— The printed card ——— */
.tcard { margin: 0; width: 150px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tcard-inner { position: relative; width: 100%; aspect-ratio: 7 / 12; }
.tcard-face, .tcard-back {
  position: absolute; inset: 0; border-radius: 9px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 14px 26px -12px rgba(60, 35, 15, .55), 0 2px 4px rgba(60, 35, 15, .2);
}
.tcard-face {
  background: linear-gradient(180deg, #fbf6ea, #f1e6cd);
  border: 1px solid #b9a37c;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 10% 9% 9%;
}
.tcard-face::before { content: ""; position: absolute; inset: 6px; border: 1.5px solid var(--ink); border-radius: 5px; pointer-events: none; }
.tcard-face::after { content: ""; position: absolute; inset: 9px; border: .5px solid var(--ink); border-radius: 3px; pointer-events: none; }
.tcard-num { font: 400 1.25rem/1 var(--display); letter-spacing: .06em; position: relative; font-variant-numeric: lining-nums; }
/* IM Fell only has old-style figures, so The Fool's 0 would read as a letter o. */
.tcard-num.zero { font-family: var(--text); font-weight: 500; }
.tcard-emblem { width: 78%; overflow: visible; }
.em-ring { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.em-ring.thin { stroke-width: .7; }
.em-ticks { stroke: var(--oxblood); stroke-width: 1.6; stroke-linecap: round; }
.em-glyph { font: 400 34px var(--symbol); fill: var(--oxblood); text-anchor: middle; dominant-baseline: central; }
.em-line { fill: none; stroke: var(--oxblood); stroke-width: 3.2; stroke-linejoin: round; }
.tcard-name {
  position: relative; width: 100%; text-align: center; font: 400 .98rem/1.15 var(--caps); letter-spacing: .03em;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 5px 2px 6px; background: var(--paper-hi);
}
.tcard-attr { position: relative; font: italic .72rem/1 var(--display); color: var(--ink-faint); margin-top: -4px; }
.tcard-role { font: 400 .78rem var(--caps); letter-spacing: .2em; color: var(--oxblood); }
.tcard-back {
  border: 1px solid var(--oxblood-deep);
  background:
    radial-gradient(circle at 50% 50%, transparent 0 18%, var(--gilt) 18.5% 19.5%, transparent 20%),
    repeating-conic-gradient(from 0deg at 50% 50%, var(--oxblood) 0 15deg, var(--oxblood-deep) 15deg 30deg);
  transform: rotateY(180deg); backface-visibility: hidden;
}
.tcard-back::before { content: ""; position: absolute; inset: 7px; border: 1.5px solid var(--gilt); border-radius: 5px; }
.is-dealt .tcard-inner { transform-style: preserve-3d; animation: deal 1s cubic-bezier(.2, .75, .25, 1) both; animation-delay: var(--d, 0ms); }
.is-dealt .tcard-face { backface-visibility: hidden; }
@keyframes deal {
  0% { opacity: 0; transform: translateY(-40px) rotate(-8deg) rotateY(180deg); }
  25% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.is-dealt .tcard-role { animation: rise .6s both; animation-delay: calc(var(--d, 0ms) + 700ms); }
.spread .tcard:hover .tcard-inner, .fan .tcard:hover { cursor: default; }

/* ——— Content blocks ——— */
table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .96rem; font-variant-numeric: lining-nums; }
thead th { font: 400 .95rem var(--caps); letter-spacing: .06em; text-align: left; border-top: 3px double var(--ink); border-bottom: 1px solid var(--ink); padding: 8px 10px; }
td { border-bottom: 1px solid rgba(35, 28, 21, .18); padding: 9px 10px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 3px double var(--ink); }
tbody tr:hover td { background: rgba(168, 129, 47, .08); }
.table-scroll { overflow-x: auto; }
.example { border: 1px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 3px; background: var(--paper-hi); padding: 14px 20px; margin: 22px 4px; }
.example p { margin: 4px 0; }
.callout {
  position: relative; margin: 26px 0; padding: 18px 22px 16px 26px;
  background: rgba(139, 44, 32, .06); border-left: 3px double var(--oxblood);
}
.callout p { margin: 6px 0; }
.faq details { border-bottom: 1px solid rgba(35, 28, 21, .25); }
.faq details:first-of-type { border-top: 3px double var(--ink); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 2px; font: 400 1.22rem/1.35 var(--display);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "✦"; color: var(--oxblood); font-size: .8rem; line-height: 1.9; transition: transform .3s; flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--oxblood); }
.faq details p { margin: 0 2px 16px; }

/* Pages: a static spread of cards */
.spread-static { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; margin: 30px 0 8px; }
.spread-static .tcard { transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
.spread-static .tcard:hover { transform: translateY(-6px) rotate(-1deg); }

.pair-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 0; list-style: none; margin: 20px 0; }
.pair-links li { margin: 0; }
.pair-links li::marker { content: none; }
.pair-links a {
  display: block; height: 100%; padding: 14px 18px; text-decoration: none; color: var(--ink);
  background: var(--paper-hi); border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  font: 400 1.15rem/1.3 var(--display); transition: transform .2s, box-shadow .2s;
}
.pair-links a:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--oxblood); color: var(--oxblood); }
.pair-links small { display: block; font: italic .88rem var(--text); color: var(--ink-faint); margin-top: 2px; }

/* ——— Colophon ——— */
.colophon { margin-top: 90px; padding: 10px 0 44px; text-align: center; color: var(--ink-soft); font-size: .92rem; }
.colophon .wrap { border-top: 1px solid var(--ink); }
.colophon p { margin: 6px 0; }
.fleuron { font-size: 1.6rem; color: var(--oxblood); margin: 14px 0 4px !important; }
.colophon-links { font: 400 1rem var(--caps); letter-spacing: .06em; }

/* ——— Small screens ——— */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .hero { grid-template-columns: 1fr; gap: 0; }
  .hero h1 { margin-top: 26px; }
  .fan { display: none; }
  .lead { font-size: 1.05rem; }
  .tcard { width: 116px; }
  .tcard-num { font-size: 1.05rem; }
  .tcard-name { font-size: .82rem; }
  .spread, .spread-static { gap: 12px; }
  h2 { margin-top: 56px; }
  table { font-size: .9rem; }
  td, thead th { padding: 7px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
