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

:root {
  --bg:          #fef9f0;
  --surface:     #ffffff;
  --surface2:    #fdf4e3;
  --border:      #e4ceA0;
  --accent:      #b07c14;
  --accent2:     #d4a022;
  --text:        #2c1a08;
  --text-muted:  #7a5f38;
  --gold:        #c8900e;
  --radius:      12px;
}

/* ─── Body — warm parchment + sunlight rays from above ─── */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 160% 55% at 18% -20%, rgba(255, 205, 80, 0.32) 0%, transparent 65%),
    radial-gradient(ellipse 110% 45% at 82% -12%, rgba(255, 155, 55, 0.20) 0%, transparent 60%),
    radial-gradient(ellipse 70%  35% at 50% 105%, rgba(200, 140, 30,  0.10) 0%, transparent 55%);
  color: var(--text);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 17px;
  min-height: 100vh;
  line-height: 1.65;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ─── Header ─── */
header {
  position: relative;
  text-align: center;
  padding: 3.5rem 0 2.5rem;
}

.lang-wrap {
  position: absolute;
  top: 1.5rem;
  right: 0;
}

[dir="rtl"] .lang-wrap {
  right: auto;
  left: 0;
}

#langPicker {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

#langPicker:hover,
#langPicker:focus { border-color: var(--accent2); color: var(--text); }

header h1 {
  font-family: 'Josefin Sans', sans-serif;
  font-size: 3rem;
  letter-spacing: 10px;
  filter: drop-shadow(0 2px 8px rgba(180, 110, 0, 0.18));
}

.h1-many {
  font-weight: 100;
  color: #b08030;
}

.h1-paths {
  font-weight: 600;
  background: linear-gradient(135deg, #c8900e 0%, #e8b830 50%, #c07010 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  margin-top: 0.6rem;
  letter-spacing: 0.5px;
}

/* ─── Controls panel ─── */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 680px;
  margin: 0 auto 2rem;
  box-shadow:
    0 4px 24px rgba(160, 100, 0, 0.08),
    0 1px  4px rgba(160, 100, 0, 0.06),
    inset 0 1px 0 rgba(255, 220, 120, 0.4);
}

.topic-input { margin-bottom: 1.5rem; }

.topic-input label,
.religion-select > label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

#topic {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#topic:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(200, 144, 14, 0.14);
}

#topic::placeholder { color: var(--text-muted); opacity: 0.7; }

.religion-select { margin-bottom: 1.5rem; }

.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  color: var(--text);
}

.checkboxes label:has(input:checked) {
  border-color: var(--accent2);
  background: rgba(200, 144, 14, 0.12);
  box-shadow: 0 0 0 2px rgba(200, 144, 14, 0.15);
}

.checkboxes input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

#compareBtn {
  width: 100%;
  background: linear-gradient(135deg, #a06c10, #d4a022, #c08010);
  color: #fffbf0;
  border: none;
  border-radius: 8px;
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
  transition: filter 0.2s, transform 0.1s;
  box-shadow: 0 2px 12px rgba(160, 100, 0, 0.25);
}

#compareBtn:hover  { filter: brightness(1.08); }
#compareBtn:active { transform: scale(0.99); }
#compareBtn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }

/* ─── Loading ─── */
#loading {
  text-align: center;
  padding: 3rem 1rem;
}

.faith-label {
  color: var(--text-muted);
  margin-top: 1.6rem;
  font-size: 0.82rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  animation: faith-text-pulse 2s ease-in-out infinite;
}

@keyframes faith-text-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 1;   }
}

.faith-orbit {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
  animation: faith-drift 24s linear infinite;
}

.faith-orbit::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(200, 144, 14, 0.28);
  box-shadow: 0 0 30px rgba(200, 144, 14, 0.10) inset;
}

.faith-core {
  position: absolute;
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #e8b830;
  box-shadow:
    0 0  6px #e8b830,
    0 0 16px #c8900e,
    0 0 32px rgba(200, 144, 14, 0.55);
  animation: faith-core-pulse 2s ease-in-out infinite;
}

@keyframes faith-core-pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.6; }
  50%       { transform: scale(1.5); opacity: 1;   }
}

.faith-sym {
  position: absolute;
  width: 2rem; height: 2rem;
  font-size: 2rem;
  line-height: 1;
  text-align: center;
  color: #c8900e;
  animation-name: faith-glow, faith-counter;
  animation-duration: 3.5s, 24s;
  animation-timing-function: ease-in-out, linear;
  animation-iteration-count: infinite, infinite;
}

