/* ================= the free reading ================= */
#reading {
  position: fixed; inset: 0; z-index: 30;
  background: var(--void); color: var(--text);
  overflow: hidden;
}
#reading[hidden] { display: none; }
body.reading-open .hud, body.reading-open .labels, body.reading-open #card, body.reading-open #hint { visibility: hidden; }

/* the golden city behind everything, as a glowing portal */
.r-backdrop { position: absolute; inset: 0; overflow: hidden; }
.r-backdrop::before {
  content: ''; position: absolute; inset: -10%;
  background: url('../assets/worlds/city-tall.webp') center / cover no-repeat;
  filter: blur(50px) saturate(1.3) brightness(0.45);
}
.r-portal {
  position: absolute; top: 0; bottom: 0; right: 6%; width: min(46vh, 42vw);
  background: url('../assets/worlds/city-tall.webp') center / cover no-repeat;
  -webkit-mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  opacity: 0.9; transition: opacity 1.2s ease, filter 1.2s ease;
}
#reading.results .r-portal { opacity: 0.35; filter: blur(2px); }
.r-backdrop::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(3,4,10,.85), rgba(3,4,10,.45) 55%, rgba(3,4,10,.2));
}

.r-close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 20px; z-index: 5;
  padding: 0.45rem 1rem; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(6, 8, 18, 0.55); backdrop-filter: blur(8px);
  font-size: 0.62rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--soft); cursor: pointer;
}
.r-close:hover { color: var(--text); }

