:root {
  color-scheme: light dark;
  --canvas: #f5f4f2;
  --surface: #ffffff;
  --surface-2: #efeeec;
  --fg: #16161a;
  --muted: #6b6b72;
  --hairline: rgb(0 0 0 / 0.06);
  --accent: #d6402a;
  --accent-press: #b93421;
  --on-accent: #ffffff;
  --accent-soft: #fdebe7;
  --danger: #c4321f;
  --danger-soft: #fdebe7;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 6px 20px rgb(0 0 0 / 0.06);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.05), 0 14px 32px rgb(0 0 0 / 0.1);
  --radius-card: 22px;
  --radius-field: 16px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0f0f10;
    --surface: #1c1c1f;
    --surface-2: #26262a;
    --fg: #f2f2f3;
    --muted: #9c9ca3;
    --hairline: rgb(255 255 255 / 0.07);
    --accent: #ff6a52;
    --accent-press: #ff806b;
    --on-accent: #1a0a06;
    --accent-soft: #3a1c16;
    --danger: #ff7a66;
    --danger-soft: #3a1c16;
    --shadow: 0 0 0 1px var(--hairline);
    --shadow-lift: 0 0 0 1px var(--hairline), 0 12px 32px rgb(0 0 0 / 0.5);
  }
}

/* Accent colors, chosen in Settings. These apply to any element, so each
   swatch in Settings shows its own color. Coral repeats the defaults above so
   its swatch stays coral whatever the page is using. */

[data-accent="coral"] {
  --accent: #d6402a;
  --accent-press: #b93421;
  --on-accent: #ffffff;
  --accent-soft: #fdebe7;
}

[data-accent="emerald"] {
  --accent: #0b7a4b;
  --accent-press: #09653e;
  --on-accent: #ffffff;
  --accent-soft: #e3f4ea;
}

[data-accent="indigo"] {
  --accent: #4f46e5;
  --accent-press: #4338ca;
  --on-accent: #ffffff;
  --accent-soft: #ebeafd;
}

[data-accent="teal"] {
  --accent: #0f766e;
  --accent-press: #0c5f59;
  --on-accent: #ffffff;
  --accent-soft: #e0f2f0;
}

[data-accent="amber"] {
  --accent: #b45309;
  --accent-press: #9a4708;
  --on-accent: #ffffff;
  --accent-soft: #fdf0e0;
}

[data-accent="ink"] {
  --accent: #16161a;
  --accent-press: #000000;
  --on-accent: #ffffff;
  --accent-soft: #ecebe9;
}

