/* Sound Doctrine: cream paper, logo green, a little gold. */

:root {
  --paper: #f8f4ea;
  --card: #fffdf8;
  --ink: #2a2721;
  --muted: #625b4f;
  --green: #1f4d2e;
  --green-deep: #163a22;
  --gold: #b08d3c;
  --gold-text: #7f6120; /* gold dark enough for text on cream */
  --rule: #e2d8c3;
  --cream: #f8f4ea;

  --serif-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --serif-text: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --radius: 0; /* square corners throughout */
  --shadow: 0 1px 2px rgb(42 39 33 / 6%), 0 6px 20px rgb(42 39 33 / 7%);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 1.125rem;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--green);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--green-deep);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--serif-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--green-deep);
  margin: 0 0 0.5em;
  /* Cormorant's default old-style figures make dates like 12-04-26 hard to read. */
  font-variant-numeric: lining-nums;
}

.latest-date,
.episode-date,
.site-footer .org {
  font-variant-numeric: lining-nums;
}

h1 {
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  letter-spacing: 0.01em;
}

h2 {
  font-size: clamp(1.6rem, 4.5vw, 2.05rem);
}

h3 {
  font-size: 1.4rem;
}

p {
  margin: 0 0 1.1em;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--card);
  border: 2px solid var(--green);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: 100%;
  max-width: 66rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container.narrow {
  max-width: 44rem;
}

/* --- Header --- */

.masthead {
  padding: 1.75rem 1.5rem 1.25rem;
  text-align: center;
}

.masthead a {
  display: inline-block;
}

.masthead img {
  display: block;
  width: min(330px, 78vw);
}

.site-nav {
  background: var(--green);
  border-top: 3px double var(--gold);
  border-bottom: 3px double var(--gold);
}

.site-nav ul {
  list-style: none;
  margin: 0 auto;
  padding: 0 1rem;
  max-width: 66rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.site-nav a {
  display: block;
  padding: 0.85rem 1.35rem;
  color: var(--cream);
  text-decoration: none;
  font-variant: small-caps;
  font-size: 1.12rem;
  letter-spacing: 0.08em;
  line-height: 1.3;
}

.site-nav a:hover {
  background: var(--green-deep);
  color: #fff;
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -3px 0 var(--gold);
}

/* --- Main --- */

main {
  flex: 1;
  padding: 3rem 0 4rem;
}

.page-title {
  text-align: center;
  margin-bottom: 0.35em;
}

.page-title + .flourish {
  margin-top: 0;
}

/* A short gold rule with a diamond, under titles and between sections. */
.flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 2.75rem auto;
  max-width: 16rem;
  color: var(--gold);
  border: 0;
}

.flourish::before,
.flourish::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
}

.flourish span {
  width: 7px;
  height: 7px;
  background: currentColor;
  transform: rotate(45deg);
}

.page-title + .flourish {
  margin-bottom: 2.5rem;
}

.eyebrow {
  font-variant: small-caps;
  letter-spacing: 0.1em;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-text);
  margin: 0 0 0.35rem;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  background: var(--green);
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

.button:hover {
  background: var(--green-deep);
  color: #fff;
}

/* Browser player, shown only if site.js doesn't load. */
audio {
  display: block;
  width: 100%;
  height: 48px;
}

audio[hidden] {
  display: none;
}

/* --- Audio player (built by site.js) --- */

.player {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.35rem 1rem 0.35rem 0.35rem;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.episode .player {
  background: var(--card);
}

.player-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--green);
  color: var(--cream);
  cursor: pointer;
}

.player-toggle:hover {
  background: var(--green-deep);
}

.player-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.player-toggle .icon-pause,
.player.is-playing .player-toggle .icon-play {
  display: none;
}

.player.is-playing .player-toggle .icon-pause {
  display: block;
}

.player.is-loading .player-toggle svg {
  animation: player-wait 1s ease-in-out infinite alternate;
}

@keyframes player-wait {
  to {
    opacity: 0.35;
  }
}

.player-time {
  flex: none;
  min-width: 2.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums lining-nums;
}

.player-total {
  text-align: right;
}

/* Seek bar: a thin rule that fills with gold as the broadcast plays. */
.player-seek {
  --progress: 0%;
  flex: 1;
  min-width: 0;
  height: 1.75rem; /* tall enough to tap; the visible track is thin */
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.player-seek::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, var(--gold) var(--progress), var(--rule) var(--progress));
}

.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  background: var(--green);
  border: 2px solid var(--cream);
  box-shadow: 0 0 0 1px var(--green);
  transform: rotate(45deg); /* a small diamond, like the page dividers */
}

.player-seek::-moz-range-track {
  height: 4px;
  background: var(--rule);
}

.player-seek::-moz-range-progress {
  height: 4px;
  background: var(--gold);
}

.player-seek::-moz-range-thumb {
  width: 11px;
  height: 11px;
  background: var(--green);
  border: 2px solid var(--cream);
  border-radius: 0;
  box-shadow: 0 0 0 1px var(--green);
  transform: rotate(45deg);
}

