/*
Theme Name: CCUK
Description: Christian Congregation in the United Kingdom — v2 design system. White/gray neutrals with the brand navy; EB Garamond display, Public Sans body, IBM Plex Mono for times and codes.
Version: 1.2.0
Author: CCUK
Text Domain: ccuk
*/

/* Fonts (self-hosted) */
@font-face {
  font-family: 'EB Garamond Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url(fonts/eb-garamond-latin-wght-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'EB Garamond Variable';
  font-style: italic;
  font-display: swap;
  font-weight: 400 800;
  src: url(fonts/eb-garamond-latin-wght-italic.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'Public Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/public-sans-latin-wght-normal.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2');
}
/* CCUK v2 — design tokens
   Palette: white/gray neutrals + the existing brand navy; no warm tones
   Type: EB Garamond (display) · Public Sans (body) · IBM Plex Mono (times, codes) */

:root {
  --ink: #1a2530;
  --navy: #033d60;
  --navy-soft: #1d5379;
  --accent: #033d60;
  --accent-deep: #4d5a66;
  --paper: #f4f5f6;
  --card: #ffffff;
  --mist: #e2e6ea;
  --slate: #5c6873;
  --rule: #d9dcdf;

  --serif: 'EB Garamond Variable', Georgia, serif;
  --sans: 'Public Sans Variable', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; margin: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--navy); text-decoration-color: color-mix(in srgb, var(--navy) 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color 120ms ease; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 540; line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); }

.wrap { max-width: 72rem; margin-inline: auto; padding-inline: var(--gutter); }

/* eyebrow — small caps registry label */
.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* congregation code — engraved registry badge */
.code-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--slate);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.15rem 0.45rem;
  background: var(--card);
  white-space: nowrap;
}

/* ——— signature: hymnal-index rows with dot leaders ——— */
.hymnal { list-style: none; padding: 0; }
.hymnal li {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
  padding-block: 0.55rem;
}
.hymnal li + li { border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent) }
.hymnal .h-label { flex-shrink: 0; }
.hymnal .h-dots {
  flex: 1;
  min-width: 2ch;
  border-bottom: 2px dotted color-mix(in srgb, var(--slate) 45%, transparent);
  transform: translateY(-4px);
}
.hymnal .h-time {
  flex-shrink: 1;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--navy);
  text-align: right;
  max-width: 60%;
}

/* schedule block on location pages */
.svc { padding-block: 1rem; }
.svc + .svc { border-top: 1px solid var(--rule); }
.svc .eyebrow { display: block; margin-bottom: 0.3rem; }
.svc p { font-family: var(--mono); font-size: 0.875rem; line-height: 1.8; color: var(--ink); }

/* ——— dated-row component: framed tag left, title + meta right ——— */
.evt-list { list-style: none; padding: 0; display: grid; gap: 0.9rem; }
.evt { display: flex; gap: 1rem; align-items: center; }
.evt-date {
  flex-shrink: 0; width: 3.1rem; text-align: center;
  border: 1px solid var(--rule); border-radius: 3px; padding: 0.35rem 0;
  background: var(--paper);
}
.evt-day { display: block; font-family: var(--serif); font-size: 1.3rem; line-height: 1.1; color: var(--navy); }
.evt-mon { display: block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate); }
.evt-body { display: grid; gap: 0.1rem; min-width: 0; }
.evt-kind { font-weight: 600; }
a.evt-kind { text-decoration: none; color: var(--navy); }
a.evt-kind:hover { text-decoration: underline; }
.evt-meta { font-size: 0.82rem; color: var(--slate); }

.btn {
  display: inline-block;
  font-family: var(--sans); font-weight: 600; font-size: 0.9rem;
  color: var(--paper); background: var(--navy);
  padding: 0.65rem 1.3rem; border-radius: 2px;
  text-decoration: none;
}
.btn:hover { background: var(--navy-soft); }

table { border-collapse: collapse; width: 100%; }
th {
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--slate); text-align: left;
  padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--ink);
}
td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); }
td.t-mono { font-family: var(--mono); font-size: 0.85rem; }

/* ————— Layout: header / nav ————— */
.skip { position: absolute; left: -100vw; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--card); padding: .5rem 1rem; }

