/* Public sermon and music archive.
   Phone-first and easy to read for every age: Atkinson Hyperlegible (designed for low-vision
   readers) at 18px, Literata for titles. The player is the one bold element on each page. */
:root {
  --paper: #f3f5f4;
  --surface: #ffffff;
  --ink: #18211f;
  --muted: #56625f;
  --line: #d6dedb;
  --teal: #1f5f6b;
  --teal-ink: #164852;
  --teal-wash: #e2edef;
  --focus: #e0a200;
  --sans: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.6 var(--sans);
}
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--teal-ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
button { font: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- Masthead ----------------------------------------------------------------------------- */
.masthead {
  max-width: 760px; margin: 0 auto; padding: 22px 20px 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
}
.church { font-family: var(--serif); font-weight: 600; font-size: 22px; color: var(--ink); text-decoration: none; }
.masthead nav { display: flex; gap: 20px; }
.masthead nav a { color: var(--muted); text-decoration: none; font-weight: 700; padding: 6px 0; border-bottom: 3px solid transparent; }
.masthead nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); }

main { max-width: 760px; margin: 0 auto; padding: 28px 20px 64px; }
.foot { max-width: 760px; margin: 0 auto; padding: 24px 20px 40px; color: var(--muted); font-size: 15px; border-top: 1px solid var(--line); }

h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(30px, 6vw, 40px); margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 24px; margin: 0 0 14px; }
p { margin: 0 0 12px; }
.page-title { margin-bottom: 8px; }
.intro { color: var(--muted); margin-bottom: 32px; }
.kicker { color: var(--teal); font-weight: 700; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 16px; }