@media (prefers-color-scheme: dark) {
  [data-accent="coral"] {
    --accent: #ff6a52;
    --accent-press: #ff806b;
    --on-accent: #1a0a06;
    --accent-soft: #3a1c16;
  }

  [data-accent="emerald"] {
    --accent: #3ddc97;
    --accent-press: #5ee4a9;
    --on-accent: #04210f;
    --accent-soft: #12301f;
  }

  [data-accent="indigo"] {
    --accent: #8b85ff;
    --accent-press: #a29dff;
    --on-accent: #0f0b33;
    --accent-soft: #221f4a;
  }

  [data-accent="teal"] {
    --accent: #2dd4bf;
    --accent-press: #5eead4;
    --on-accent: #032420;
    --accent-soft: #0f2e2b;
  }

  [data-accent="amber"] {
    --accent: #fbbf24;
    --accent-press: #fcd34d;
    --on-accent: #2a1a00;
    --accent-soft: #33270c;
  }

  [data-accent="ink"] {
    --accent: #f2f2f3;
    --accent-press: #ffffff;
    --on-accent: #0f0f10;
    --accent-soft: #2a2a2e;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

svg {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 0.75rem) 0 0.75rem;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
}

.brand-mark svg {
  width: 1.15rem;
  height: 1.15rem;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 36rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}


main {
  margin: 0 auto;
  padding: 0.5rem 1.25rem calc(env(safe-area-inset-bottom) + 2rem);
  max-width: 36rem;
}

/* Type */

h1 {
  margin: 0.75rem 0 1.25rem;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

p {
  margin: 0 0 1rem;
}

.muted {
  color: var(--muted);
}

/* Cards */

.card {
  padding: 1.5rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  margin-top: 1rem;
  padding: 2rem 1.5rem 1.5rem;
}

.hero h1 {
  margin-top: 1.25rem;
}

.hero .primary {
  margin-top: 0.75rem;
}

.hero-icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}

.hero-icon svg {
  width: 2rem;
  height: 2rem;
}

.heading-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.heading-row h1 {
  margin-bottom: 1.25rem;
}

.pill-badge {
  margin-bottom: 0.5rem;
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.cards {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.passage-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.1rem 1.1rem 1.25rem;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.passage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.passage-card:active {
  transform: scale(0.98);
}

.passage-card .body {
  flex: 1;
  min-width: 0;
}

.passage-card .title {
  display: block;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.passage-card .preview {
  display: -webkit-box;
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.passage-card .chevron {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}

.passage-card .chevron svg {
  width: 1rem;
  height: 1rem;
}

/* The ESV API sends line breaks and indentation for paragraphs and poetry. */
#passage-text {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

#passage h1 {
  margin-top: 1rem;
}

/* Buttons */

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.buttons.stacked {
  flex-direction: column;
  gap: 0.5rem;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.15s, opacity 0.15s;
}

button:active:not(:disabled),
.button:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

button.primary {
  background: var(--accent);
  box-shadow: none;
  color: var(--on-accent);
}

button.primary:hover:not(:disabled) {
  background: var(--accent-press);
}

button.secondary {
  background: var(--surface-2);
  box-shadow: none;
}

button.danger {
  background: transparent;
  box-shadow: none;
  color: var(--danger);
  padding: 0 1rem;
}

button.danger:hover {
  background: var(--danger-soft);
}

.block {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--fg);
  transition: transform 0.15s var(--ease);
}

.topbar .icon-button {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--muted);
}

.icon-button:active {
  transform: scale(0.92);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

/* The add button rides along the bottom of the list, above the home indicator. */
.dock {
  position: sticky;
  bottom: 0;
  margin: 1.5rem -1.25rem 0;
  padding: 1.5rem 1.25rem calc(env(safe-area-inset-bottom) + 1rem);
  background: linear-gradient(to bottom, transparent, var(--canvas) 40%);
}

.dock .primary {
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Search sheet: a bottom sheet on phones, a centered card on wider screens. */

dialog {
  width: 100%;
  max-width: 100%;
  margin: auto auto 0;
  padding: 0.75rem 1.25rem calc(env(safe-area-inset-bottom) + 1.25rem);
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-lift);
}

dialog[open] {
  animation: sheet-up 0.35s var(--ease);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@media (min-width: 40rem) {
  dialog {
    width: 26rem;
    margin: auto;
    padding: 1.75rem;
    border-radius: 28px;
  }

  dialog[open] {
    animation: pop-in 0.25s var(--ease);
  }

  .grabber {
    display: none;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  dialog[open] {
    animation: none !important;
    transition: none !important;
  }
}

.grabber {
  width: 2.5rem;
  height: 5px;
  margin: 0 auto 1.25rem;
  border-radius: 999px;
  background: var(--surface-2);
}

.sheet-title {
  display: block;
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

/* Settings: accent color swatches */

.swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
}

.swatches legend {
  margin-bottom: 0.75rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.swatch {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: 1rem 0.5rem 0.75rem;
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}

.swatch:active {
  transform: scale(0.96);
}

.swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.swatch-dot {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
  color: var(--on-accent);
}

.swatch-dot svg {
  width: 1.4rem;
  height: 1.4rem;
  stroke-width: 3;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.15s, transform 0.2s var(--ease);
}

.swatch:has(:checked) {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.swatch:has(:checked) .swatch-dot svg {
  opacity: 1;
  transform: none;
}

.swatch:has(:focus-visible) {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
}

input {
  width: 100%;
  min-height: 3.5rem;
  padding: 0 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-field);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  transition: border-color 0.15s, background-color 0.15s;
}

input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

input:focus {
  border-color: var(--accent);
  background: var(--surface);
  outline: none;
}

#search-error {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: 600;
}

#search-error:empty {
  display: none;
}

noscript {
  display: block;
  padding: 2rem;
  text-align: center;
}
