/* Garrison Project – main stylesheet.
   The page background and accent colours are set in Admin > Site settings, and the other colours
   are worked out from them (see src/theme.js). The values in :root below are only fallbacks. */
:root {
  --night: #0F1E33;      /* page background – the night sky */
  --deep: #0A1628;       /* footer, inputs */
  --stone: #172842;      /* panels – the castle walls */
  --stone-2: #1F3352;
  --line: rgba(226, 182, 92, 0.22);
  --gold: #E2B65C;       /* overridden by accent colour setting */
  --lamp: #F6E3B4;       /* soft lamplight */
  --text: #EDE4D0;
  --muted: #A7B2C4;
  --danger: #E58B7A;
  --gold-ink: #E2B65C;
  --err-text: #F4C3B8;
  --ok-text: #CDE6CB;
  --ok: #9CCB9A;
  --radius: 10px;
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--text); font: 18px/1.6 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
img, video, iframe { max-width: 100%; }
a { color: var(--lamp); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; color: var(--lamp); margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: .01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(560px, 100% - 2.5rem); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.stack > * + * { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header ---------- */
.site-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--deep) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--lamp); text-decoration: none; letter-spacing: .04em; }
.brand svg { width: 28px; height: 28px; color: var(--gold); flex: none; }
.nav { display: flex; align-items: center; gap: 1.25rem; margin-left: auto; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; padding: .3rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--gold); }
.nav form { margin: 0; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: .4rem .7rem; font: inherit; cursor: pointer; }
@media (max-width: 820px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: var(--deep); border-bottom: 1px solid var(--line); padding: .5rem 1.25rem 1rem; }
  .nav.open { display: flex; }
  .nav a, .nav .linkish { padding: .75rem 0; border-bottom: 1px solid var(--line); }
}

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: 600 1rem/1 var(--body); padding: .85rem 1.4rem; border-radius: 999px; border: 1px solid var(--gold); background: var(--gold); color: #1A1406; text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s; }
.btn:hover { box-shadow: 0 0 0 4px rgba(226, 182, 92, .2); }
.btn.ghost { background: transparent; color: var(--lamp); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); }
.btn.small { padding: .55rem 1rem; font-size: .92rem; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(229, 139, 122, .4); }
.btn.pray { font-size: 1.1rem; padding: 1rem 1.6rem; }
.linkish { background: none; border: 0; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; padding: .3rem 0; text-align: left; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; margin-top: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=time], input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--deep); border: 1px solid var(--stone-2); border-radius: 8px; padding: .7rem .85rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(226, 182, 92, .2); }
input[type=color] { width: 4rem; height: 2.6rem; background: none; border: 1px solid var(--stone-2); border-radius: 8px; padding: 2px; }
input[type=file] { font: inherit; color: var(--muted); }
textarea { min-height: 9rem; resize: vertical; }
.field { margin-bottom: 1.2rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check input { margin-top: .35rem; accent-color: var(--gold); width: 1.05rem; height: 1.05rem; }
.days { display: flex; flex-wrap: wrap; gap: .4rem; }
.days label { margin: 0; font-weight: 500; }
.days input { position: absolute; opacity: 0; }
.days span { display: inline-block; padding: .4rem .8rem; border: 1px solid var(--stone-2); border-radius: 999px; cursor: pointer; }
.days input:checked + span { background: var(--gold); border-color: var(--gold); color: #1A1406; }
.days input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.2rem; }
.alert { padding: .8rem 1rem; border-radius: 8px; margin: 1rem 0; border: 1px solid; }
.alert.error { border-color: rgba(229, 139, 122, .5); color: var(--err-text); background: rgba(229, 139, 122, .08); }
.alert.success { border-color: rgba(156, 203, 154, .45); color: var(--ok-text); background: rgba(156, 203, 154, .08); }
.alert.info { border-color: var(--line); background: rgba(226, 182, 92, .06); }
.panel { background: var(--stone); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }

/* ---------- Home hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; padding: 3.5rem 0 3rem; }
.hero .lede { font-size: 1.2rem; color: var(--text); }
.hero .tagline { font-family: var(--display); color: var(--gold-ink); font-size: 1.05rem; margin-bottom: 1rem; }
.hero .ctas { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
/* the artwork sits in an arched window, like a tower window on the wall */
.window { position: relative; aspect-ratio: 3 / 4.2; border-radius: 999px 999px var(--radius) var(--radius); overflow: hidden; border: 1px solid rgba(246, 227, 180, .45);
  box-shadow: 0 0 80px rgba(226, 182, 92, .18); background: var(--stone) center 20% / cover no-repeat; }
.window::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(15, 30, 51, .65)); }
.window .live-tag { position: absolute; z-index: 1; left: 50%; bottom: 1.2rem; transform: translateX(-50%); white-space: nowrap; background: rgba(10, 22, 40, .8); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; font-size: .92rem; color: #EDE4D0; }
.pulse { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--gold); margin-right: .45rem; box-shadow: 0 0 0 0 rgba(226, 182, 92, .7); animation: pulse 2s infinite; vertical-align: middle; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(226, 182, 92, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 182, 92, 0); } }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .hero .window { order: -1; aspect-ratio: auto; height: 62vh; min-height: 380px; border-radius: 0; border: 0; margin: 0 -1.25rem; }
  .hero .copy { padding: 2rem 0 1rem; }
}

