/* IASD Las Piedras
   Follows the Adventist identity manual (Inter-American Division, 2022):
   - Color: Denim (Pantone 302) as the main color, used as much as possible; Warm and Ming as
     secondary colors; tints at 80/60/40/20 %.
   - Type: Noto Sans (the manual's secondary family). Advent Sans is reserved for the official logo.
   - Layout: the Creation scheme, 7 equal columns. The 7th (Sabbath) column holds only a background
     and the plain church symbol, never text and never the circular symbol.
   - Symbol: one solid color, no effects, no opacity. Plain version next to the name,
     circular version when it stands alone (favicon / app icon). */

:root {
  --denim: #2f557f;
  --denim-80: #597799;
  --denim-60: #8299b2;
  --denim-40: #acbbcc;
  --denim-20: #d5dde5;
  --warm: #ffa92d;
  --ming: #3e8391;

  --bg: #ffffff;
  --surface: #f3f5f8;
  --ink: #17222e;
  --muted: #536170;
  --line: #dde3ea;
  --accent: var(--denim);      /* links, primary buttons, the symbol */
  --on-accent: #ffffff;
  --focus: var(--ming);
  --mark: var(--denim);        /* symbol color: only Denim, black or white at 100 % */

  --r: 8px;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --col-gap: clamp(8px, 1.6vw, 20px);
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1a26; --surface: #152639; --ink: #eef2f6; --muted: #a9b7c6; --line: #243549;
    --accent: var(--denim-40); --on-accent: #0e1a26; --focus: var(--warm); --mark: #ffffff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1a26; --surface: #152639; --ink: #eef2f6; --muted: #a9b7c6; --line: #243549;
  --accent: var(--denim-40); --on-accent: #0e1a26; --focus: var(--warm); --mark: #ffffff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.1; letter-spacing: -0.015em; font-weight: 700; margin: 0; font-stretch: 87.5%; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: 12px; top: -60px; background: var(--accent); color: var(--on-accent); padding: 10px 16px; border-radius: var(--r); z-index: 50; text-decoration: none; }
.skip:focus { top: 12px; }

/* The plain church symbol, recolored by CSS so it is always one solid approved color */
.mark, .sabbath-mark {
  display: block; flex: none; background: var(--mark);
  -webkit-mask: url("/img/logo-mark.png") center / contain no-repeat;
  mask: url("/img/logo-mark.png") center / contain no-repeat;
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.brand .mark { width: 30px; height: 30px; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: var(--r); font-size: .95rem; }
.nav a:hover { color: var(--accent); background: var(--surface); }
@media (max-width: 760px) { .nav { display: none; } .settings { margin-left: auto; } }

/* Settings */
.settings { position: relative; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; color: var(--ink);
  border: 1px solid var(--line); background: var(--bg); border-radius: var(--r);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(300px, calc(100vw - 32px));
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; display: grid; gap: 14px;
  box-shadow: 0 18px 40px -18px rgba(14, 26, 38, .45);
}
.panel[hidden] { display: none; }
.panel-title { font-weight: 700; }
.opt { display: grid; gap: 6px; }
.opt-name { font-size: .85rem; color: var(--muted); }
.seg { display: flex; background: var(--surface); border-radius: var(--r); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 6px; padding: 8px 6px;
  font-size: .9rem; cursor: pointer; color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* Hero laid out on the Creation scheme */
.creation { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: var(--col-gap); }
.hero { padding-bottom: clamp(48px, 7vw, 88px); }
.hero-text { grid-column: 1 / 7; grid-row: 1; padding: clamp(40px, 7vw, 88px) 0 clamp(28px, 4vw, 44px); }
.sabbath {
  grid-column: 7; grid-row: 1 / 3; background: var(--denim);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 14% clamp(18px, 3vw, 36px);
}
.sabbath-mark { width: 100%; max-width: 72px; aspect-ratio: 1; background: #ffffff; }
.hero-live { grid-column: 1 / 7; grid-row: 2; }

.name {
  margin: 0; font-weight: 800; font-stretch: 62.5%; line-height: .9; letter-spacing: -0.012em;
  font-size: clamp(2.7rem, 8.4vw, 7.4rem); display: grid; color: var(--accent);
}
.name-c { font-weight: 400; }
.lead { max-width: 48ch; color: var(--muted); font-size: clamp(1.05rem, 1.5vw, 1.2rem); margin-top: clamp(20px, 3vw, 32px); }
.hero-text .actions { margin-top: 24px; }
@media (prefers-reduced-motion: no-preference) {
  .name > span { animation: rise .8s cubic-bezier(.2, .7, .1, 1) both; }
  .name-b { animation-delay: .08s; }
  .name-c { animation-delay: .16s; }
  @keyframes rise { from { opacity: 0; transform: translateY(.2em); } to { opacity: 1; transform: none; } }
}
@media (max-width: 700px) {
  .sabbath { grid-row: 1; padding-bottom: 20px; }
  .hero-live { grid-column: 1 / -1; }
}

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px;
  border-radius: var(--r); border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  text-decoration: none; font-weight: 600; font-size: .98rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.btn.done { background: var(--accent); color: var(--on-accent); }
.text-btn, .text-link {
  background: none; border: 0; padding: 4px 0; cursor: pointer; font-weight: 600; font-size: .98rem; color: var(--accent);
  text-decoration: underline; text-decoration-color: var(--denim-40); text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.text-btn:hover, .text-link:hover { text-decoration-color: currentColor; }
.note { color: var(--muted); font-size: .95rem; max-width: 60ch; }

/* Live player: stream thumbnail in a Denim duotone, like the manual's photo examples */
.player {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r);
  background: var(--denim); color: #fff; isolation: isolate;
}
.player-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.1); z-index: 0; }
.player::before { content: ""; position: absolute; inset: 0; z-index: 1; background: var(--denim); mix-blend-mode: multiply; pointer-events: none; }
.player::after { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(to top, rgba(14, 26, 38, .78), rgba(14, 26, 38, 0) 62%); pointer-events: none; }
.player-ui { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: clamp(16px, 3.4vw, 40px); display: grid; gap: 14px; justify-items: start; }
.live-tag { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: clamp(.95rem, 1.4vw, 1.1rem); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 4px rgba(255, 169, 45, .3); }
.play {
  display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer; text-decoration: none;
  background: #fff; color: var(--denim); border-radius: var(--r); padding: 14px 22px 14px 18px;
  font-weight: 700; font-size: clamp(1rem, 1.5vw, 1.12rem);
}
.play:hover { background: var(--denim-20); }
.player iframe, .viewer-frame iframe, .map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 4; }
.live-meta { display: flex; justify-content: space-between; align-items: start; gap: 12px 32px; flex-wrap: wrap; margin-top: 16px; }
.live-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }

