:root {
  color-scheme: dark;
  --leaf: #6fa85e;
  --gold: #e2a14a;
  --cream: #faf4e8;
  --neon: #7cff6b;   /* graffiti neon green */
  --neon-2: #ff4fd8; /* graffiti neon pink */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--cream);
  font-family: 'MedievalSharp', system-ui, serif;
  /* Deep nature gradient — the fallback shown when no Pexels background is set.
     A configured background image rotates above this (z-index 0) and below the
     transparent particle canvas (z-index 1). */
  background:
    radial-gradient(120% 90% at 70% 20%, rgba(111, 168, 94, 0.12), transparent 60%),
    radial-gradient(100% 80% at 30% 90%, rgba(226, 161, 74, 0.1), transparent 55%),
    linear-gradient(160deg, #0c1810 0%, #0a120d 55%, #0b160f 100%);
}

/* ── Splash screen ────────────────────────────────────────────────── */
/* Suppressed entirely when it has already played this hour (no white flash). */
body[data-splash="off"] .splash {
  display: none;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

.splash.gone {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  width: min(60vmin, 320px);
  height: auto;
  opacity: 0;
  transition: opacity 1s ease;
}

.splash-logo.visible {
  opacity: 1;
}

/* Word cloud + transparent particle canvas float above the rotating photo. */
#wordcloud {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  /* Words need pointer-events auto; the container must not block them. */
  pointer-events: auto;
}

.gn-word {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  will-change: transform;
  color: #f0ede6;
  text-shadow:
    0 0 18px rgba(255, 255, 255, 0.25),
    0 1px 8px rgba(0, 0, 0, 0.7);
  user-select: none;
  pointer-events: auto;
  cursor: pointer;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}

.gn-word:hover {
  color: #fff;
  text-shadow:
    0 0 14px var(--gold),
    0 0 28px rgba(226, 161, 74, 0.4),
    0 1px 8px rgba(0, 0, 0, 0.7);
}

/* ── Word → results card (slides up from the bottom) ──────────────── */
.wordcard {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  /* Height is content-driven (3 verses + button); no overflow/scroll needed. */
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
  background: linear-gradient(135deg, rgba(18, 18, 26, 0.88), rgba(18, 18, 26, 0.78));
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px 20px 0 0;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.5);
}

.wordcard.open {
  transform: translateY(0);
}

.wordcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex: none;
}

.wordcard-title {
  font-size: 1.4rem;
  color: var(--cream);
}

.wordcard-title em {
  font-style: normal;
  font-size: 0.7em;
  color: var(--gold);
  margin-left: 0.4rem;
}

.wordcard-close {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.wordcard-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.wordcard-body {
  padding: 0.5rem 1.5rem 1.5rem;
  max-width: 46rem;
  margin: 0 auto;
  width: 100%;
}

.wc-summary {
  color: var(--gold);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.wc-hint {
  color: #9a9aa8;
}

.wc-result {
  display: block;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: var(--cream);
}

.wc-result:hover {
  background: rgba(255, 255, 255, 0.04);
}

.wc-ref {
  display: block;
  color: #a6a6b2;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.wc-text {
  display: block;
  font-size: 1.2rem;
  line-height: 1.55;
}

.wordcard mark {
  background: rgba(226, 161, 74, 0.35);
  color: inherit;
  border-radius: 3px;
  padding: 0 0.1em;
}

.wc-more {
  display: block;
  margin-top: 0.75rem;
  padding: 0.8rem 1.25rem;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--gold);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s ease;
}

.wc-more:hover {
  background: linear-gradient(135deg, rgba(226, 161, 74, 0.22), rgba(226, 161, 74, 0.08));
}

#bg {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 1;
  background: transparent;
  pointer-events: none; /* canvas must not intercept clicks meant for word cloud */
}

.brand {
  position: fixed;
  top: 0;
  left: 0;
  margin: 0;
  z-index: 2;
}

.brand img {
  display: block;
  height: 120px;
  width: auto;
}

/* Hide the floating arc nav where it would overlap content; the mobile menu
   button takes its place. Shrink the logo on phones. */