/* ---------- The wall: 24 one-hour watches ---------- */
.wall { margin: 2rem 0 3.5rem; }
.wall-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem 2rem; }
.wall-bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 140px; margin-top: 1rem; padding-bottom: .2rem; border-bottom: 1px solid var(--line); }
.wall-bars .bar { position: relative; background: linear-gradient(180deg, var(--lamp), var(--gold)); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85; }
.wall-bars .bar.empty { background: var(--stone-2); opacity: 1; }
.wall-bars .bar.now { box-shadow: 0 0 18px rgba(246, 227, 180, .7); opacity: 1; }
.wall-hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; font-size: .72rem; color: var(--muted); text-align: center; margin-top: .3rem; }
@media (max-width: 600px) { .wall-hours span:nth-child(odd) { visibility: hidden; } .wall-bars { height: 100px; } }
.stats { display: flex; flex-wrap: wrap; gap: .4rem 2rem; color: var(--muted); }
.stats strong { color: var(--lamp); font-family: var(--display); font-size: 1.3rem; margin-right: .3rem; }

/* ---------- Lists of watches ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-bottom: 3.5rem; }
@media (max-width: 820px) { .two-col { grid-template-columns: 1fr; gap: 1.5rem; } }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-list li { display: flex; align-items: center; gap: .9rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.watch-list .flag { font-size: 1.6rem; line-height: 1; }
.watch-list .who { flex: 1; min-width: 0; }
.watch-list .who a { font-weight: 600; text-decoration: none; }
.watch-list .when { text-align: right; color: var(--muted); font-size: .92rem; white-space: nowrap; }

/* ---------- Page banner (uses a changeable background per section) ---------- */
.banner { position: relative; padding: 4rem 0 2.5rem; background: var(--stone) center 30% / cover no-repeat; margin-bottom: 2.5rem; }
.banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--night) 55%, transparent), var(--night)); }
.banner .wrap { position: relative; }
.banner p { font-size: 1.12rem; }