.fs-1 { top:   9px; left:  84px; animation-delay:  0.0s, 0s; }
.fs-2 { top:  37px; left: 143px; animation-delay: -0.5s, 0s; }
.fs-3 { top: 101px; left: 157px; animation-delay: -1.0s, 0s; }
.fs-4 { top: 152px; left: 117px; animation-delay: -1.5s, 0s; }
.fs-5 { top: 152px; left:  52px; animation-delay: -2.0s, 0s; }
.fs-6 { top: 101px; left:  11px; animation-delay: -2.5s, 0s; }
.fs-7 { top:  37px; left:  25px; animation-delay: -3.0s, 0s; }

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

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

@keyframes faith-glow {
  0%, 100% {
    opacity: 0.22;
    color: #a07020;
    text-shadow: none;
    transform: rotate(0deg) scale(0.85);
  }
  45%, 55% {
    opacity: 1;
    color: #fff3c0;
    text-shadow:
      0 0  6px #f5d060,
      0 0 14px #e8a830,
      0 0 28px #c8700a,
      0 0 50px rgba(200, 112, 10, 0.45);
    transform: rotate(0deg) scale(1.3);
  }
}

/* ─── Results ─── */
#results { margin-top: 1rem; }

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Stained-glass card — each tradition gets a jewel-tone top stripe */
.column-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent2);
  border-radius: var(--radius);
  padding: 1.5rem;
  animation: fadeIn 0.4s ease;
  box-shadow: 0 2px 12px rgba(150, 90, 0, 0.07), 0 1px 3px rgba(150, 90, 0, 0.05);
}

/* Tradition-specific jewel-tone top borders via nth-child */
.columns .column-card:nth-child(1) { border-top-color: #7F77DD; }
.columns .column-card:nth-child(2) { border-top-color: #1D9E75; }
.columns .column-card:nth-child(3) { border-top-color: #378ADD; }
.columns .column-card:nth-child(4) { border-top-color: #EF9F27; }
.columns .column-card:nth-child(5) { border-top-color: #D85A30; }
.columns .column-card:nth-child(6) { border-top-color: #5DCAA5; }
.columns .column-card:nth-child(7) { border-top-color: #D4537E; }

.column-card h2 {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}

/* Tradition symbols in card headings and checkboxes */
.sym, .cb-sym {
  font-style: normal;
  font-size: 1.1em;
  display: inline-block;
  width: 1.3em;
  text-align: center;
}

.column-card .content {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
}

.column-card .content::after {
  content: '▋';
  animation: blink 1s step-end infinite;
  display: inline;
  visibility: hidden;
  color: var(--accent2);
}

.column-card.streaming .content::after { visibility: visible; }

@keyframes blink { 50% { opacity: 0; } }

/* ─── Common Ground — sunrise glow ─── */
.common-ground {
  background: linear-gradient(135deg,
    rgba(255, 210, 80, 0.14) 0%,
    rgba(255, 170, 40, 0.10) 50%,
    rgba(240, 220, 120, 0.08) 100%);
  border: 1px solid rgba(200, 144, 14, 0.38);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 2rem;
  animation: fadeIn 0.4s ease;
  box-shadow:
    0 2px 20px rgba(200, 140, 0, 0.10),
    inset 0 1px 0 rgba(255, 220, 100, 0.35);
}

.common-ground h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--gold);
  margin-bottom: 1rem;
}

.common-ground .content {
  font-size: 0.95rem;
  line-height: 1.85;
  white-space: pre-wrap;
  color: var(--text);
}

.common-ground .content::after {
  content: '▋';
  animation: blink 1s step-end infinite;
  display: inline;
  visibility: hidden;
  color: var(--gold);
}

.common-ground.streaming .content::after { visibility: visible; }

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Footer ─── */
footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ─── Responsive ─── */
@media (max-width: 600px) {
  header h1 { font-size: 2.2rem; }
  .controls { padding: 1.5rem; }
  .columns  { grid-template-columns: 1fr; }
  .lang-wrap { position: static; text-align: center; margin-bottom: 1rem; }
}

/* ─── RTL support (Arabic, Hebrew) ─── */
[dir="rtl"] .checkboxes { flex-direction: row-reverse; }
[dir="rtl"] .column-card .content,
[dir="rtl"] .common-ground .content { text-align: right; }
[dir="rtl"] #compareBtn { letter-spacing: 0; }