/* ---------- intake ---------- */
.r-intake {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; justify-content: center;
  padding: 80px max(24px, 7vw) 60px;
  max-width: 720px;
}
#reading.weaving .r-intake, #reading.results .r-intake { display: none; }
.r-progress { display: flex; gap: 8px; margin-bottom: 2.4rem; }
.r-progress i { width: 34px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.15); transition: background 0.6s, box-shadow 0.6s; }
.r-progress i.on { background: #ffc23a; box-shadow: 0 0 12px #ffc23a; }
.r-step { display: none; }
.r-step.on { display: block; }
.r-eyebrow, .r-kicker { margin: 0 0 0.9rem; font-size: 0.66rem; letter-spacing: 0.34em; text-transform: uppercase; color: #ffc23a; }
.r-step h2 { margin: 0 0 0.8rem; font-family: var(--display); font-weight: 300; font-size: clamp(1.6rem, 4.2vw, 2.8rem); line-height: 1.15; letter-spacing: 0.02em; }
.r-help { margin: 0 0 1.4rem; max-width: 34rem; color: var(--soft); font-size: 0.95rem; line-height: 1.6; }
.r-step input[type=text], .r-step input[type=date], .r-step input[type=time], .r-gate input[type=email] {
  width: 100%; max-width: 30rem; padding: 1rem 1.2rem;
  border: 1px solid rgba(255,255,255,.18); border-radius: 14px;
  background: rgba(6, 8, 18, 0.6); backdrop-filter: blur(10px);
  color: var(--text); font: inherit; font-size: 1.1rem; color-scheme: dark;
  outline: none; transition: border-color 0.4s, box-shadow 0.5s;
}
.r-step input:focus, .r-gate input:focus { border-color: #ffc23a; box-shadow: 0 0 0 3px rgba(255,194,58,.18), 0 0 30px rgba(255,194,58,.15); }
.r-step input:disabled { opacity: 0.35; }
.r-check { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: 1rem; max-width: 30rem; color: var(--soft); font-size: 0.88rem; line-height: 1.5; cursor: pointer; }
.r-check input { margin-top: 0.2rem; accent-color: #ffc23a; width: 1.05rem; height: 1.05rem; flex: none; }
.r-error { min-height: 1.3em; margin: 0.7rem 0 0; color: #ff8a7a; font-size: 0.88rem; }
.r-actions { display: flex; gap: 12px; margin-top: 1.2rem; }
.r-next, .r-enter {
  padding: 0.95rem 2rem; border: 0; border-radius: 999px; cursor: pointer;
  background: #ffc23a; color: #150d00;
  font-family: var(--display); font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500;
  box-shadow: 0 0 34px rgba(255, 194, 58, 0.4);
  transition: transform 0.4s var(--ease), box-shadow 0.5s;
}
.r-next:hover, .r-enter:hover { transform: translateY(-2px); box-shadow: 0 0 56px rgba(255, 194, 58, 0.6); }
.r-next:disabled { opacity: 0.6; cursor: wait; }
.r-back, .r-redo {
  padding: 0.95rem 1.4rem; border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer;
  font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--soft);
}
.r-back:hover, .r-redo:hover { color: var(--text); }

.r-cities { list-style: none; margin: 0.5rem 0 0; padding: 0; max-width: 30rem; }
.r-cities button {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 0.75rem 1.1rem; margin-top: 6px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: rgba(6, 8, 18, 0.72); backdrop-filter: blur(8px);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.3s, background 0.3s;
}
.r-cities button:hover, .r-cities button:focus-visible { border-color: #ffc23a; background: rgba(40, 30, 8, 0.7); outline: none; }
.r-cities small { color: var(--soft); font-size: 0.78rem; margin-top: 2px; }
.r-none { padding: 0.8rem 0; color: var(--soft); font-size: 0.88rem; }

.r-portals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 1.6rem 0 0.4rem; }
.r-portals button {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 1.4rem 1.2rem; min-height: 150px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 18px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, rgba(6,8,18,.7)), rgba(6,8,18,.75));
  backdrop-filter: blur(10px); color: var(--text); text-align: left; cursor: pointer;
  transition: transform 0.5s var(--ease), box-shadow 0.6s, border-color 0.4s;
}
.r-portals button:hover, .r-portals button:focus-visible { transform: translateY(-4px); border-color: var(--c); box-shadow: 0 0 40px color-mix(in srgb, var(--c) 40%, transparent); outline: none; }
.r-portals b { font-family: var(--display); font-weight: 400; font-size: 0.95rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c); }
.r-portals span { font-size: 0.86rem; line-height: 1.5; color: #cfd5e4; }
.r-portals .r-rec::after { content: 'Recommended'; margin-top: auto; font-size: 0.58rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--c); }

/* ---------- weaving ---------- */
.r-weaving { display: none; position: absolute; inset: 0; z-index: 3; place-items: center; }
#reading.weaving .r-weaving { display: grid; }
.r-orbit { position: relative; width: 240px; height: 240px; animation: spin 7s linear infinite; }
.r-orbit span {
  position: absolute; left: 50%; top: 50%; font-size: 1.4rem; color: #ffc23a; text-shadow: 0 0 14px #ffc23a;
  transform: rotate(calc(var(--i) * 30deg)) translateY(-110px) rotate(calc(var(--i) * -30deg));
  animation: glyph 1.6s ease-in-out calc(var(--i) * 0.12s) infinite alternate;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glyph { from { opacity: 0.25; } to { opacity: 1; } }
.r-weave-text { position: absolute; top: calc(50% + 150px); left: 0; right: 0; text-align: center; margin: 0; font-size: 0.72rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--soft); }

/* ---------- results ---------- */
.r-results { display: none; position: absolute; inset: 0; z-index: 2; overflow-y: auto; outline: none; scroll-behavior: smooth; }
#reading.results .r-results { display: block; animation: fadein 1.2s ease both; }
@keyframes fadein { from { opacity: 0; } }
.r-page { width: min(880px, 100%); margin: 0 auto; padding: 90px 20px 80px; }
.r-hero h2 { margin: 0; font-family: var(--display); font-weight: 300; font-size: clamp(1.8rem, 5vw, 3.4rem); line-height: 1.1; }
.r-who { margin: 1rem 0 0; font-size: 1.15rem; font-weight: 400; }
.r-who span { display: block; margin-top: 0.35rem; font-size: 0.85rem; font-weight: 300; color: var(--soft); letter-spacing: 0.04em; }

.r-sec { margin-top: 3.6rem; }
.r-sec h3 { margin: 0 0 1.4rem; font-family: var(--display); font-weight: 300; font-size: clamp(1.15rem, 2.6vw, 1.6rem); letter-spacing: 0.04em; }
.r-sec .r-kicker { color: var(--c); }
.r-big3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.r-planet, .r-card, .r-num, .r-prose {
  padding: 1.3rem 1.3rem 1.4rem; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--c, #fff) 26%, rgba(255,255,255,.06));
  background: rgba(6, 8, 18, 0.62); backdrop-filter: blur(14px);
}
.r-planet { position: relative; overflow: hidden; }
.r-glyph { position: absolute; right: 0.8rem; top: 0.3rem; font-size: 3.4rem; line-height: 1; color: var(--c); opacity: 0.35; }
.r-role { margin: 0 0 0.3rem; font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--c); }
.r-planet h4, .r-num h4 { margin: 0 0 0.3rem; font-family: var(--display); font-weight: 400; font-size: 1.15rem; letter-spacing: 0.06em; }
.r-deg { margin: 0 0 0.7rem !important; font-size: 0.74rem !important; color: var(--soft) !important; letter-spacing: 0.06em; }
.r-planet p, .r-card p, .r-num p, .r-prose p { margin: 0; font-size: 0.92rem; line-height: 1.65; color: #d4d9e6; }
.r-prose { margin-top: 12px; }
.r-card h4, .r-prose h4 { margin: 0 0 0.6rem; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; color: #fff; }
.r-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.r-glow { box-shadow: 0 0 40px color-mix(in srgb, var(--c) 18%, transparent); }
.r-signature { border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.r-signature p { font-size: 1.02rem; color: #fff; }
.r-bars { display: grid; gap: 8px; }
.r-bars div { display: grid; grid-template-columns: 4.2rem 1fr; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--soft); }
.r-bars i { display: block; height: 8px; width: var(--w); min-width: 3px; border-radius: 8px; background: var(--c); box-shadow: 0 0 12px var(--c); }
.r-note { margin: 1rem 0 0; font-size: 0.74rem; letter-spacing: 0.08em; color: var(--soft); }

.r-numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.r-num.r-lp { grid-column: span 3; }
.r-value { margin: 0 0 0.4rem !important; font-family: var(--display); font-size: 2.2rem !important; font-weight: 300; line-height: 1 !important; color: #fff !important; }
.r-lp .r-value { font-size: 3.2rem !important; }
.r-value sup { margin-left: 0.4rem; font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: #ffc23a; vertical-align: top; }
.r-what { margin-bottom: 0.6rem !important; font-size: 0.78rem !important; color: var(--soft) !important; }
.r-notes { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.r-notes li { padding: 0.8rem 1.1rem; border-radius: 12px; border: 1px solid rgba(255,194,58,.3); background: rgba(40, 30, 8, 0.4); font-size: 0.88rem; line-height: 1.55; }

/* the Zenniverse Code: sealed until the email opens it */
.r-code-card {
  position: relative; overflow: hidden; border-radius: 22px; padding: 2rem 1.8rem;
  border: 1px solid rgba(255, 194, 58, 0.45);
  background: radial-gradient(ellipse at top, rgba(255, 194, 58, 0.16), rgba(6, 8, 18, 0.75) 70%);
  backdrop-filter: blur(14px);
  box-shadow: 0 0 60px rgba(255, 194, 58, 0.12);
}
.r-code-body { transition: filter 1.4s ease, opacity 1.4s ease; filter: blur(12px); opacity: 0.55; user-select: none; }
.r-code.open .r-code-body { filter: none; opacity: 1; user-select: text; }
.r-code-line { margin: 0 0 0.4rem; font-family: var(--display); font-weight: 300; font-size: clamp(1rem, 2.4vw, 1.35rem); letter-spacing: 0.04em; }
.r-code-line:first-child { color: #ffc23a; }
.r-code-sentence { margin: 1.2rem 0 0; font-size: 1.1rem; line-height: 1.6; color: #fff; max-width: 38rem; }
.r-gate {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 1.6rem 1.8rem;
  background: linear-gradient(180deg, rgba(6,8,18,.35), rgba(6,8,18,.7));
  transition: opacity 0.8s ease;
}
.r-code.open .r-gate { opacity: 0; pointer-events: none; }
.r-gate-title { margin: 0 0 0.3rem; font-family: var(--display); font-weight: 300; font-size: 1.3rem; }
.r-gate .r-help { margin-bottom: 0.9rem; }
.r-gate .r-next { align-self: flex-start; margin-top: 0.4rem; }
.r-gate .r-error { min-height: 0; margin: 0.4rem 0 0; }
.r-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.r-code:not(.open) .r-code-card { min-height: 360px; }

.r-generated { text-align: center; padding: 3rem 1rem 0; }
.r-generated h3 { font-size: clamp(1.4rem, 3.6vw, 2.2rem); }
.r-generated p { max-width: 36rem; margin: 0 auto 1.8rem; color: var(--soft); line-height: 1.7; }
.r-generated button { margin: 0 6px 10px; }

@media (max-width: 760px) {
  .r-portal { display: none; }
  .r-backdrop::before { filter: blur(0) saturate(1.1) brightness(0.4); inset: 0; }
  .r-backdrop::after { background: linear-gradient(0deg, rgba(3,4,10,.92), rgba(3,4,10,.6)); }
  .r-intake { padding: 80px 20px 40px; justify-content: flex-end; }
  .r-portals { grid-template-columns: 1fr; }
  .r-portals button { min-height: 0; }
  .r-big3, .r-grid, .r-numbers { grid-template-columns: 1fr; }
  .r-num.r-lp { grid-column: auto; }
  .r-page { padding-top: 70px; }
  .r-code:not(.open) .r-code-card { min-height: 460px; }
}
@media (prefers-reduced-motion: reduce) { .r-orbit { animation: none; } }
