/* ===================================================
   OCCULT ORACLE — Design System
   Aesthetic: Tarot / Victorian Divinatory Print
   =================================================== */

:root {
  --ink:       #1a1208;
  --parchment: #f2e8d0;
  --parch-mid: #e8d9b8;
  --parch-dk:  #d4c49a;
  --gold:      #b8862a;
  --gold-lt:   #d4a843;
  --gold-dim:  #7a5a1a;
  --crimson:   #8b1a1a;
  --shadow:    rgba(26, 18, 8, 0.35);
  --shadow-lg: rgba(26, 18, 8, 0.55);
  --border:    rgba(184, 134, 42, 0.45);
  --border-str:rgba(184, 134, 42, 0.75);

  --ff-display: 'Oswald', sans-serif;
  --ff-heading: 'Montserrat', sans-serif;
  --ff-body:    'Inter', sans-serif;
  --ff-stamp:   'PT Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--ff-body);
  background-color: #100d06;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, #2a1f08 0%, transparent 65%),
    radial-gradient(ellipse 60% 80% at 50% 100%, #1a0d0d 0%, transparent 60%);
  color: var(--parchment);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── Texture overlays ── */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse 90% 90% at 50% 50%, transparent 40%, rgba(0,0,0,0.72) 100%);
}

/* ── Layout ── */
.page-shell {
  position: relative;
  z-index: 10;
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 32px 60px;
}

/* ── Header ── */
.site-header {
  text-align: center;
  margin-bottom: 48px;
}

.header-ornament {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--gold);
  font-size: 1.1rem;
}

.header-ornament.flip {
  margin-top: 18px;
  margin-bottom: 0;
  transform: scaleY(-1);
}

.header-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  max-width: 200px;
}

.orn {
  opacity: 0.7;
}

.branding h1 {
  font-family: var(--ff-display);
  font-size: clamp(1.25rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-lt);
  text-shadow: 0 0 40px rgba(184,134,42,0.3);
  line-height: 1.25;
}

.branding-sub {
  font-family: var(--ff-heading);
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--gold-dim);
  margin-top: 6px;
}

.header-controls {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  padding: 8px 16px;
  background: rgba(26, 18, 8, 0.6);
  border-radius: 4px;
}

.language-label {
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  color: var(--gold-dim);
  text-transform: uppercase;
}

.language-select {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(26, 18, 8, 0.8);
  color: var(--parchment);
  padding: 7px 32px 7px 12px;
  border-radius: 3px;
  min-width: 150px;
  font-family: var(--ff-body);
  font-size: 0.9rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23b8862a' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s;
}

.language-select:focus {
  outline: none;
  border-color: var(--gold);
}

/* ── Hero Panel (Tarot Card Frame) ── */
.hero-panel {
  margin-bottom: 48px;
}

.tarot-frame {
  position: relative;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(26,18,8,0.96) 0%, rgba(18,12,4,0.98) 100%);
  padding: 52px 48px 48px;
  text-align: center;
  box-shadow:
    0 0 0 6px rgba(184,134,42,0.08),
    0 0 0 7px rgba(184,134,42,0.2),
    0 40px 80px rgba(0,0,0,0.6);
}

/* Corner ornaments via pseudo-elements on helper divs */
.tarot-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--gold);
  border-style: solid;
  opacity: 0.6;
}
.tarot-corner.tl { top: 14px; left: 14px;  border-width: 1px 0 0 1px; }
.tarot-corner.tr { top: 14px; right: 14px; border-width: 1px 1px 0 0; }
.tarot-corner.bl { bottom: 14px; left: 14px;  border-width: 0 0 1px 1px; }
.tarot-corner.br { bottom: 14px; right: 14px; border-width: 0 1px 1px 0; }

/* ── Eye of Providence ── */
.eye-symbol {
  width: 100px;
  margin: 0 auto 28px;
  color: var(--gold);
  opacity: 0.7;
  animation: eye-pulse 4s ease-in-out infinite;
}

@keyframes eye-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 0.9; transform: scale(1.03); }
}