/* Sections */
.block { padding: clamp(48px, 7vw, 88px) 0; border-top: 1px solid var(--line); }
.head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 28px; }

/* Past services */
.videos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px var(--col-gap); }
.video { all: unset; display: grid; gap: 10px; cursor: pointer; width: 100%; }
.video:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 6px; border-radius: var(--r); }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: var(--surface); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-date { font-weight: 650; }
.v-title { color: var(--muted); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video:hover .v-date { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.skel .v-date { height: 1.1em; width: 60%; border-radius: 4px; background: var(--surface); }
@media (max-width: 900px) { .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .videos { grid-template-columns: 1fr; gap: 18px; }
  .video { grid-template-columns: 44% 1fr; align-items: center; gap: 4px 14px; }
  .video .thumb { grid-row: span 2; }
  .v-date { align-self: end; }
  .v-title { align-self: start; }
}

/* Times + visit */
.info-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; }
@media (max-width: 860px) { .info-in { grid-template-columns: 1fr; } }
.info-col h2 { margin-bottom: 18px; }
.next { font-size: 1.1rem; margin-bottom: 14px; color: var(--accent); }
.week { border-top: 2px solid var(--accent); }
.day { display: grid; grid-template-columns: minmax(7em, 30%) 1fr; gap: 6px 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.day-name { font-weight: 700; color: var(--accent); }
.day dl { margin: 0; display: grid; gap: 8px; }
.day dl div { display: flex; justify-content: space-between; gap: 16px; }
.day dt { font-weight: 500; }
.day dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; white-space: nowrap; }
.day dd.tbd { color: var(--muted); font-weight: 400; }
@media (max-width: 420px) { .day { grid-template-columns: 1fr; } }
.next-k { font-weight: 700; }
.addr { font-style: normal; font-size: 1.15rem; line-height: 1.45; margin-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  text-decoration: none; padding: 9px 16px; border-radius: var(--r); background: var(--surface);
  border: 1px solid var(--line); font-weight: 600; font-size: .93rem; color: var(--accent);
}
.chip:hover { border-color: var(--accent); }
.map { position: relative; aspect-ratio: 16 / 10; border-radius: var(--r); overflow: hidden; display: grid; place-items: center; background: var(--surface); }
.map.loaded { background: var(--line); }

/* Contact */
.contact { background: var(--surface); }
.contact h2 { margin-bottom: 14px; }
.contact .lead { margin: 0 0 26px; }
.email {
  display: inline-block; font-size: clamp(1.45rem, 4.6vw, 3rem); font-weight: 700; font-stretch: 87.5%;
  text-decoration: none; overflow-wrap: anywhere; margin-bottom: 26px; line-height: 1.1; color: var(--accent);
  border-bottom: 3px solid var(--denim-40); padding-bottom: 6px;
}
.email:hover { border-bottom-color: currentColor; }

/* Footer */
.foot { background: var(--denim); color: #fff; padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); font-size: .92rem; }
.foot-in { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.foot .text-btn { color: #fff; font-size: .92rem; text-decoration-color: rgba(255, 255, 255, .45); }
.foot .text-btn:hover { text-decoration-color: #fff; }
.foot :focus-visible { outline-color: var(--warm); }

/* Video viewer */
.viewer { width: min(1100px, calc(100vw - 24px)); max-width: none; padding: 0; border: 0; background: transparent; color: #fff; }
.viewer::backdrop { background: rgba(14, 26, 38, .9); }
.viewer-in { display: grid; gap: 10px; }
.close {
  justify-self: end; border: 1px solid rgba(255, 255, 255, .4); background: transparent; color: #fff;
  border-radius: var(--r); padding: 8px 18px; cursor: pointer; font-weight: 600;
}
.close:hover { background: rgba(255, 255, 255, .12); }
.viewer-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: #000; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
