:root {
  --bg: #05050a;
  --bg-2: #111827;
  --panel: rgba(8, 10, 22, 0.92);
  --panel-strong: #080a16;
  --text: #f6f2df;
  --muted: #b9c0d5;
  --line: #7985c9;
  --blue: #1731d6;
  --blue-dark: #07117d;
  --gold: #ffe86b;
  --gold-2: #d4a21d;
  --green: #47d174;
  --red: #f25d5d;
  --paper: #e2e2d8;
  --ink: #11131f;
  --shadow: rgba(0, 0, 0, 0.48);
  --radius: 8px;
  --content: 1500px;
  --sidebar: 280px;
  --sans: Arial, Helvetica, sans-serif;
  --serif: "Times New Roman", Times, serif;
}

[data-theme="cathedral"] {
  --bg: #08050b;
  --bg-2: #201023;
  --panel: rgba(24, 8, 24, 0.92);
  --panel-strong: #180818;
  --line: #b877d2;
  --blue: #7b22b8;
  --blue-dark: #3d0f5d;
  --gold: #ffe188;
}

[data-theme="scroll"] {
  --bg: #17110a;
  --bg-2: #382414;
  --panel: rgba(38, 26, 15, 0.92);
  --panel-strong: #261a0f;
  --text: #fff1cf;
  --muted: #e2cda8;
  --line: #d9ad62;
  --blue: #8a4f18;
  --blue-dark: #4a2a0c;
  --gold: #fff2a8;
}

[data-theme="night"] {
  --bg: #000;
  --bg-2: #051018;
  --panel: rgba(0, 10, 16, 0.94);
  --panel-strong: #01080d;
  --line: #4ed6ff;
  --blue: #006c96;
  --blue-dark: #00394f;
  --gold: #b6f3ff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.16), transparent 18%),
    radial-gradient(circle at 80% 18%, rgba(86, 112, 255, 0.2), transparent 20%),
    radial-gradient(circle at 50% 100%, rgba(255, 232, 107, 0.1), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 82%);
}

a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: #fff;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20px 30px, #fff 0 1px, transparent 1.7px),
    radial-gradient(circle at 130px 80px, #fff9bf 0 1px, transparent 1.8px),
    radial-gradient(circle at 240px 48px, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 330px 150px, #cbd4ff 0 1px, transparent 1.8px);
  background-size: 380px 220px;
  opacity: 0.65;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 24px), var(--content));
  margin: 16px auto 36px;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-card,
.panel,
.hero,
.quick-bar,
.dash-card,
.section,
.compose-card,
.reading-card,
.search-card,
.modal-card {
  border: 2px solid var(--line);
  box-shadow:
    0 18px 44px var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  background: var(--panel);
}

.brand-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-decoration: none;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border: 2px outset #fff;
  font: 900 38px/1 var(--serif);
}

.brand-card strong {
  display: block;
  font: 700 24px/0.95 var(--serif);
}

.brand-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.panel h2 {
  margin: 0;
  padding: 9px 12px;
  text-align: center;
  font: 700 21px/1 var(--serif);
  background: linear-gradient(180deg, var(--blue), var(--blue-dark));
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  text-shadow: 0 1px 0 #000;
}

.panel-body {
  padding: 13px;
}

.account-panel p,
.verse-card p {
  margin: 0 0 12px;
  line-height: 1.35;
}

.button-row,
.hero-actions,
.compose-actions,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.retro-button,
.mega-button,
.text-button,
.theme-buttons button,
.file-picker {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  color: #fff;
  background: linear-gradient(180deg, var(--blue), var(--blue-dark));
  border: 2px outset #d8d8d8;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
}

.mega-button {
  min-height: 46px;
  padding: 10px 18px;
  color: var(--ink);
  background: linear-gradient(180deg, #fff8b7, var(--gold) 58%, var(--gold-2));
  font-weight: 800;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.3);
}

