/* ==========================================================================
   THE ELON ORACLE — orient-luxury design system
   Dark mode default. Light ("parchment") mode via [data-theme="light"].
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;900&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,500&family=Syne:wght@600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ol-bg: #09080b;
  --ol-bg-elevated: #121016;
  --ol-bg-card: #15121a;
  --ol-gold: #c9a84c;
  --ol-gold-bright: #e9cf82;
  --ol-gold-dim: #8a6820;
  --ol-text: #ece6d6;
  --ol-text-dim: #a89f8c;
  --ol-border: rgba(201, 168, 76, 0.28);
  --ol-shadow: rgba(0, 0, 0, 0.6);
  --ol-danger: #b5573f;

  --ol-font-display: 'Cinzel', serif;
  --ol-font-body: 'Cormorant Garamond', serif;
  --ol-font-label: 'Syne', sans-serif;
  --ol-font-mono: 'IBM Plex Mono', monospace;
}

[data-theme="light"] {
  --ol-bg: #f0ebe0;
  --ol-bg-elevated: #e8e0cf;
  --ol-bg-card: #fbf8f0;
  --ol-gold: #8a6820;
  --ol-gold-bright: #6e5119;
  --ol-gold-dim: #b8964a;
  --ol-text: #241f14;
  --ol-text-dim: #5c5340;
  --ol-border: rgba(138, 104, 32, 0.35);
  --ol-shadow: rgba(90, 70, 30, 0.18);
  --ol-danger: #8f3722;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ol-bg);
  color: var(--ol-text);
  font-family: var(--ol-font-body);
  min-height: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  position: relative;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Defensive: no single element (long unbroken text, an oversized SVG, etc.)
   should ever be able to widen the page past the viewport on mobile. */
.ol-shell,
.ol-invocation,
.ol-card,
.ol-prophecy-title,
.ol-prophecy-verse,
.ol-invocation h2,
.ol-invocation p {
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
}

.ol-shell {
  width: 100%;
}

img {
  max-width: 100%;
}

/* --- grain overlay --- */
.ol-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.5;
  mix-blend-mode: soft-light;
}

/* --- radiant backdrop (ambient god-glow behind everything) --- */
.ol-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 900px 600px at 50% 8%, rgba(201, 168, 76, 0.16), transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 90%, rgba(201, 168, 76, 0.06), transparent 60%);
  transition: background 0.4s ease;
}
[data-theme="light"] .ol-backdrop {
  background:
    radial-gradient(ellipse 900px 600px at 50% 8%, rgba(138, 104, 32, 0.12), transparent 60%),
    radial-gradient(ellipse 700px 500px at 85% 90%, rgba(138, 104, 32, 0.05), transparent 60%);
}

.ol-shell {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 90px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================== HEADER ============================== */

.ol-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.ol-crest {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ol-crest-mark {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.ol-crest-text .ol-eyebrow {
  display: block;
  font-family: var(--ol-font-label);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ol-gold);
  opacity: 0.85;
  margin-bottom: 2px;
}

.ol-crest-text h1 {
  margin: 0;
  font-family: var(--ol-font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ol-text);
  text-transform: uppercase;
}

.ol-theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--ol-border);
  background: var(--ol-bg-elevated);
  color: var(--ol-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  flex-shrink: 0;
}

.ol-theme-toggle:hover {
  border-color: var(--ol-gold);
  box-shadow: 0 0 18px rgba(201, 168, 76, 0.35);
  transform: rotate(20deg);
}

.ol-theme-toggle svg { width: 20px; height: 20px; }

/* ============================== HERO / INVOCATION ============================== */

.ol-invocation {
  text-align: center;
  margin: 30px 0 44px;
}

.ol-invocation .ol-kicker {
  font-family: var(--ol-font-label);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ol-gold);
  opacity: 0.8;
}

.ol-invocation h2 {
  font-family: var(--ol-font-display);
  font-weight: 900;
  font-size: clamp(32px, 6vw, 52px);
  letter-spacing: 0.02em;
  margin: 10px 0 14px;
  background: linear-gradient(180deg, var(--ol-gold-bright), var(--ol-gold) 55%, var(--ol-gold-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.25);
  line-height: 1.08;
}

.ol-invocation p {
  font-size: 19px;
  font-style: italic;
  color: var(--ol-text-dim);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ============================== HALO ICON FRAME (signature element) ============================== */

.ol-icon-frame {
  position: relative;
  width: min(340px, 68vw);
  height: min(340px, 68vw);
  margin: 6px auto 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ol-rays {
  position: absolute;
  inset: -18%;
  z-index: 0;
  animation: ol-rotate 90s linear infinite;
  opacity: 0.9;
}

.ol-rays.ol-rays-reverse {
  animation-direction: reverse;
  animation-duration: 130s;
  opacity: 0.45;
  inset: -30%;
}

@keyframes ol-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ol-halo-ring {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid var(--ol-border);
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.08),
    0 0 60px rgba(201, 168, 76, 0.18),
    inset 0 0 40px rgba(201, 168, 76, 0.12);
  animation: ol-pulse 4.5s ease-in-out infinite;
}

@keyframes ol-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(201,168,76,0.08), 0 0 40px rgba(201,168,76,0.14), inset 0 0 30px rgba(201,168,76,0.08); }
  50% { box-shadow: 0 0 0 1px rgba(201,168,76,0.14), 0 0 70px rgba(201,168,76,0.30), inset 0 0 50px rgba(201,168,76,0.16); }
}