/* ---- Latest sermon ---------------------------------------------------------------------- */
.latest { padding-bottom: 36px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.latest h1 a { color: inherit; text-decoration: none; }
.latest h1 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.latest-meta p, .sermon-head p, .album-head p { margin: 0; }
.speaker { font-weight: 700; }
.when, .scripture { color: var(--muted); }
.latest-meta { margin-bottom: 22px; }

/* ---- Player (the signature element) ----------------------------------------------------- */
.player {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "play track" "play transport" "resume resume";
  gap: 6px 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  margin: 8px 0 24px;
}
.player .play {
  grid-area: play;
  width: 76px; height: 76px; border-radius: 50%;
  border: 0; background: var(--teal); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.player .play:hover { background: var(--teal-ink); }
.player .play svg { width: 34px; height: 34px; fill: currentColor; grid-area: 1 / 1; }
.player .play svg:last-child, .player.playing .play svg:first-child { display: none; }
.player.playing .play svg:last-child { display: block; }
.player .track { grid-area: track; }
.seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer;
  --pct: 0%;
}
.seek::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--teal) var(--pct), var(--teal-wash) var(--pct)); }
.seek::-moz-range-track { height: 8px; border-radius: 4px; background: var(--teal-wash); }
.seek::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--teal); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; background: var(--teal-ink); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--teal-ink); }
.seek::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--teal-ink); border: 3px solid #fff; }
.times { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.transport { grid-area: transport; display: flex; gap: 8px; flex-wrap: wrap; }
.transport button {
  min-height: 40px; padding: 4px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); cursor: pointer; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.transport button:hover { border-color: var(--teal); }
.resume { grid-area: resume; font-size: 15px; color: var(--muted); margin: 6px 0 0; }
.resume button { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; padding: 0; font-weight: 700; }
@media (max-width: 480px) {
  .player { grid-template-columns: 1fr; grid-template-areas: "play" "track" "transport" "resume"; justify-items: stretch; }
  .player .play { justify-self: center; width: 84px; height: 84px; }
  .transport { justify-content: center; }
}

/* ---- Buttons ---------------------------------------------------------------------------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 28px; }
.button, .share {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 700; cursor: pointer;
}
.button:hover, .share:hover { border-color: var(--teal); color: var(--ink); }
.button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.button.primary:hover { background: var(--teal-ink); color: #fff; }
.button svg, .share svg { width: 20px; height: 20px; flex: none; }
.button small { font-weight: 400; opacity: .85; margin-left: 4px; }

/* ---- Archive list ----------------------------------------------------------------------- */
.archive h2 { margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; }
.filter { display: grid; gap: 4px; font-size: 15px; font-weight: 700; color: var(--muted); }
.filter.search { flex: 1 1 260px; }
.filter input, .filter select {
  min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 17px; color: var(--ink); width: 100%;
}
.filters .go { min-height: 46px; padding: 8px 18px; border-radius: 10px; border: 0; background: var(--ink); color: #fff; font-weight: 700; cursor: pointer; }
.filters .clear { align-self: center; font-weight: 700; }
.sermon-list { list-style: none; margin: 0; padding: 0; }
.sermon-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
}
.sermon-row:hover .title { color: var(--teal); text-decoration: underline; text-decoration-thickness: 2px; }
.date { display: grid; justify-items: center; background: var(--teal-wash); color: var(--teal-ink); border-radius: 10px; padding: 6px 0 4px; line-height: 1.1; }
.date .m { font-size: 14px; font-weight: 700; }
.date .d { font-size: 24px; font-weight: 700; }
.date .y { font-size: 12px; }
.what { display: grid; min-width: 0; }
.what .title { font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.25; }
.what .sub { color: var(--ink); font-size: 16px; }
.what .sub.quiet { color: var(--muted); font-size: 15px; }
.len { color: var(--muted); font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .sermon-row { grid-template-columns: 56px 1fr; } .len { grid-column: 2; } }
.pages { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; font-weight: 700; }
.empty { color: var(--muted); padding: 24px 0; }

/* ---- Sermon page ------------------------------------------------------------------------ */
.shared-by { display: inline-block; background: var(--teal-wash); color: var(--teal-ink); font-weight: 700; padding: 6px 14px; border-radius: 999px; margin-bottom: 18px; }
.sermon-head, .album-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 12px; }
.cover { width: 132px; height: 132px; border-radius: 12px; flex: none; object-fit: cover; background: var(--teal-wash); }
.cover.large { width: 200px; height: 200px; }
@media (max-width: 560px) { .sermon-head, .album-head { flex-direction: column; } .cover.large { width: 100%; height: auto; aspect-ratio: 1; } }
.description { margin-bottom: 24px; }
.parts ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.parts li { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.jump { flex: 1; display: flex; justify-content: space-between; gap: 12px; background: none; border: 0; padding: 8px 4px; cursor: pointer; color: var(--ink); text-align: left; font-variant-numeric: tabular-nums; }
.jump .n { font-weight: 700; }
.jump .at { color: var(--muted); }
.jump:hover .n { color: var(--teal); text-decoration: underline; }
.jump.current .n { color: var(--teal); }
.jump.current .n::before { content: "▶ "; font-size: 13px; }
.part-len { color: var(--muted); font-size: 15px; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.part-dl { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; color: var(--teal); }
.part-dl:hover { background: var(--teal-wash); }
.part-dl svg { width: 22px; height: 22px; }
.more { margin-top: 24px; font-weight: 700; }

/* ---- Music ------------------------------------------------------------------------------ */
.albums { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px; }
.album-card { display: grid; gap: 4px; color: inherit; text-decoration: none; }
.album-card img, .cover-blank { width: 100%; aspect-ratio: 1; height: auto; border-radius: 12px; object-fit: cover; background: var(--teal-wash); display: block; }
.album-card .t { font-family: var(--serif); font-weight: 600; font-size: 20px; margin-top: 6px; }
.album-card:hover .t { color: var(--teal); text-decoration: underline; }
.album-card .sub { color: var(--muted); font-size: 15px; }
.album-desc { margin-top: 8px !important; }
.songs { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.song { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.song-play { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--teal); cursor: pointer; display: grid; place-items: center; flex: none; }
.song-play svg { width: 20px; height: 20px; fill: currentColor; grid-area: 1 / 1; }
.song-play svg:last-child, .song.playing .song-play svg:first-child { display: none; }
.song.playing .song-play svg:last-child { display: block; }
.song.playing .song-play { background: var(--teal); color: #fff; border-color: var(--teal); }
.song-title { flex: 1; color: var(--ink); text-decoration: none; font-weight: 700; }
.song-title .n { color: var(--muted); font-weight: 400; margin-right: 6px; font-variant-numeric: tabular-nums; }
.song-title:hover { color: var(--teal); text-decoration: underline; }
.song-page { text-align: center; }
.song-page .cover.large { margin: 0 auto 20px; display: block; width: min(320px, 100%); height: auto; aspect-ratio: 1; }
.song-page .player { text-align: left; }
.song-page .actions { justify-content: center; }
.credit { color: var(--muted); font-style: italic; }

/* ---- Messages and share dialog ---------------------------------------------------------- */
.message { padding: 24px 0; }
.share-dialog { border: 0; border-radius: 16px; padding: 24px; width: min(440px, calc(100vw - 32px)); color: var(--ink); background: var(--surface); }
.share-dialog::backdrop { background: rgba(24, 33, 31, .5); }
.share-dialog h2 { margin-bottom: 16px; }
.share-dialog label { font-weight: 700; display: block; margin-bottom: 6px; }
.share-dialog .optional { font-weight: 400; color: var(--muted); }
.share-dialog input { width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); font: inherit; }
.share-actions { display: grid; gap: 10px; margin: 16px 0 8px; }
.share-actions .button { justify-content: center; }
.text-button { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.copied { color: var(--teal); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