.hero-title {
  font-family: var(--ff-heading);
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.3;
  color: var(--parchment);
  margin-bottom: 14px;
}

.hero-sub {
  font-family: var(--ff-body);
  font-style: italic;
  color: var(--parch-dk);
  font-size: 1rem;
  margin-bottom: 20px;
}

.divider-ornament {
  color: var(--gold);
  font-size: 1.4rem;
  letter-spacing: 0.3em;
  margin: 24px 0;
  opacity: 0.65;
}

/* ── Form Card ── */
.step-card {
  text-align: left;
  max-width: 480px;
  margin: 0 auto;
}

.field-row {
  margin-bottom: 22px;
}

.field-row label,
.gender-fieldset legend {
  display: block;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
}

.step-card input[type="text"],
.step-card input[type="date"] {
  width: 100%;
  background: rgba(18, 12, 4, 0.85);
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border-str);
  color: var(--parchment);
  padding: 14px 16px;
  font-family: var(--ff-body);
  font-size: 1rem;
  border-radius: 3px;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.step-card input[type="text"]:focus,
.step-card input[type="date"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(184,134,42,0.15);
}

.step-card input::placeholder {
  color: rgba(242, 232, 208, 0.3);
  font-style: italic;
}

/* Date input calendar icon color fix */
.step-card input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7) sepia(1) saturate(1.5) hue-rotate(0deg);
  opacity: 0.6;
  cursor: pointer;
}

/* ── Radio Cards ── */
.gender-fieldset {
  border: none;
  margin-bottom: 28px;
}

.gender-fieldset legend {
  margin-bottom: 12px;
}

.gender-fieldset {
  display: flex;
  gap: 14px;
}

label.radio-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(18,12,4,0.6);
  cursor: pointer;
  font-family: var(--ff-body);
  font-size: 1rem;
  color: var(--parch-mid);
  border-radius: 3px;
  transition: all 0.2s;
  position: relative;
}

label.radio-card:hover {
  border-color: var(--gold);
  background: rgba(184,134,42,0.08);
}

label.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

label.radio-card:has(input:checked) {
  border-color: var(--gold);
  background: rgba(184,134,42,0.12);
  color: var(--gold-lt);
  box-shadow: 0 0 20px rgba(184,134,42,0.12);
}

.radio-symbol {
  font-size: 1.3rem;
  color: var(--gold);
  opacity: 0.7;
}

/* ── Buttons ── */
.primary-button {
  width: 100%;
  background: linear-gradient(180deg, #c49230 0%, #8b611a 100%);
  border: 1px solid var(--gold);
  color: var(--ink);
  padding: 16px 24px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--ff-heading);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: all 0.2s;
  box-shadow: 0 4px 24px rgba(184,134,42,0.25), inset 0 1px 0 rgba(255,220,120,0.3);
  margin-top: 8px;
}

.primary-button:hover {
  background: linear-gradient(180deg, #d4a030 0%, #9b6f20 100%);
  box-shadow: 0 6px 32px rgba(184,134,42,0.38), inset 0 1px 0 rgba(255,220,120,0.4);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.btn-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.btn-deco {
  font-size: 0.7rem;
  opacity: 0.75;
}

.secondary-button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--parch-mid);
  padding: 12px 20px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--ff-heading);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.secondary-button:hover {
  border-color: var(--gold-dim);
  color: var(--parchment);
  background: rgba(184,134,42,0.07);
}

.small-note {
  font-family: var(--ff-stamp);
  font-size: 0.78rem;
  color: rgba(242,232,208,0.35);
  text-align: center;
  margin-top: 18px;
  line-height: 1.5;
}

/* ── Utility ── */
.hidden {
  display: none !important;
}

/* ── Ad Slots ── */
.ad-slot {
  padding: 0;
  border: 1px dashed rgba(184, 134, 42, 0.2);
  border-radius: 3px;
  color: rgba(242, 232, 208, 0.3);
  font-size: 0.8rem;
  font-family: var(--ff-stamp);
  margin-bottom: 32px;
  background: rgba(0, 0, 0, 0.2);
  
  /* Absolute structural centering rules */
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 320px !important;
  height: 50px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  overflow: visible !important;
  position: relative !important;
}