.notice-bar { background: #704049; text-align: center; }
.notice-bar a { display: block; padding: 0.45rem var(--gutter); color: #fff; font-size: 0.82rem; text-decoration: none; }
.notice-bar strong { border-bottom: 1px solid color-mix(in srgb, #fff 55%, transparent); font-weight: 650; }
.notice-bar a:hover strong { border-bottom-color: #fff; }

.site-head { border-bottom: 1px solid var(--rule); background: var(--card); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 0.9rem; }
.wordmark { display: block; line-height: 0; }
.wordmark img { display: block; }
.head-nav { display: flex; gap: 1.4rem; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.head-nav a, .sub-toggle { font-size: 0.9rem; font-weight: 550; text-decoration: none; color: var(--ink); padding-block: 0.2rem; border-bottom: 2px solid transparent; }
.head-nav > li > a:hover, .head-nav a[aria-current], .has-sub:hover .sub-toggle, .has-sub:focus-within .sub-toggle, .sub-toggle.sub-active { border-bottom-color: var(--accent); }
.head-nav .members { color: var(--navy); font-weight: 650; }

.sub-toggle { background: none; border: none; border-bottom: 2px solid transparent; padding-inline: 0; font-family: var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; }
.has-sub { position: relative; }
.has-sub .sub {
  position: absolute; top: 100%; left: -0.9rem; z-index: 20;
  min-width: 14rem; list-style: none; padding: 0.4rem 0; margin: 0;
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  box-shadow: 0 8px 24px rgb(20 38 58 / 0.10);
  visibility: hidden; opacity: 0; transition: opacity 120ms ease;
}
.has-sub:hover .sub, .has-sub:focus-within .sub { visibility: visible; opacity: 1; }
.sub-right { left: auto; right: -0.9rem; min-width: 9rem; }
.has-sub .sub a { display: block; padding: 0.45rem 1rem; border-bottom: none; font-weight: 500; }
.has-sub .sub a:hover, .has-sub .sub a[aria-current] { background: var(--paper); color: var(--navy); }

.menu-toggle { display: none; background: none; border: none; color: var(--navy); padding: 0.4rem; cursor: pointer; }
.menu-toggle .mt-close { display: none; }
.menu-toggle[aria-expanded="true"] .mt-open { display: none; }
.menu-toggle[aria-expanded="true"] .mt-close { display: block; }

/* Mobile-menu language toggle — desktop uses the dropdown instead */
.lang-switch { display: none; }

@media (max-width: 1100px) {
  .menu-toggle { display: inline-flex; }
  #site-nav { display: none; width: 100%; padding-block: 0.75rem 1rem; border-top: 1px solid var(--rule); }
  .head-row.nav-open #site-nav { display: block; }

  /* EN | PT segmented toggle at the top of the menu */
  .lang-switch { display: inline-flex; margin-bottom: 0.9rem; border: 1px solid var(--rule); border-radius: 3px; overflow: hidden; }
  .lang-switch a { padding: 0.3rem 1.15rem; font-size: 0.8rem; font-weight: 600; text-decoration: none; color: var(--slate); }
  .lang-switch a + a { border-left: 1px solid var(--rule); }
  .lang-switch a[aria-current] { background: var(--navy); color: #fff; }
  .head-nav .lang-item { display: none; }

  /* Sections collapse behind a tappable chevron row */
  .has-sub .sub { display: none; position: static; visibility: visible; opacity: 1; box-shadow: none; border: none; background: none; padding: 0.15rem 0 0.3rem 0.9rem; min-width: 0; }
  .has-sub.sub-open .sub { display: block; }
  .sub-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; cursor: pointer; }
  .sub-toggle svg { display: block; transition: transform 120ms ease; }
  .sub-open .sub-toggle svg { transform: rotate(180deg); }
  .head-nav { flex-direction: column; gap: 0.55rem; }
  .has-sub .sub a { display: block; padding: 0.25rem 0; }
}

/* ————— Footer ————— */
.site-foot { background: var(--ink); color: var(--mist); margin-top: 5rem; }
.site-foot a { color: var(--mist); }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem; padding-block: 3rem 2rem; font-size: 0.9rem; }
.foot-dim { color: color-mix(in srgb, var(--mist) 60%, transparent); font-size: 0.8rem; }
.foot-badge { background: transparent; color: var(--mist); border-color: color-mix(in srgb, var(--mist) 35%, transparent); }
.foot-logo { filter: invert(1); opacity: 0.85; }
.foot-sub { margin-top: 1.1rem; }
.foot-reg { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.45rem; line-height: 1.35; }
.foot-reg + .foot-reg { border-top: 1px solid color-mix(in srgb, var(--mist) 15%, transparent); }
.foot-reg a { text-decoration: none; }
.foot-reg a:hover { text-decoration: underline; }
.foot-line { border-top: 1px solid color-mix(in srgb, var(--mist) 20%, transparent); padding-block: 1.2rem; font-size: 0.78rem; color: color-mix(in srgb, var(--mist) 55%, transparent); }

/* ————— Home ————— */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.quick { margin-top: 2.2rem; }
.quick-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 0.5rem; }
@media (max-width: 860px) { .quick-list { grid-template-columns: repeat(4, 1fr); } }
.quick-link {
  display: flex; flex-direction: column; align-items: center; gap: 0.55rem;
  padding: 0.7rem 0.3rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--navy); text-align: center; text-decoration: none; border-radius: 3px;
  transition: color 120ms ease;
}
.q-icon {
  display: flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem; color: var(--navy);
  background: var(--card); border: 1px solid var(--rule); border-radius: 50%;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.quick-link:hover { color: var(--navy); }
.quick-link:hover .q-icon { border-color: var(--navy); background: color-mix(in srgb, var(--mist) 45%, var(--card)); }

.today { margin-top: 1.5rem; }
.today-list { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.today-list .evt-time-tag { display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 0.82rem; color: var(--navy); min-height: 2.9rem; width: 3.6rem; }
.today-list .evt-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-empty { margin-top: 0.2rem; color: var(--slate); font-size: 0.9rem; }

.two-up { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1.5rem; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 1.6rem 1.8rem; }
.panel > .eyebrow { display: block; margin-bottom: 1.1rem; color: var(--navy); font-size: 0.78rem; font-weight: 700; }
.today-date {
  display: inline-block; margin-left: 0.55rem; padding: 0.18rem 0.6rem;
  background: var(--navy); color: #fff; border-radius: 2px;
  font-size: 0.7rem; letter-spacing: 0.08em; vertical-align: baseline;
}
/* On narrow screens the badge wraps — drop to its own line, flush left. */
@media (max-width: 600px) {
  .today-date { display: block; width: fit-content; margin: 0.5rem 0 0; }
}
.panel-more { margin-top: 1rem; font-size: 0.9rem; }

/* ————— Pages ————— */
.page-head { padding-block: 3rem 1rem; }
.page-head h1 { margin-top: 0.4rem; }
.page-head-row { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }

.article, .narrow { max-width: calc(var(--measure) + 2 * var(--gutter)); padding-bottom: 1rem; }
.article p { margin-bottom: 1.1rem; }
.article .lede { font-family: var(--serif); font-size: 1.35rem; line-height: 1.5; color: var(--navy); }
.points { padding-left: 0; list-style: none; counter-reset: pt; }
.points li { counter-increment: pt; margin-bottom: 1.3rem; padding-left: 3.2rem; position: relative; }
.points li::before {
  content: counter(pt, decimal-leading-zero);
  position: absolute; left: 0; top: 0.15rem;
  font-family: var(--mono); font-size: 0.85rem; color: var(--accent-deep);
  border-bottom: 2px dotted color-mix(in srgb, var(--slate) 40%, transparent);
  padding-bottom: 2px;
}

/* Locations archive */
.search { position: relative; display: block; margin-bottom: 0.3rem; }
.search svg { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--slate); pointer-events: none; }
#loc-filter {
  appearance: none; -webkit-appearance: none;
  font-family: var(--sans); font-size: 0.92rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.55rem 0.9rem 0.55rem 2.35rem; width: min(34rem, 100%);
  transition: border-color 120ms ease;
}
#loc-filter::placeholder { color: var(--slate); }
#loc-filter::-webkit-search-cancel-button { -webkit-appearance: none; }
#loc-filter:hover { border-color: var(--slate); }
#loc-filter:focus-visible { border-color: var(--navy); outline: 2px solid var(--accent); outline-offset: 1px; }
#loc-none { margin-top: 2rem; color: var(--slate); }
.country { margin-top: 2.5rem; }
.country h2 { border-bottom: 2px solid var(--ink); padding-bottom: 0.4rem; }
.regions { columns: 16rem; column-gap: 1.8rem; margin-top: 1.4rem; }
.region-group { break-inside: avoid; margin-bottom: 1.8rem; }
.loc-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.7rem; margin-top: 0.4rem; }
.loc-card {
  display: grid; gap: 0.15rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 3px;
  padding: 0.85rem 1rem; text-decoration: none;
  transition: border-color 120ms ease;
}
.loc-card:hover { border-color: var(--accent); }
.loc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.loc-name { font-family: var(--serif); font-size: 1.15rem; color: var(--navy); }
.loc-pc { font-family: var(--mono); font-size: 0.72rem; color: var(--slate); white-space: nowrap; }
.loc-addr { font-size: 0.8rem; color: var(--slate); }
.loc-card .code-badge { justify-self: start; margin-top: 0.35rem; }

/* Location detail */
.crumb { padding-top: 2rem; font-size: 0.85rem; color: var(--slate); }
.loc-head { padding-block: 0.75rem 2rem; display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.detail { display: grid; grid-template-columns: minmax(20rem, 5fr) minmax(18rem, 4fr); gap: 3rem; align-items: start; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.detail-info { border-top: 2px solid var(--ink); }
.addr { font-size: 1.05rem; max-width: 34ch; }
.check { margin-top: 1.5rem; font-size: 0.88rem; color: var(--slate); }
.detail-media { display: grid; gap: 1rem; }
.detail-media img { width: 100%; height: auto; border-radius: 3px; border: 1px solid var(--rule); }
.detail-media iframe { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--rule); border-radius: 3px; }

/* Contacts directory page uses the full site width */
.ccuk-directory-page .wrap.article { max-width: 72rem; }

/* Map app links on location pages */
.map-links { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-top: 0.8rem; font-size: 0.85rem; }
.map-links a { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--slate); }
.map-links a:hover { color: var(--navy); }

/* Back link on single posts */
.back-link { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); font-size: 0.9rem; }

/* Letters (memorandums) */
.memo { border-top: 1px solid var(--rule); padding-top: 2rem; margin-bottom: 2.5rem; }
.memo-meta { color: var(--slate); font-size: 0.88rem; margin-bottom: 1.2rem; }
.memo-sign { font-style: italic; }

/* Notices */
.notices { list-style: none; padding: 0; }
.notice { padding-block: 1.1rem; }
.notice + .notice { border-top: 1px solid var(--rule); }
.n-loc { font-family: var(--serif); font-size: 1.15rem; margin-bottom: 0.2rem; }
.n-text { color: var(--ink); font-size: 0.95rem; }
.month { margin-bottom: 2rem; }
.month h2 { border-bottom: 2px solid var(--ink); padding-bottom: 0.3rem; margin-bottom: 0.8rem; }
.past-head { margin-top: 3rem; }

/* Memorandums index + offerings bank card */
.year { margin-bottom: 2rem; }
.year h2 { font-size: 1.2rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.3rem; margin-bottom: 0.5rem; }
.memo-list { list-style: none; padding: 0; }
.memo-list li { padding-block: 0.55rem; }
.memo-list li + li { border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent); }
.bank { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 1.8rem 2rem; margin-bottom: 3rem; }
.bank h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.bank-details { display: grid; gap: 0.45rem; margin: 0; }
.bank-details > div { display: flex; gap: 0.6ch; flex-wrap: wrap; }
.bank-details dt { color: var(--slate); font-size: 0.9rem; min-width: 10.5rem; }
.bank-details dd { margin: 0; font-weight: 550; }
.bank-details .mono { font-family: var(--mono); font-size: 0.95rem; }
.bank-note { margin-top: 1rem; font-size: 0.9rem; color: var(--slate); }
.memo { border-top: 1px solid var(--rule); padding-top: 2rem; margin-bottom: 2.5rem; }
.memo h2 { font-size: 1.35rem; }
.memo-subject { font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.92rem; }
.gate { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 2rem; display: grid; justify-items: start; gap: 0.8rem; max-width: 42rem; }
.gate svg { color: var(--navy); }
.video-embed { max-width: 46rem; }
.video-embed iframe { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--rule); border-radius: 3px; }
.form-embed iframe { width: 100%; max-width: 46rem; min-height: 60rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--card); }

tr.past td, tr.past a { color: color-mix(in srgb, var(--slate) 55%, transparent); }
tr.past a { text-decoration-color: color-mix(in srgb, var(--slate) 30%, transparent); }

/* Halls */
.hall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.9rem; margin-top: 1rem; }
.hall-name { font-weight: 600; }
.hall-name a { text-decoration: none; }
.hall-name a:hover { text-decoration: underline; }

/* copy-address button */
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--sans); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--navy); background: var(--card);
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 0.25rem 0.55rem; cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.copy-btn:hover { border-color: var(--navy); }
.copy-btn.copied { background: var(--navy); color: #fff; border-color: var(--navy); }

.notice-head { display: inline-flex; align-items: center; gap: 0.45rem; }
.notice-head svg { flex-shrink: 0; margin-top: -1px; }

.past-date { color: color-mix(in srgb, var(--slate) 55%, transparent) !important; }