/* ---------- Nations ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1.5rem; }
.toolbar input[type=search] { max-width: 340px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: .5rem 1rem; text-decoration: none; color: var(--text); }
.seg a[aria-current="true"] { background: var(--gold); color: #1A1406; }
.nation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; list-style: none; padding: 0; margin: 0 0 4rem; }
.nation-grid a { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border-radius: 8px; border: 1px solid transparent; text-decoration: none; color: var(--text); }
.nation-grid a:hover { border-color: var(--line); background: var(--stone); }
.nation-grid .flag { font-size: 1.5rem; }
.nation-grid .count { margin-left: auto; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.nation-grid .count.has { color: var(--gold-ink); }
.nation-grid .count.none { color: var(--muted); font-style: italic; }
.nation-grid .mine { outline: 1px solid var(--gold); }

.group-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1.2rem; align-items: center; padding: 1.2rem 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--stone); margin-bottom: .8rem; }
.group-card .time { font-family: var(--display); font-size: 1.7rem; color: var(--lamp); line-height: 1; }
.group-card .time small { display: block; font-family: var(--body); font-size: .8rem; color: var(--muted); margin-top: .35rem; }
@media (max-width: 600px) { .group-card { grid-template-columns: 1fr; } }
.badge { display: inline-block; font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.badge.live { border-color: var(--gold-ink); color: var(--gold-ink); }
.badge.lead { border-color: var(--lamp); color: var(--lamp); }

/* ---------- Dashboard ---------- */
.praying-now { border: 1px solid var(--gold); background: radial-gradient(ellipse at top, rgba(226, 182, 92, .18), transparent 70%), var(--stone); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 2rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.watch { border: 1px solid var(--line); border-radius: var(--radius); background: var(--stone); padding: 1.4rem; margin-bottom: 1rem; }
.watch.is-live { border-color: var(--gold); }
.watch-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.watch h3 { display: flex; align-items: center; gap: .6rem; margin: 0 0 .3rem; }
.watch .actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.watch details { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; }
.watch summary { cursor: pointer; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* ---------- News & programs ---------- */
.feed { display: grid; gap: 2.5rem; margin-bottom: 4rem; }
.post { display: grid; grid-template-columns: 280px 1fr; gap: 1.8rem; align-items: start; }
.post .media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); display: block; }
.post.no-media { grid-template-columns: 1fr; }
.post time { color: var(--muted); font-size: .9rem; }
@media (max-width: 700px) { .post { grid-template-columns: 1fr; gap: 1rem; } }
.video { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; margin: 1rem 0; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.article { max-width: 760px; margin: 0 auto 4rem; }
.article .body { white-space: pre-line; }
.article img.lead { width: 100%; border-radius: var(--radius); margin: 1rem 0; }

.program { display: grid; grid-template-columns: 110px 1fr; gap: 1.5rem; padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.program .date { text-align: center; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .4rem; align-self: start; }
.program .date .d { font-family: var(--display); font-size: 2rem; color: var(--lamp); line-height: 1; display: block; }
.program .date .m { color: var(--muted); font-size: .9rem; }
.program .kind { font-size: .85rem; color: var(--gold-ink); }
.program img { border-radius: var(--radius); max-height: 260px; object-fit: cover; width: 100%; margin: .5rem 0 1rem; }
@media (max-width: 600px) { .program { grid-template-columns: 1fr; } .program .date { justify-self: start; display: flex; gap: .6rem; align-items: baseline; padding: .4rem .9rem; } }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--deep); padding: 2rem 0; margin-top: 3rem; color: var(--muted); font-size: .92rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.socials { display: flex; gap: .9rem; flex-wrap: wrap; }
.socials a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .35rem; }
.socials a:hover { color: var(--lamp); }
.socials svg { width: 18px; height: 18px; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.5rem 0 2rem; }
.admin-nav a { padding: .45rem .95rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--text); }
.admin-nav a[aria-current="page"] { background: var(--gold); color: #1A1406; border-color: var(--gold); }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.admin-stats .panel strong { display: block; font-family: var(--display); font-size: 2rem; color: var(--lamp); }
.bg-row { display: grid; grid-template-columns: 140px 1fr; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.bg-row .thumb { aspect-ratio: 4/3; border-radius: 8px; background: var(--stone) center / cover; border: 1px solid var(--line); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem .4rem; margin: 0 0 1.5rem; }
legend { font-family: var(--display); color: var(--lamp); padding: 0 .5rem; }
.row-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.row-actions form { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.nav a.btn { color: #1A1406; border-bottom: 0; padding: .55rem 1rem; }
@media (max-width: 820px) { .nav a.btn { margin-top: .75rem; } }