.mega-button.secondary,
.retro-button.gold {
  color: #fff;
  background: linear-gradient(180deg, #5b7cff, var(--blue));
}

.retro-button.danger {
  background: linear-gradient(180deg, #fa7777, #9a1010);
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--gold);
  background: transparent;
  border: 0;
  box-shadow: none;
  text-decoration: underline;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-list a {
  padding: 8px 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  text-decoration: none;
}

.nav-list a:hover {
  background: rgba(255, 232, 107, 0.14);
}

.stat-stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat-stack div,
.pulse-grid div {
  padding: 10px;
  text-align: center;
  color: var(--ink);
  background: var(--paper);
  border: 2px inset #fff;
}

.stat-stack strong,
.pulse-grid strong {
  display: block;
  font: 900 28px/1 "Courier New", monospace;
}

.stat-stack span,
.pulse-grid span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.main {
  min-width: 0;
}

.hero {
  position: relative;
  min-height: 540px;
  overflow: hidden;
  display: grid;
  align-items: end;
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.88)),
    url("creation-of-adam-detail.jpg") center 33% / cover;
  filter: saturate(1.08) contrast(1.05);
  transform: scale(1.02);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(850px, calc(100% - 32px));
  padding: 42px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero h1 {
  margin: 0;
  color: var(--gold);
  font: 900 clamp(56px, 10vw, 128px)/0.88 var(--serif);
  text-shadow: 4px 4px 0 #000, 0 0 22px #000;
}

.hero-copy {
  max-width: 720px;
  margin: 16px 0 24px;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.32;
  text-shadow: 2px 2px 0 #000;
}

.ticker {
  position: relative;
  z-index: 2;
  padding: 10px 16px;
  color: var(--ink);
  background: linear-gradient(90deg, var(--gold), #fff7bb, var(--gold));
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  font-weight: 700;
}

.quick-bar {
  margin-top: 12px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
}

.quick-bar a {
  color: #fff;
  font-weight: 700;
}

.dashboard-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.dash-card {
  padding: 16px;
}

.dash-card h2,
.section h2 {
  margin: 0 0 12px;
  color: var(--gold);
  font: 800 32px/1 var(--serif);
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.section {
  margin-top: 18px;
  padding: 22px;
  scroll-margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section p {
  color: var(--muted);
  line-height: 1.48;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(240px, 0.74fr) minmax(0, 1.26fr);
  gap: 22px;
  align-items: start;
}

.compose-card,
.search-card,
.reading-card {
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.compose-card {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
  border: 2px inset #cfcfcf;
}

textarea {
  resize: vertical;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.board-card,
.post-card,
.prayer-card,
.guest-card,
.member-card,
.guideline-grid article,
.setup-grid article,
.launch-list {
  color: var(--ink);
  background: var(--paper);
  border: 2px ridge #fff;
}

.board-card {
  padding: 14px;
  min-height: 142px;
  display: grid;
  gap: 10px;
}

.board-card h3,
.post-card h3,
.prayer-card h3,
.guest-card h3,
.member-card h3,
.reading-card h3,
.guideline-grid h3,
.setup-grid h3 {
  margin: 0;
  color: var(--ink);
}

.board-card p,
.post-card p,
.prayer-card p,
.guest-card p,
.member-card p,
.reading-card p,
.guideline-grid p,
.setup-grid p {
  color: #33394b;
}

.board-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-self: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #fff;
  background: var(--blue-dark);
  border: 1px solid rgba(0, 0, 0, 0.3);
  font-size: 13px;
}

.post-stream {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.post-card,
.prayer-card,
.guest-card,
.member-card,
.guideline-grid article {
  padding: 14px;
}

.post-top,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.post-meta,
.member-meta {
  color: #4e5364;
  font-size: 14px;
}

.prayer-list,
.guestbook-grid,
.member-grid,
.guideline-grid,
.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guestbook-grid,
.member-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reading-card {
  min-height: 250px;
}

.reading-card h3 {
  font: 800 28px/1.05 var(--serif);
}

.reading-card small {
  color: #50576a;
  font-weight: 700;
}

.search-card input {
  margin-bottom: 12px;
}

.search-result {
  padding: 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #9c9c9c;
}

.search-result + .search-result {
  margin-top: 8px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.file-picker {
  position: relative;
  overflow: hidden;
}

.file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.setup-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.setup-grid article {
  padding: 16px;
}

.setup-grid span {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  color: #fff;
  background: var(--blue-dark);
  font-weight: 900;
}

.launch-list {
  margin-top: 12px;
  padding: 14px 18px;
}

.launch-list li + li {
  margin-top: 8px;
}

.footer {
  margin: 20px 0 0;
  padding: 24px 10px;
  text-align: center;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.modal {
  width: min(560px, calc(100% - 24px));
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.modal-card {
  position: relative;
  padding: 20px;
  display: grid;
  gap: 13px;
}

.modal-card h2 {
  margin: 0;
  color: var(--gold);
  font: 800 34px/1 var(--serif);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  color: #fff;
  background: #8f1010;
  border: 2px outset #fff;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  color: var(--ink);
  background: var(--gold);
  border: 2px outset #fff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.42);
  transform: translateY(140%);
  transition: transform 180ms ease;
  font-weight: 700;
}

.toast.show {
  transform: translateY(0);
}

.empty-state {
  padding: 18px;
  color: var(--ink);
  background: var(--paper);
  border: 2px ridge #fff;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .brand-card,
  .nav-panel {
    grid-column: 1 / -1;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dashboard-grid,
  .board-grid,
  .guestbook-grid,
  .member-grid,
  .guideline-grid,
  .setup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 12px), var(--content));
    margin-top: 6px;
    gap: 12px;
  }

  .sidebar,
  .nav-list,
  .dashboard-grid,
  .two-column,
  .board-grid,
  .prayer-list,
  .guestbook-grid,
  .member-grid,
  .guideline-grid,
  .setup-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 520px;
  }

  .hero-content {
    width: 100%;
    padding: 26px 16px;
  }

  .hero h1 {
    font-size: 58px;
  }

  .section {
    padding: 16px;
  }

  .section-heading {
    display: block;
  }

  .pulse-grid {
    grid-template-columns: 1fr;
  }
}