.player-seek:focus-visible {
  outline-offset: 4px;
}

/* --- Home --- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 23rem);
  grid-template-areas:
    "title  latest"
    "text   latest";
  column-gap: 3.5rem;
  align-items: start;
}

.intro h1 {
  grid-area: title;
}

.intro-text {
  grid-area: text;
}

.intro .latest {
  grid-area: latest;
}

.lead {
  font-size: 1.25rem;
  line-height: 1.6;
}

/* The latest-broadcast card (home and Listen pages). */
.latest {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.6rem;
}

.latest-date {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.65rem;
  line-height: 1.2;
  color: var(--green-deep);
  margin: 0 0 0.2rem;
}

.latest-meta {
  color: var(--muted);
  margin: 0 0 1rem;
}

.latest audio,
.latest .player {
  margin-bottom: 1.25rem;
}

.latest .button {
  width: 100%;
}

.bio {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  max-width: 56rem;
  margin: 0 auto;
}

.bio img {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  border: 6px solid var(--card);
  box-shadow: var(--shadow);
}

/* --- Listen --- */

.listen-latest {
  margin-bottom: 2.5rem;
}

.listen-latest audio,
.listen-latest .player {
  margin-bottom: 0;
}

.episodes {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.episode {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  align-items: center;
  padding: 1.1rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.episode.is-latest {
  background: var(--card);
  box-shadow: inset 4px 0 0 var(--green);
}

.episode-day {
  font-variant: small-caps;
  letter-spacing: 0.08em;
  color: var(--gold-text);
  font-weight: 600;
  display: block;
  line-height: 1.3;
}

.episode-date {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--green-deep);
  line-height: 1.2;
}

.episode-length {
  color: var(--muted);
  font-size: 1rem;
  margin-left: 0.4rem;
}

.podcast {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 2.5rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.podcast svg {
  flex: none;
  color: var(--gold);
}

/* --- Doctrinal Statement --- */

.article {
  margin: 0 0 2.25rem;
}

.article h2 {
  font-family: var(--serif-text);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.article h2 .num {
  color: var(--gold-text);
  margin-right: 0.35rem;
}

/* --- Book References --- */

.sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.source {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}

.source h3 {
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
}

.source p {
  margin: 0;
}

.materials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 2.5rem;
}

.materials section:last-child {
  grid-column: 1 / -1;
}

.materials ul {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
}

.materials li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule);
  line-height: 1.5;
}

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

.section-heading {
  text-align: center;
  margin-top: 0.5rem;
}

/* --- Footer --- */

.site-footer {
  background: var(--green-deep);
  color: var(--cream);
  border-top: 3px double var(--gold);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.site-footer p {
  margin: 0;
}

.site-footer .org {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.45rem;
  margin-bottom: 0.4rem;
}

.site-footer a {
  color: var(--cream);
}

/* --- Small screens --- */

@media (max-width: 52rem) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "latest"
      "text";
  }

  .intro h1 {
    text-align: center;
  }

  .intro .latest {
    margin-bottom: 2rem;
  }

  .bio {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .bio img {
    max-width: 16rem;
    margin: 0 auto;
  }
}

@media (max-width: 40rem) {
  body {
    font-size: 1.0625rem;
  }

  .container {
    padding: 0 1.15rem;
  }

  main {
    padding: 2rem 0 3rem;
  }

  .masthead {
    padding: 1.25rem 1rem 1rem;
  }

  /* Four links as an even 2 x 2 grid instead of a ragged wrap. */
  .site-nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0;
  }

  .site-nav li:nth-child(odd) {
    border-right: 1px solid rgb(248 244 234 / 18%);
  }

  .site-nav li:nth-child(-n + 2) {
    border-bottom: 1px solid rgb(248 244 234 / 18%);
  }

  /* Each link fills its whole cell, so when one label wraps to two lines
     the current-page underline still sits on the bottom edge of the row. */
  .site-nav li {
    display: flex;
  }

  .site-nav a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 0.5rem;
    text-align: center;
    font-size: 1.05rem;
    letter-spacing: 0.05em;
  }

  .latest {
    padding: 1.25rem 1.15rem 1.35rem;
  }

  .player {
    gap: 0.6rem;
    padding-right: 0.75rem;
  }

  .player-time {
    min-width: 2.4rem;
    font-size: 0.9rem;
  }

  .lead {
    font-size: 1.15rem;
  }

  .episode {
    grid-template-columns: minmax(0, 1fr);
    padding: 1rem 0.5rem;
  }

  .sources,
  .materials {
    grid-template-columns: minmax(0, 1fr);
  }

  .flourish {
    margin: 2rem auto;
  }
}

/* Keep a verse range like "2:5-11" from breaking at the hyphen. */
.ref {
  white-space: nowrap;
}

/* Narrowest phones: keep "Doctrinal Statement" on one line. */
@media (max-width: 24rem) {
  .site-nav a {
    font-size: 0.98rem;
    letter-spacing: 0.04em;
    padding: 0.8rem 0.25rem;
  }
}