/* Force third party ad wrappers to center completely */
.ad-slot > div,
.ad-slot iframe {
  display: block !important;
  margin: 0 auto !important;
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  transform-origin: center center !important;
  max-width: none !important;
}

.ad-slot:empty,
.ad-slot span:only-child {
  display: none;
}

/* ── Precise Hardware Accelerated Vector Scaling for Mobile Screens ── */
@media (max-width: 360px) {
  .ad-slot iframe {
    transform: translate(-50%, -50%) scale(0.85) !important;
  }
}

@media (max-width: 320px) {
  .ad-slot iframe {
    transform: translate(-50%, -50%) scale(0.75) !important;
  }
}

/* ── Result Section ── */
.result-stage {
  margin: 0;
  position: relative;
  width: min(100%, 760px);
}

.result-modal-overlay {
  z-index: 1010;
}

.result-modal-overlay .result-stage {
  padding: 32px 28px 28px;
  width: 100%;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #16100a 0%, #100c06 100%);
  box-shadow:
    0 0 0 5px rgba(184,134,42,0.12),
    0 50px 120px rgba(0,0,0,0.6);
}

.scroll-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  text-align: center;
}

.scroll-title-area {
  flex: 1;
}

.scroll-curl {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  max-width: 120px;
  position: relative;
}

.scroll-curl::before,
.scroll-curl::after {
  content: '';
  position: absolute;
  top: -4px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
}

.scroll-curl.left::before  { right: -4px; }
.scroll-curl.left::after   { left: -4px; top: -3px; width: 5px; height: 5px; }
.scroll-curl.right::before { left: -4px; }
.scroll-curl.right::after  { right: -4px; top: -3px; width: 5px; height: 5px; }

.section-label {
  font-family: var(--ff-heading);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-title {
  font-family: var(--ff-display);
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--gold-lt);
}

.result-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(22,15,5,0.97) 0%, rgba(18,10,3,0.99) 100%);
  box-shadow:
    0 0 0 4px rgba(184,134,42,0.06),
    0 0 0 5px rgba(184,134,42,0.15),
    0 30px 60px rgba(0,0,0,0.5);
  position: relative;
  padding: 0;
  overflow: hidden;
}

.result-content {
  padding: 8px 0;
}

.result-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid rgba(184,134,42,0.1);
  transition: background 0.15s;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row:hover {
  background: rgba(184,134,42,0.04);
}

.result-key {
  font-family: var(--ff-heading);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  display: flex;
  align-items: center;
}

.result-value {
  font-family: var(--ff-body);
  font-size: 1rem;
  color: var(--parchment);
  font-style: italic;
}

.seal-wax {
  text-align: center;
  font-size: 2.5rem;
  color: var(--crimson);
  padding: 20px;
  opacity: 0.8;
  text-shadow: 0 0 20px rgba(139,26,26,0.5);
  animation: seal-glow 3s ease-in-out infinite;
}

@keyframes seal-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(139,26,26,0.4); }
  50%       { text-shadow: 0 0 40px rgba(180,50,50,0.7); }
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 28px 32px;
  border-top: 1px solid rgba(184,134,42,0.15);
}

/* ── Share Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 0, 0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  position: relative;
  width: min(100%, 620px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #16100a 0%, #100c06 100%);
  box-shadow:
    0 0 0 5px rgba(184,134,42,0.12),
    0 50px 120px rgba(0,0,0,0.6);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: rgba(18,12,4,0.8);
  color: var(--gold-dim);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 2px;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  z-index: 10;
}

.modal-close:hover {
  border-color: var(--gold);
  color: var(--gold-lt);
  background: rgba(184,134,42,0.12);
}

.toast-container {
  position: fixed;
  inset: auto 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 6px;
  color: #fff;
  font-family: var(--ff-body);
  font-size: 0.95rem;
  background: rgba(16, 14, 11, 0.94);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: rgba(54, 107, 53, 0.94);
}

.toast.error {
  background: rgba(123, 41, 41, 0.94);
}

.share-stage {
  padding: 48px 40px 40px;
  text-align: center;
}

.share-eye {
  width: 64px;
  margin: 0 auto 20px;
  color: var(--gold);
  opacity: 0.6;
}

.share-stage h2 {
  font-family: var(--ff-heading);
  font-size: 1.7rem;
  font-weight: 400;
  color: var(--parchment);
  margin: 8px 0 24px;
}

.share-desc {
  font-style: italic;
  color: var(--parch-dk);
  margin-bottom: 28px;
  font-size: 1rem;
}

/* ── Share Counter (pips) ── */
.share-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 24px 0 32px;
}