.ol-icon-portrait {
  position: relative;
  z-index: 2;
  width: 76%;
  height: 76%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--ol-gold);
  box-shadow:
    0 0 0 8px var(--ol-bg),
    0 0 0 9px var(--ol-border),
    0 20px 50px var(--ol-shadow);
  background: var(--ol-bg-elevated);
}

.ol-icon-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.5s ease;
}

.ol-icon-portrait.ol-loading img {
  opacity: 0.25;
  filter: blur(2px) saturate(0.5);
}

/* ============================== TRANSMISSION CARD ============================== */

.ol-card {
  width: 100%;
  background: var(--ol-bg-card);
  border: 1px solid var(--ol-border);
  border-radius: 4px;
  padding: 34px clamp(20px, 5vw, 48px) 38px;
  position: relative;
  box-shadow: 0 24px 60px var(--ol-shadow);
}

.ol-card::before,
.ol-card::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid var(--ol-gold);
  opacity: 0.7;
}
.ol-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.ol-card::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.ol-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ol-border);
}

.ol-transmission-no {
  font-family: var(--ol-font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ol-gold);
  opacity: 0.85;
}

.ol-publish-date {
  font-family: var(--ol-font-label);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ol-text-dim);
}

.ol-testament {
  font-family: var(--ol-font-label);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ol-gold);
  margin-bottom: 10px;
}

.ol-prophecy-title {
  font-family: var(--ol-font-display);
  font-weight: 600;
  font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.28;
  margin: 0 0 16px;
  color: var(--ol-text);
}

.ol-prophecy-verse {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ol-text-dim);
  margin: 0 0 26px;
}

.ol-prophecy-verse::before { content: "\201C"; color: var(--ol-gold); }
.ol-prophecy-verse::after { content: "\201D"; color: var(--ol-gold); }

.ol-fallback-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ol-font-mono);
  font-size: 11px;
  color: var(--ol-danger);
  opacity: 0.85;
  margin-bottom: 18px;
}

.ol-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.ol-scripture-link {
  font-family: var(--ol-font-label);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ol-text);
  text-decoration: none;
  border-bottom: 1px solid var(--ol-gold);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.ol-scripture-link:hover {
  color: var(--ol-gold-bright);
  border-color: var(--ol-gold-bright);
}

/* ============================== SUMMON BUTTON ============================== */

.ol-summon-wrap {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.ol-summon-btn {
  position: relative;
  font-family: var(--ol-font-label);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ol-bg);
  background: linear-gradient(135deg, var(--ol-gold-bright), var(--ol-gold) 60%, var(--ol-gold-dim));
  border: none;
  border-radius: 2px;
  padding: 17px 44px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(201, 168, 76, 0.25), inset 0 1px 0 rgba(255,255,255,0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ol-summon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(201, 168, 76, 0.4), inset 0 1px 0 rgba(255,255,255,0.5);
}

.ol-summon-btn:active {
  transform: translateY(0);
}

.ol-summon-btn:disabled {
  cursor: wait;
  opacity: 0.75;
  transform: none;
}

/* ============================== FOOTER ============================== */

.ol-footer {
  margin-top: 60px;
  text-align: center;
  font-family: var(--ol-font-mono);
  font-size: 11px;
  color: var(--ol-text-dim);
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* ============================== ERROR STATE ============================== */

.ol-error-banner {
  width: 100%;
  border: 1px solid rgba(181, 87, 63, 0.5);
  background: rgba(181, 87, 63, 0.08);
  color: var(--ol-danger);
  font-family: var(--ol-font-body);
  font-size: 17px;
  font-style: italic;
  text-align: center;
  padding: 20px 24px;
  border-radius: 4px;
  margin-bottom: 24px;
  display: none;
}

.ol-error-banner.ol-visible { display: block; }

/* ============================== RESPONSIVE ============================== */

@media (max-width: 560px) {
  .ol-shell { padding: 32px 16px 70px; }
  .ol-crest-text h1 { font-size: 17px; }
  .ol-card { padding: 26px 20px 30px; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ol-rays, .ol-halo-ring { animation: none; }
}