@media (max-width: 920px) {
  .arc-nav { display: none; }
}
@media (max-width: 760px) {
  .brand img { height: 60px; }
}

/* ── Hero search ──────────────────────────────────────────────────── */
.hero-search {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(88vw, 30rem);
  padding: 0.4rem 0.4rem 0.4rem 1.4rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(124, 255, 107, 0.18);
}

/* On phones the centered search overlaps the left arc buttons — drop it near
   the bottom instead (the sword animation follows it, see home.html). */
@media (max-width: 760px) {
  .hero-search {
    top: auto;
    bottom: 8vh;
    transform: translateX(-50%);
    width: min(92vw, 30rem);
  }
}

#hero-input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: 'MedievalSharp', system-ui, serif;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  caret-color: var(--neon);
}

#hero-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
  opacity: 1;
}

.hero-go {
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #0a120d;
  background: linear-gradient(135deg, var(--neon) 0%, #39d9c8 100%);
  box-shadow: 0 0 10px var(--neon), 0 0 22px rgba(124, 255, 107, 0.5);
  transition: box-shadow 0.16s ease, filter 0.16s ease;
}

.hero-go:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 14px var(--neon), 0 0 32px var(--neon-2);
}

/* Hero topic-search autocomplete dropdown. */
.hero-suggest {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  max-height: 16rem;
  overflow-y: auto;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(16, 18, 16, 0.96), rgba(12, 14, 12, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.hero-suggest[hidden] { display: none; }

.hero-sug {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  cursor: pointer;
}

.hero-sug.on,
.hero-sug:hover {
  background: rgba(124, 255, 107, 0.12);
}

.hero-sug-label {
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--cream);
  text-transform: capitalize;
}

.hero-sug-blurb {
  font-size: 0.82rem;
  color: #9a9aa8;
}

/* ── Glass arc navigation ─────────────────────────────────────────── */
.arc-nav {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.glass-btn {
  position: absolute;
  transform: translateY(-50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;

  font: inherit;
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  text-transform: lowercase;
  color: var(--cream);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);

  /* Smoked-glass fill: keeps the buttons legible over a light background photo
     as well as a dark one (a whitish fill washes out on bright images). */
  background: linear-gradient(
    135deg,
    rgba(24, 26, 31, 0.62) 0%,
    rgba(14, 16, 20, 0.5) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 2px rgba(0, 0, 0, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.glass-btn:hover {
  /* Glow/brighten only — position stays fixed (no movement on hover). */
  background: linear-gradient(
    135deg,
    rgba(226, 161, 74, 0.32) 0%,
    rgba(111, 168, 94, 0.18) 100%
  );
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 0 0 1px rgba(226, 161, 74, 0.35);
}

/* ── Secret unlock dialog ─────────────────────────────────────────── */
.secret-dialog {
  background: linear-gradient(135deg, rgba(18, 18, 26, 0.96), rgba(18, 18, 26, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  color: var(--cream);
  font-family: 'MedievalSharp', system-ui, serif;
  padding: 2rem;
  width: min(90vw, 22rem);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.secret-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.secret-label {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  opacity: 0.7;
}

.secret-dialog input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: var(--cream);
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.secret-dialog input[type="password"]:focus {
  border-color: var(--gold);
}

.secret-err {
  margin: 0.5rem 0 0;
  color: #ff8585;
  font-size: 0.85rem;
}

.secret-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.2rem;
  justify-content: flex-end;
}

.secret-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.secret-btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.secret-btn-primary {
  background: linear-gradient(135deg, rgba(226, 161, 74, 0.3), rgba(226, 161, 74, 0.15));
  border-color: rgba(226, 161, 74, 0.4);
  color: var(--gold);
  font-weight: 600;
}

.secret-btn-primary:hover {
  background: linear-gradient(135deg, rgba(226, 161, 74, 0.45), rgba(226, 161, 74, 0.25));
}

/* No-JS fallback */
.fallback {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  height: 100%;
  text-align: center;
}

.fallback a {
  color: var(--gold);
}

@media (prefers-reduced-motion: reduce) {
  .glass-btn {
    transition: none;
  }
}

/* ── Life-topic verse overlay (blurred dark scrim of floating ovals) ──────── */
.topic-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  background: rgba(6, 6, 10, 0.74);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
}

.topic-overlay.open {
  display: flex;
  animation: topic-fade 0.22s ease;
}

@keyframes topic-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.topic-head {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 1.4rem 1.6rem 0.4rem;
}

.topic-title {
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: 0.01em;
}

.topic-title em {
  font-style: normal;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted, #9a9aa8);
  margin-left: 0.5rem;
}

.topic-count {
  margin-left: auto;
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: #8a8a96;
}

.topic-close {
  flex: none;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cream);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.topic-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* The scrollable field of verse-ovals. Flow layout guarantees no overlap;
   if there are more verses than fit, the field scrolls. */
.topic-field {
  flex: 1 1 auto;
  min-height: 0;
  /* The verses are a horizontal stream: scroll left↔right (vertical wheel is
     remapped in home.html), and each oval bobs up/down on its own sine wave —
     like verses floating down water. Column-wrap stacks them into columns that
     extend rightward; the row gap stays well above the wave amplitude so no two
     ever touch. `safe center` keeps the first column reachable when it overflows. */
  display: flex;
  flex-flow: column wrap;
  justify-content: center;
  align-content: safe center;
  align-items: center;
  gap: 34px 30px;
  padding: 1.5rem 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

/* Each verse sits in a soft oval — an elliptical radial fill (no hard outline)
   that fades to transparent at the rim. The vertical bob is set per-frame in JS. */
.topic-oval {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  border-radius: 50%;
  padding: 2.1em 2.3em;
  cursor: pointer;
  background: radial-gradient(
    closest-side,
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06) 62%,
    rgba(255, 255, 255, 0) 100%
  );
  will-change: transform;
}

.topic-oval:hover { z-index: 1; }

.topic-oval-ref {
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  opacity: 0.65;
  margin-bottom: 0.35rem;
  transition: opacity 0.15s ease;
}

.topic-oval:hover .topic-oval-ref { opacity: 1; }

.topic-oval-text {
  color: #ece9e2;
  line-height: 1.4;
}

/* Size tiers — longer verses get a larger oval. Type bumped ~4px for legibility. */
.topic-oval.s  { width: 220px; }
.topic-oval.m  { width: 260px; }
.topic-oval.l  { width: 310px; }
.topic-oval.xl { width: 360px; }
.topic-oval.s  .topic-oval-text { font-size: 1.29rem; }
.topic-oval.m  .topic-oval-text { font-size: 1.25rem; }
.topic-oval.l  .topic-oval-text { font-size: 1.2rem; }
.topic-oval.xl .topic-oval-text { font-size: 1.15rem; }

@media (max-width: 560px) {
  .topic-field { gap: 26px; padding: 1.2rem 1.2rem; }
  .topic-oval.l, .topic-oval.xl { width: 280px; }
}
/* ── Mobile menu (hamburger; replaces the arc nav below 920px) ──────────── */
.navmenu-btn { display: none; }

@media (max-width: 920px) {
  .navmenu-btn {
    position: fixed;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: linear-gradient(135deg, rgba(24, 26, 31, 0.82), rgba(14, 16, 20, 0.76));
    color: #faf4e8;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    cursor: pointer;
  }
}

.navmenu-btn svg { width: 22px; height: 22px; }

.navmenu {
  position: fixed;
  top: 4rem;
  right: 0.7rem;
  z-index: 60;
  min-width: 11rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(18, 18, 24, 0.98), rgba(12, 12, 16, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.navmenu[hidden] { display: none; }

.navmenu-link,
.navmenu-mode {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.62rem 0.85rem;
  border: none;
  border-radius: 10px;
  background: none;
  color: #faf4e8;
  cursor: pointer;
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-size: 1.02rem;
  text-transform: lowercase;
  text-decoration: none;
}

.navmenu-link:hover,
.navmenu-mode:hover { background: rgba(255, 255, 255, 0.1); }

.navmenu-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-bottom: 0.35rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navmenu-label {
  padding: 0.2rem 0.85rem;
  font-family: 'Baloo Tammudu 2', system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a9aa8;
}