.counter-track {
  display: flex;
  gap: 18px;
}

.counter-pip {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-str);
  border-radius: 50%;
  background: rgba(184,134,42,0.05);
  transition: all 0.3s;
}

.counter-pip.active {
  background: var(--gold);
  box-shadow: 0 0 14px rgba(184,134,42,0.55);
  border-color: var(--gold-lt);
}

.counter-text {
  font-family: var(--ff-display);
  font-size: 1.5rem;
  color: var(--gold-lt);
}

.share-counter small {
  font-family: var(--ff-heading);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

/* ── Share Buttons ── */
.share-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.share-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  background: rgba(18,12,4,0.7);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--parch-mid);
  cursor: pointer;
  font-family: var(--ff-heading);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all 0.2s;
}

.share-button:hover {
  border-color: var(--gold);
  background: rgba(184,134,42,0.1);
  color: var(--gold-lt);
  transform: translateY(-2px);
}

.share-button img {
  width: 22px;
  height: 22px;
  filter: sepia(1) saturate(0.4) brightness(1.2);
  opacity: 0.75;
  transition: opacity 0.2s;
}

.share-button:hover img {
  opacity: 1;
  filter: sepia(0.8) saturate(1.2) brightness(1.3);
}


/* ── Footer ── */
.site-footer {
  text-align: center;
  padding-top: 32px;
}

.footer-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--gold-dim);
  margin-bottom: 20px;
  opacity: 0.6;
}

.footer-rule {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.footer-banner {
  margin-bottom: 20px;
}

.footer-text {
  font-family: var(--ff-stamp);
  font-size: 0.78rem;
  color: rgba(242,232,208,0.3);
  line-height: 1.6;
}

/* ── Responsive (1000px) ── */
@media (max-width: 1000px) {
  .page-shell {
    padding: 28px 22px 48px;
  }

  .tarot-frame {
    padding: 40px 28px 36px;
  }

  .result-row {
    grid-template-columns: 130px 1fr;
    padding: 14px 24px;
  }

  .result-actions {
    padding: 20px 24px;
  }

  .share-stage {
    padding: 40px 28px 32px;
  }
}

/* ── Responsive (720px) ── */
@media (max-width: 720px) {
  .tarot-frame {
    padding: 32px 20px 28px;
  }

  .hero-title {
    font-size: 1.7rem;
  }

  .gender-fieldset {
    flex-direction: column;
  }

  .result-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px 20px;
  }

  .result-value {
    font-size: 0.95rem;
  }

  .result-actions {
    padding: 18px 20px;
    flex-direction: column;
  }

  .result-actions .secondary-button {
    width: 100%;
    text-align: center;
  }

  .share-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .share-stage {
    padding: 36px 20px 28px;
  }

  .scroll-curl {
    display: none;
  }
}

/* ── Responsive (520px) ── */
@media (max-width: 520px) {
  .page-shell {
    padding: 20px 16px 40px;
  }

  .tarot-corner {
    width: 28px;
    height: 28px;
  }

  .branding h1 {
    font-size: 1.1rem;
  }

  .hero-title {
    font-size: 1.4rem;
  }

  .share-buttons {
    grid-template-columns: repeat(2, 1fr);
  }

  .tarot-frame {
    padding: 28px 16px 24px;
  }
}

/* ── Entry animations ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tarot-frame {
  animation: fade-up 0.7s ease both;
}

.result-stage:not(.hidden) {
  animation: fade-up 0.6s ease both;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #100d06; }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }