:root {
  --paper: #f6efe3;
  --card: #fbf6ec;
  --ink: #1c1a17;
  --accent: #b8452b;
}

html, body { margin: 0; min-height: 100%; background: var(--paper); }
a { color: inherit; }
a:hover { color: inherit; }

@keyframes ea-spin { to { transform: rotate(360deg); } }
@keyframes ea-spin-rev { to { transform: rotate(-360deg); } }
@keyframes ea-float {
  0%, 100% { transform: rotate(0deg) translateY(-6px); }
  50% { transform: rotate(0deg) translateY(-12px); }
}

.page {
  position: relative;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  font-family: 'EB Garamond', Georgia, serif;
  display: flex;
  flex-direction: column;
}

.grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(28,26,23,.14) 0.6px, transparent 0.6px);
  background-size: 5px 5px;
  opacity: .5;
  pointer-events: none;
}

.ring { position: absolute; border-radius: 50%; pointer-events: none; }
.ring-1 { left: -12vmin; top: -18vmin; width: 140vmin; height: 140vmin; border: 1px solid rgba(28,26,23,.22); animation: ea-spin 300s linear infinite; }
.ring-2 { left: -2vmin; top: -6vmin; width: 115vmin; height: 115vmin; border: 1px dashed rgba(28,26,23,.22); animation: ea-spin-rev 210s linear infinite; }
.ring-3 { left: 14vmin; top: 18vmin; width: 68vmin; height: 68vmin; border: 1px solid rgba(28,26,23,.18); animation: ea-spin 135s linear infinite; }

.line { position: absolute; left: 34%; top: -30%; width: 1px; height: 160%; background: rgba(28,26,23,.16); pointer-events: none; }
.line-1 { transform: rotate(32deg); }
.line-2 { transform: rotate(-58deg); }

.dot { position: absolute; background: var(--ink); border-radius: 50%; }
.dot-1 { left: 18%; top: 43%; width: 5px; height: 5px; }
.dot-2 { left: 43%; top: 18%; width: 4px; height: 4px; }
.dot-3 { left: 28%; top: 80%; width: 3px; height: 3px; }
.dot-4 { left: 87%; top: 90%; width: 3px; height: 3px; }

.masthead {
  position: relative;
  padding: clamp(28px, 4vw, 44px) clamp(28px, 4.7vw, 56px) 0;
  font-size: clamp(11px, .9vw, 12px);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(28,26,23,.7);
}
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.masthead a { text-decoration: none; }
.masthead a:hover, .masthead a:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: .3em; }

/* "Join Waitlist" in the masthead: turns the Star card like the card itself */
.masthead .masthead-join {
  margin: -9px 0;
  padding: 9px 14px 8px 16px; /* extra left padding balances the trailing letter-spacing */
  border: 1px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--ink);
  transition: color .2s, border-color .2s, box-shadow .2s;
}
.masthead .masthead-join:hover,
.masthead .masthead-join[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 0 var(--accent);
  text-decoration: none;
}
.masthead .masthead-join:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; text-decoration: none; }

.hero {
  position: relative;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: clamp(40px, 6vw, 80px) clamp(32px, 5vw, 64px);
  padding: clamp(32px, 6vh, 72px) clamp(28px, 6vw, 72px) clamp(48px, 8vh, 96px);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.intro { flex: 1 1 320px; }

.title {
  flex: 1 1 320px;
  margin: 0;
  font-family: Federo, serif;
  font-weight: 400;
  font-size: clamp(56px, 8vw, 96px);
  line-height: .92;
  letter-spacing: -.01em;
  text-wrap: balance;
}


a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Workings: the app list under the title ---------- */

.works { margin-top: clamp(32px, 5vh, 48px); max-width: 26rem; }
.works-title {
  margin: 0 0 12px;
  font-family: Federo, serif;
  font-weight: 400;
  font-size: clamp(11px, .9vw, 12px);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(28,26,23,.7);
}
.work {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(28,26,23,.22);
  border-bottom: 1px solid rgba(28,26,23,.22);
  text-decoration: none;
}
.work-icon { flex: none; width: 56px; height: 56px; }
.work-text { display: flex; flex-direction: column; gap: 2px; }
.work-name {
  font-family: Federo, serif;
  font-size: 22px;
  letter-spacing: .02em;
  line-height: 1.15;
}
.work-num { color: var(--accent); }
.work-line { font-size: 17px; line-height: 1.35; font-style: italic; }
.work:hover .work-name { color: var(--accent); }

/* ---------- The Star: a card that turns over ---------- */

.deck {
  position: relative;
  flex: none;
  width: clamp(248px, 24vw, 300px);
  aspect-ratio: 3 / 5;
  margin-inline: auto;
  perspective: 1600px;
}
.deck-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.2,.8,.2,1);
}

.card {
  position: absolute; inset: 0;
  display: block;
  box-sizing: border-box;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--ink);
  box-shadow: 0 1px 0 var(--ink), 0 30px 60px -30px rgba(28,26,23,.45);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  container-type: inline-size;
}

.card-front {
  cursor: pointer;
  transform: rotate(4deg);
  transition: transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .5s, visibility 0s;
}
.card-front:hover, .card-front:focus-visible {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 1px 0 var(--ink), 0 50px 80px -30px rgba(28,26,23,.5);
  animation: ea-float 3s ease-in-out .5s infinite;
}
.card-front:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

.card-back {
  transform: rotateY(180deg);
  visibility: hidden;
  transition: visibility 0s .4s;
}

/* Open: JS adds .is-open; without JS, #join:target or a server-set state does it. */
.deck.is-open .deck-inner,
html:not(.js) #join:target .deck-inner,
html:not(.js) body[data-waitlist] .deck-inner { transform: rotateY(180deg); }

.deck.is-open .card-back,
html:not(.js) #join:target .card-back,
html:not(.js) body[data-waitlist] .card-back { visibility: visible; transition-delay: 0s; }

.deck.is-open .card-front,
html:not(.js) #join:target .card-front,
html:not(.js) body[data-waitlist] .card-front {
  visibility: hidden;
  animation: none;
  transition: transform .5s cubic-bezier(.2,.8,.2,1), box-shadow .5s, visibility 0s .4s;
}

.deck.no-anim .deck-inner,
.deck.no-anim .card { transition: none !important; }

.card-border-outer { position: absolute; inset: 4%; border: 1px solid var(--ink); pointer-events: none; }
.card-border-inner { position: absolute; inset: 6%; border: 3px double var(--ink); pointer-events: none; }
.card-numeral {
  position: absolute; top: 7%; left: 0; right: 0;
  text-align: center;
  font-family: Federo, serif;
  font-size: 7.3cqw;
  letter-spacing: .2em;
}
.card-star {
  position: absolute; top: 22%; left: 50%;
  transform: translateX(-50%);
  font-size: 50cqw;
  line-height: 1;
  color: var(--accent);
}
.card-name {
  position: absolute; bottom: 13%; left: 0; right: 0;
  text-align: center;
  font-family: Federo, serif;
  font-size: 8.7cqw;
  letter-spacing: .14em;
}

/* ---------- Waitlist form (card back and /join) ---------- */

.card-back .waitlist {
  position: absolute;
  inset: 6%;
  padding: 5% 8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: auto;
}

