/* =========================
   Theme variables
   ========================= */

:root {
  --bg: #ffffcc;
  --text: #2b1f16;
  --panel: #ffffcc;
  --panel-hover: #eee9df;
  --border: #d6cfc3;
}

body.dark {
  --bg: #2b1f16;
  --text: #ffffcc;
  --panel: #33261c;
  --panel-hover: #3d2e22;
  --border: #5a4636;
}

/* =========================
   Base
   ========================= */

body {
  margin: 0;
  font-family: "Merriweather", Georgia, serif;
  background: var(--bg);
  color: var(--text);
}

button {
  cursor: pointer;
}

/* =========================
   Top bar
   ========================= */

#top-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

#back-button {
  margin-right: 12px;
  font-size: 18px;
}

#page-title {
  font-size: 18px;
  margin: 0;
}

/* =========================
   Icon buttons
   ========================= */

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  opacity: 0.75;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.icon-btn.musings svg {
  transform: translateY(2px);
}

/* =========================
   Top navigation
   ========================= */

#icon-bar {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 900;
}

#icon-bar .icon-btn {
  font-size: 1.2rem;
}

.top-nav {
  justify-self: end;
  display: flex;
  gap: 1.25rem;
}

.top-nav .icon-btn svg {
  stroke-width: 2;
}

/* =========================
   Launch page
   ========================= */

.launch-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
}

.launch-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  margin: 1.5rem 0 1rem;
}

.launch-icon {
  margin: 1.2rem 0 1.8rem;
}

.launch-icon svg {
  pointer-events: none;
  transition: transform 0.3s ease;
}

.launch-icon:hover svg,
.launch-icon:focus-within svg {
  animation: breathe 3.5s ease-in-out infinite;
}

@keyframes breathe {
  0%   { transform: scale(1);    filter: brightness(1); }
  50%  { transform: scale(1.05); filter: brightness(1.05); }
  100% { transform: scale(1);    filter: brightness(1); }
}

.launch-bars {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.launch-bar {
  width: 240px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  font-family: 'Merriweather', serif;
  font-size: 1.05rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  opacity: 0.85;
}

.launch-bar:hover {
  background: var(--panel-hover);
  opacity: 1;
}

.launch-bar-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
}

.theme-toggle {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.75;
  cursor: pointer;
}

.theme-toggle:hover {
  opacity: 1;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* =========================
   Attributes grid
   ========================= */

.attributes-grid {
  list-style: none;
  padding: 1rem;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.2rem;
}

.attribute-card {
  cursor: pointer;
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: 10px;
  color: var(--text);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.attribute-card:hover {
  background-color: var(--panel-hover);
  transform: translateY(-2px);
}

.attribute-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin: 0 auto 0.4rem auto;
}

.attribute-name {
  font-size: 0.95rem;
  font-weight: 500;
}

@media (max-width: 900px) {
  .attributes-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .attributes-grid { grid-template-columns: repeat(2, 1fr); }
}

/* =========================
   Attribute references
   ========================= */

.attr-ref {
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.static-dot {
  font-weight: 500;
}

/* =========================
   Reflection
   ========================= */

.reflection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 320px;
  margin: 2rem auto;
}

.reflection-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.reflection-btn {
  width: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  font-family: "Merriweather", serif;
  font-size: 1.05rem;
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.85;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.reflection-btn:hover {
  background: var(--panel-hover);
  opacity: 1;
  transform: translateY(-1px);
}

/* =========================
   Intro / musings lists
   ========================= */

.intro-outline {
  list-style: none;
  padding: 0;
  margin: 24px 0;
}

.intro-outline li {
  padding: 14px 16px;
  margin-bottom: 8px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.intro-outline li::after {
  content: "›";
  font-size: 20px;
  opacity: 0.5;
}

.intro-outline li:hover {
  background: var(--panel-hover);
}

/* =========================
   Modal
   ========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  max-width: 90%;
  width: 500px;
  max-height: calc(100vh - 4rem);
  box-sizing: border-box;
  overflow-y: auto;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  position: relative;
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modal.show {
  transform: translateY(0);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text);
}

.modal h3 {
  margin-top: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.modal p {
  line-height: 1.5;
}

.modal a,
.modal a:link,
.modal a:visited,
.modal a:hover,
.modal a:active {
  color: #d41a17 !important;
  text-decoration: underline;
}

/* =========================
   Scripture
   ========================= */

.scripture-scroll {
  max-width: min(90vw, 500px);
  overflow-y: auto;
}

.scripture-footer {
  margin-top: 1rem;
  font-size: 0.75rem;
  opacity: 0.6;
  text-align: center;
}

.scripture-link {
  cursor: pointer;
  opacity: 0.85;
}

.scripture-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* =========================
   About
   ========================= */

.about-author {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0.7;
}

.about-author a {
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.about-author a:hover {
  text-decoration: underline;
  opacity: 1;
}

/* =========================
   Links
   ========================= */

#app a {
  color: inherit;
  text-decoration: underline dotted;
  transition: color 0.2s;
}

#app a:hover {
  text-decoration: underline dotted;
}

body:not(.dark) #app a         { color: #d41a17; }
body:not(.dark) #app a:visited { color: #a32016; }
body:not(.dark) #app a:hover,
body:not(.dark) #app a:focus,
body:not(.dark) #app a:active  { color: #7a1a12; }

body.dark #app a         { color: #ff7f70; }
body.dark #app a:visited { color: #ff604f; }
body.dark #app a:hover,
body.dark #app a:focus,
body.dark #app a:active  { color: #ff3b2e; }

/* =========================
   Tooltip
   ========================= */

#tooltip {
  position: absolute;
  padding: 6px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  font-family: 'Merriweather', serif;
  z-index: 1000;
  max-width: 250px;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out, background 0.2s, color 0.2s;
}

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

body:not(.dark) #tooltip {
  background: #ffffcc;
  color: #2b1f16;
  border: 1px solid #ccc;
}

body.dark #tooltip {
  background: #2b1f16;
  color: #ffffcc;
  border: 1px solid #555;
}

/* =========================
   Update notice
   ========================= */

#update-notice {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #d41a17;
  color: #ffffcc;
  padding: 0.75rem 1.2rem;
  border-radius: 6px;
  font-family: 'Merriweather', serif;
  font-size: 0.95rem;
  cursor: pointer;
  display: none;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#update-notice.show {
  display: block;
  opacity: 1;
}

#update-notice.hide {
  opacity: 0;
  pointer-events: none;
}