.waitlist-mark {
  margin: 0 0 4px;
  text-align: center;
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
}
.waitlist-title {
  margin: 0 0 14px;
  text-align: center;
  font-family: Federo, serif;
  font-weight: 400;
  font-size: clamp(14px, 6.2cqw, 17px);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.card-back .waitlist-title { white-space: nowrap; letter-spacing: .1em; }

.waitlist-status { margin: 0; font-size: 15px; line-height: 1.35; }
.waitlist-status:focus { outline: none; }
.waitlist-status:not(:empty) { margin-bottom: 10px; }
.waitlist[data-state="error"] .waitlist-status,
.waitlist[data-state="invalid"] .waitlist-status { color: #9a3620; }
.waitlist[data-state="joined"] .waitlist-status {
  margin: 8px 0 18px;
  text-align: center;
  font-family: Federo, serif;
  font-size: 21px;
  line-height: 1.3;
}
.waitlist[data-state="joined"] .waitlist-form { display: none; }

/* No-JS state messages (body[data-waitlist] is set by the Worker) */
.nojs-msg { display: none; }
body[data-waitlist="joined"] .nojs-joined,
body[data-waitlist="error"] .nojs-error,
body[data-waitlist="invalid"] .nojs-invalid { display: block; margin-bottom: 10px; }
body[data-waitlist="error"] .nojs-error,
body[data-waitlist="invalid"] .nojs-invalid { color: #9a3620; }
body[data-waitlist="joined"] .nojs-joined {
  margin: 8px 0 18px;
  text-align: center;
  font-family: Federo, serif;
  font-size: 21px;
}
body[data-waitlist="joined"] .waitlist-form { display: none; }

.waitlist-form { margin: 0; }
.field { margin: 0 0 12px; }
.field label {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.field input {
  box-sizing: border-box;
  width: 100%;
  padding: 5px 2px 4px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
}
.field input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.field input[aria-invalid="true"] { border-bottom-color: #9a3620; }

/* Honeypot: off-screen, not display:none so naive bots still fill it */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.waitlist-submit {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px 9px;
  font-family: Federo, serif;
  font-size: 14px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--card);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.waitlist-submit:hover { background: var(--accent); border-color: var(--accent); }
.waitlist-submit:disabled { cursor: progress; background: #5d5a54; border-color: #5d5a54; }

.waitlist-consent {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.35;
  font-style: italic;
  text-align: center;
}
.waitlist-consent a { text-underline-offset: .15em; }


/* Standalone /join page: the card back, laid flat */
.join-card {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 360px);
  margin-inline: auto;
  padding: 36px 32px 30px;
  background: var(--card);
  border: 1px solid var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: -8px;
  box-shadow: 0 1px 0 var(--ink), 0 30px 60px -30px rgba(28,26,23,.45);
}

/* ---------- Plain pages (privacy, join, 404) ---------- */

.notfound-text {
  flex: 1 1 320px;
  margin: 0;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
}

.prose {
  position: relative;
  flex: 1;
  box-sizing: border-box;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(32px, 6vh, 64px) clamp(28px, 6vw, 72px) clamp(48px, 8vh, 80px);
  font-size: clamp(17px, 1.3vw, 19px);
  line-height: 1.55;
  overflow-wrap: break-word;
}
.prose h1 {
  margin: 0 0 .6em;
  font-family: Federo, serif;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -.01em;
}
.prose h2 {
  margin: 1.8em 0 .4em;
  font-family: Federo, serif;
  font-weight: 400;
  font-size: clamp(17px, 1.4vw, 19px);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.prose p, .prose ul { margin: 0 0 .8em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .3em; }
.prose li::marker { color: var(--accent); content: "✶  "; }
.prose .updated { font-style: italic; color: rgba(28,26,23,.7); }
.prose h3 { margin: 1.4em 0 .25em; font-size: 1em; font-weight: 500; }
.prose b { font-weight: 500; }

/* ---------- App pages (/biblehearth) ---------- */

.masthead-nav { display: flex; gap: 20px; }

.app-head { display: flex; align-items: center; gap: clamp(16px, 3vw, 28px); margin-bottom: 1.2em; }
.app-icon { flex: none; width: clamp(72px, 12vw, 104px); height: auto; }
.app-head h1 { margin: 0; }
.app-kicker {
  margin: 0 0 .5em !important;
  font-size: clamp(11px, .9vw, 12px);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: rgba(28,26,23,.7);
}
.prose .lede { font-size: 1.15em; line-height: 1.45; }
.app-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-style: italic;
}
.app-badge {
  padding: 9px 14px 8px 16px;
  font-family: Federo, serif;
  font-style: normal;
  font-size: 13px;
  letter-spacing: .2em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  background: var(--card);
  box-shadow: 0 1px 0 var(--ink);
}
.prose .lessons { columns: 2 14rem; column-gap: 2rem; }
.prose .lessons li { break-inside: avoid; }
.prose .fineprint {
  margin-top: 2.4em;
  padding-top: 1em;
  border-top: 1px solid rgba(28,26,23,.2);
  font-size: .85em;
  font-style: italic;
  color: rgba(28,26,23,.72);
}

/* ---------- Legal footer ---------- */

.legal {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  padding: 0 clamp(20px, 4.7vw, 56px) clamp(24px, 4vw, 40px);
  font-size: clamp(13px, 1vw, 14px);
  line-height: 1.55;
  color: rgba(28,26,23,.72);
  overflow-wrap: break-word;
  text-wrap: pretty;
}
.legal-inner {
  padding-top: 16px;
  border-top: 1px solid rgba(28,26,23,.2);
}
.legal p { margin: 0; }
.legal .legal-name { color: var(--ink); font-weight: 500; }
.legal a { text-underline-offset: .18em; }
.legal a:hover { color: var(--ink); }
.legal .sep { padding: 0 .35em; }

@media (max-width: 480px) {
  .dot-4 { display: none; }
  .card-back .field { margin-bottom: 8px; }
  .card-back .waitlist-mark { font-size: 18px; }
  .card-back .waitlist-title { margin-bottom: 10px; }
  .card-back .waitlist-submit { padding: 9px 10px 8px; letter-spacing: .1em; }
  .card-back .waitlist-consent { font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .deck-inner, .card, .card-front, .card-back { transition: none !important; }
}
