/* ============================================================
   St Neophytos Greek Orthodox Church — site stylesheet

   1. Tokens      every colour, size and distance used below
   2. Base        element defaults
   3. Layout      wrap, section, shared headings
   4. Components  one block per component, alphabetical
   5. Pages       hero and page-specific layouts

   Breakpoints (media queries cannot read custom properties, so
   the two values are written out where they are used):
     56rem  the header menu collapses; two-column layouts stack
     36rem  the brand tagline is dropped
   The Calendar page's month turns from a list of days into a grid
   of weeks where its own column is 48rem wide (container query).
   ============================================================ */

/* ── 1. Tokens ─────────────────────────────────────────────── */
:root {
  /* Palette */
  --color-black: #1E1E1E;
  --color-crimson: #BF2929;
  --color-gold: #F9C22E;
  --color-paper: #FBF8F2;
  --color-paper-warm: #F3EDE0;
  --color-white: #FFFFFF;

  /* Roles */
  --text: var(--color-black);
  --text-muted: color-mix(in srgb, var(--color-black) 74%, transparent);
  /* greyed out: the lightest grey that keeps a contrast of 4.5:1 on white */
  --text-faint: color-mix(in srgb, var(--color-black) 62%, transparent);
  --text-on-dark: var(--color-white);
  --text-on-dark-muted: color-mix(in srgb, var(--color-white) 72%, transparent);
  --rule: color-mix(in srgb, var(--color-black) 16%, transparent);
  --rule-on-dark: color-mix(in srgb, var(--color-white) 16%, transparent);
  --rule-gold: color-mix(in srgb, var(--color-gold) 50%, transparent);
  --scrim: color-mix(in srgb, var(--color-black) 70%, transparent);
  /* the black, lifted a little towards white: a dark surface that stands apart from black */
  --surface-dark-raised: color-mix(in srgb, var(--color-black), var(--color-white) 8%);
  --focus-ring: var(--color-crimson);

  /* Type */
  --font-serif: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* the readings on the Calendar page; Tinos (same letter widths) where Times New Roman is missing */
  --font-reading: 'Times New Roman', Tinos, Times, serif;
  --root-size: 106.25%;
  --size-label: 0.72rem;
  --size-small: 0.875rem;
  --size-body: 1rem;
  --size-lead: 1.125rem;
  --size-large: 1.35rem;
  /* service times in the ribbon: grows with the screen at a rate that keeps the longest
     line (the Greek one) on one line while the ribbon has three columns */
  --size-ribbon: clamp(var(--size-lead), 1.8vw, var(--size-large));
  --size-title: clamp(2rem, 4.2vw, 3.1rem);
  --size-display: clamp(2.75rem, 7vw, 4.75rem);
  --size-display-sub: clamp(1.3rem, 3.2vw, 2.25rem);
  --leading-display: 1;
  --leading-tight: 1.15;
  --leading-ribbon: 1.3;
  --leading-body: 1.75;
  /* the readings: Times New Roman has small lower-case letters, so it is set larger than the
     body text: from the lead size on phones, growing with the screen to its largest */
  --size-reading-max: 1.25rem;
  --size-reading: clamp(var(--size-lead), 1rem + 0.5vw, var(--size-reading-max));
  --leading-reading: 1.6;
  --tracking-label: 0.16em;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 600;

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-section: clamp(4rem, 9vw, 7rem);
  --gutter: clamp(1rem, 4vw, 1.5rem);

  /* Layout */
  --wrap: 75rem;
  --wrap-wide: 85rem;
  --measure: 62ch;
  --header-height: 4.75rem;
  /* the height of the screen under the header */
  --first-screen: calc(100svh - var(--header-height));
  --hero-min-height: 26rem;
  /* phones: the shape of the hero video, and how many service bands high the church's name is */
  --ratio-hero-phone: 1 / 1;
  --hero-name-bands: 1.5;
  --logo-size: 2.875rem;
  --footer-logo-size: 6.25rem;
  --icon-size: 1.1em;
  --tap-target: 2.75rem;
  --card-min-width: 17rem;
  --feed-columns: 3;
  --ribbon-item-min-width: 14rem;
  --footer-column-min-width: 13rem;
  --map-height: 26rem;
  --frame-offset: 1.125rem;
  --post-lines: 6;
  /* Calendar: the height of a date's box in the month grid, the width of the date in the
     list of days (weekday and number), and the width of the window behind a date */
  --day-min-height: 6.5rem;
  --day-label-width: 4.5rem;
  /* a date's box: white at half strength, so the picture behind the month shows through */
  --day-background: color-mix(in srgb, var(--color-white) 50%, transparent);
  --sheet-width: calc(var(--measure) + 2 * var(--space-5));
  /* A "read more" link in a card without text may grow into the free height under the
     picture: to one part in --solo-link-share of that height, and no larger than lets
     --solo-link-ems ems fill the card's width. The longest wording (the Greek one) with
     its arrow is about 10 ems wide, so it stays on one line. */
  --solo-link-share: 4;
  --solo-link-ems: 11;
  --ratio-figure: 3 / 4;
  --ratio-post-media: 4 / 3;

  /* Lines, motion */
  --hairline: 1px;
  --rule-accent-width: 3px;
  /* how much of a page-head picture shows through. At this value the title keeps a contrast
     of 3:1 and the line under it 4.5:1, even over a black part of the picture. */
  --head-picture-opacity: 0.2;
  /* a news post's title picture: its title is one short date, so the picture may be stronger */
  --post-head-opacity-scale: 1.5;
  /* wider than a phone the title picture stands at the side of the date, so it is shown whole
     (a multiple of --head-picture-opacity: 5 = full strength) */
  --post-head-opacity-wide: 5;
  /* on wide screens, how much of the strip's width fades out at each side, and how much of
     its height at the top and bottom */
  --post-head-fade: 35%;
  --post-head-fade-end: 15%;
  /* how much of a section's backdrop picture shows through: fainter than a page head, as the
     text over it is small */
  --backdrop-opacity: 0.12;
  /* a whole-picture backdrop's standard width */
  --backdrop-whole-width: 64rem;
  --duration: 0.3s;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --layer-header: 10;
}

/* ── 2. Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--root-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, ol, ul, figure, address, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
address { font-style: normal; }
img, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
strong { font-weight: var(--weight-bold); }
/* hidden wins over a component's own display (a .button is inline-flex) */
[hidden] { display: none !important; }

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

/* Phones: the logo is smaller, so the church name (longer in Greek) has room in the header,
   and the header is only as high as its buttons and a little space need. */
@media (max-width: 36rem) {
  :root {
    --logo-size: 2.5rem;
    --header-height: calc(var(--tap-target) + 2 * var(--space-2));
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s; }
}

/* ── 3. Layout ─────────────────────────────────────────────── */
.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}
.wrap--wide { width: min(100% - 2 * var(--gutter), var(--wrap-wide)); }

.section { padding-block: var(--space-section); }
.section--warm {
  background: var(--color-paper-warm);
  border-block: var(--hairline) solid var(--rule);
}
/* a picture faint behind the whole section (macro backdrop), under its content */
.section--backdrop { position: relative; }
.section--backdrop > :not(.backdrop) { position: relative; }
.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* a section may ask for a stronger or weaker picture (--backdrop-opacity-scale, from site.json) */
  opacity: calc(var(--backdrop-opacity) * var(--backdrop-opacity-scale, 1));
}
/* white: the section is white, so the picture's whites (made white by prepare_media.py)
   stay white through its opacity */
.section--backdrop:has(> .backdrop--white) { background: var(--color-white); }
/* whole: the whole picture, in its own shape, standing on the bottom of the section in the
   middle: as wide as --backdrop-whole-width (site.json may give its own `width`), or the
   section where that is narrower (a phone). Its sides are white, so it needs no fade. */
.section--backdrop:has(> .backdrop--whole) { overflow: clip; }
.backdrop--whole {
  inset: auto auto 0 50%;
  translate: -50% 0;
  width: min(100%, var(--backdrop-width, var(--backdrop-whole-width)));
  height: auto;
}

/* Running text: readable line length, muted ink, underlined links */
.prose p { max-width: var(--measure); color: var(--text-muted); overflow-wrap: break-word; }
.prose p + p { margin-top: var(--space-5); }
.prose a, .detail-list a {
  text-decoration-color: var(--color-gold);
  text-underline-offset: 0.2em;
  transition: color var(--duration) var(--ease);
}
.prose a:hover, .detail-list a:hover { color: var(--color-crimson); }

.section-head {
  display: grid;
  justify-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-7);
  text-align: center;
}

.section-title {
  color: var(--color-crimson);
  font-family: var(--font-serif);
  font-size: var(--size-title);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}
.section-head .section-title { margin-bottom: 0; }

.section-lead { color: var(--text-muted); font-size: var(--size-lead); }

.section-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4) var(--space-6);
  margin-top: var(--space-7);
}
.section-action--start { justify-content: flex-start; margin-top: var(--space-6); }

.note {
  max-width: var(--measure);
  margin-top: var(--space-5);
  color: var(--text-muted);
  font-size: var(--size-small);
}

.nowrap { white-space: nowrap; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: calc(var(--layer-header) + 1);
  padding: var(--space-2) var(--space-4);
  background: var(--color-gold);
  color: var(--color-black);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── 4. Components ─────────────────────────────────────────── */

/* Arrow link — "read more", set in the serif face like the church's name in the header */
.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-bottom: var(--hairline) solid var(--rule-gold);
  color: var(--color-crimson);
  font-family: var(--font-serif);
  font-size: var(--size-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  text-decoration: none;
  transition: border-color var(--duration) var(--ease);
}
.arrow-link:hover { border-bottom-color: var(--color-crimson); }
.arrow-link .icon { transition: transform var(--duration) var(--ease); }
.arrow-link:hover .icon { transform: translateX(var(--space-1)); }

/* Brand — logo and name in the header */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  text-decoration: none;
}
.brand__logo {
  width: var(--logo-size);
  height: var(--logo-size);
  border: var(--hairline) solid var(--rule-gold);
  border-radius: 50%;
}
.brand__text { display: grid; min-width: 0; line-height: var(--leading-tight); }
/* The church's name, on two lines set alike in the serif face. */
.brand__name,
.brand__tagline {
  /* one line each; on a very narrow screen a line is cut with an ellipsis, never run into the buttons */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-on-dark);
  font-family: var(--font-serif);
  font-size: var(--size-large);
  font-weight: var(--weight-medium);
}
/* Each line has two wordings (site.json, church.header): phones show the compact one, smaller. */
.brand__compact { display: none; }
@media (max-width: 36rem) {
  .brand { gap: var(--space-2); }
  .brand__wide { display: none; }
  .brand__compact { display: inline; }
  .brand__name,
  .brand__tagline { font-size: var(--size-small); }
}

/* Button — square and lettered */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: var(--tap-target);
  padding: var(--space-3) var(--space-6);
  border: var(--hairline) solid var(--color-gold);
  background: var(--color-gold);
  color: var(--color-black);
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-decoration: none;
  text-transform: uppercase;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.button:hover {
  border-color: var(--color-black);
  background: var(--color-black);
  color: var(--color-gold);
}
/* Outlined: no fill, a crimson stroke and crimson text; filled crimson with white text under
   the pointer and while pressed (a click or a tap). */
.button--outline {
  border: var(--rule-accent-width) solid var(--color-crimson);
  background: transparent;
  color: var(--color-crimson);
}
.button--outline:hover,
.button--outline:active {
  border-color: var(--color-crimson);
  background: var(--color-crimson);
  color: var(--text-on-dark);
}

/* Day sheet — the window behind a date on the Calendar page: a black bar with the date in
   the middle and Close at the right edge; under it the day's services, then the planner's
   saints and fast (in the site's text font) and the readings (in Times New Roman). White and
   square like the news cards; the dimmed page around it sets it apart, so it has no shadow. */
.day-sheet {
  width: min(100% - 2 * var(--gutter), var(--sheet-width));
  max-height: calc(100svh - 2 * var(--gutter));
  padding: 0;
  border: 0;
  background: var(--color-white);
  color: var(--text);
}
.day-sheet::backdrop { background: var(--scrim); }
/* Equal columns either side keep the date in the middle; when the screen is too narrow for
   that, the date gives way and Close keeps its room. */
.day-sheet__bar {
  --focus-ring: var(--color-gold);
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  padding-inline: var(--space-5);
  background: var(--surface-dark-raised);
  color: var(--text-on-dark);
}
.day-sheet__title {
  grid-column: 2;
  padding-block: var(--space-2);
  font-family: var(--font-serif);
  font-size: var(--size-lead);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  text-align: center;
  font-variant-numeric: lining-nums;
}
.day-sheet__close {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-target);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  transition: color var(--duration) var(--ease);
}
.day-sheet__close:hover { color: var(--color-gold); }
.day-sheet__body {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-5);
}
.day-sheet__body > :empty { display: none; }
.day-sheet__body .note { margin-top: 0; }
/* The services and the day (saints, fast, tone) are centred; a line separates them from the
   readings, which read from the left. */
.day-sheet .events {
  font-size: var(--size-body);
  text-align: center;
}
.planner__day { text-align: center; }

/* in normal case: the polytonic Greek titles keep their accents, which capitals drop */
.planner__label {
  color: var(--color-crimson);
  font-size: var(--size-small);
  font-weight: var(--weight-bold);
}
.planner__saints { margin-top: var(--space-1); }
.planner__notes { margin-top: var(--space-4); font-weight: var(--weight-medium); }
.planner__readings {
  margin-top: var(--space-6);
  border-top: var(--hairline) solid var(--rule);
}

/* A reading: its title, the reference and the text, all in one font at one size; the title
   stands out by colour and weight only. */
.reading {
  margin-top: var(--space-6);
  font-family: var(--font-reading);
  font-size: var(--size-reading);
  line-height: var(--leading-reading);
}
.reading__title {
  color: var(--color-crimson);
  font-size: inherit;
  font-weight: var(--weight-bold);
}
.reading__text { margin-top: var(--space-3); }

/* Detail list — label and value rows (contact details, service pattern) */
.detail-list {
  display: grid;
  border-top: var(--hairline) solid var(--rule);
}
.detail-list__item {
  display: grid;
  gap: var(--space-1);
  padding-block: var(--space-4);
  border-bottom: var(--hairline) solid var(--rule);
}
.detail-list__name {
  color: var(--color-crimson);
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.detail-list__when {
  font-family: var(--font-serif);
  font-size: var(--size-large);
  line-height: 1.4;
  /* a long email address may break instead of pushing the page wider than a phone */
  overflow-wrap: anywhere;
}

/* Feed — Facebook posts as site cards */
.feed {
  --feed-gap: var(--space-5);
  display: grid;
  /* at most --feed-columns cards in a row; fewer when a card would get narrower than its minimum */
  grid-template-columns: repeat(auto-fit, minmax(max(var(--card-min-width),
    (100% - (var(--feed-columns) - 1) * var(--feed-gap)) / var(--feed-columns)), 1fr));
  gap: var(--feed-gap);
}
.feed-empty { color: var(--text-muted); text-align: center; }

/* Icon */
.icon {
  flex-shrink: 0;
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Language switch */
.language-switch {
  display: flex;
  border: var(--hairline) solid var(--rule-gold);
}
.language-switch__button {
  padding: var(--space-1) var(--space-3);
  border: 0;
  background: transparent;
  color: var(--text-on-dark-muted);
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.language-switch__button:hover { color: var(--text-on-dark); }
/* Phones: narrower buttons leave the church's name more room. */
@media (max-width: 36rem) {
  .language-switch__button { padding-inline: var(--space-2); }
}
.language-switch__button[aria-pressed="true"] {
  background: var(--color-gold);
  color: var(--color-black);
}

/* Month — the Calendar page's month of services. Each date is a white box on the warm
   section, like the news cards: no outline, no shadow, square corners. In a narrow column
   the month is a list of days; from 48rem, where the longest Greek words fit a seventh of
   it, a grid of weeks. The whole box of a date
   opens the window behind it (Day sheet). */
.month { container: month / inline-size; }
/* the "Today's Readings" button, centred above the month's title */
.month__today {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
}
.month__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.month__title {
  color: var(--color-crimson);
  font-family: var(--font-serif);
  font-size: var(--size-title);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
  text-align: center;
}
.month__step {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: var(--tap-target);
  height: var(--tap-target);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: color var(--duration) var(--ease);
}
.month__step:hover { color: var(--color-crimson); }
/* no step past the first or last month there is */
.month__step:disabled { visibility: hidden; }
.month__step--previous .icon { transform: scaleX(-1); }
.month__weekdays { display: none; }
.month__days { display: grid; gap: var(--space-1); }

.day {
  position: relative;
  display: grid;
  grid-template-columns: var(--day-label-width) 1fr;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--day-background);
}
.day__date {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.day__date::after { content: ""; position: absolute; inset: 0; }
.day__date:focus-visible { outline: none; }
.day__date:focus-visible::after {
  outline: var(--rule-accent-width) solid var(--focus-ring);
  outline-offset: calc(-1 * var(--rule-accent-width));
}
.day__weekday { color: var(--text-muted); font-size: var(--size-small); }
.day__number {
  font-family: var(--font-serif);
  font-size: var(--size-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  /* the serif's old-style figures make 11 look like II (here and in the day sheet) */
  font-variant-numeric: lining-nums;
}
.day__date[aria-current="date"] .day__number { color: var(--color-crimson); }
/* a date with an event in an "inverse" category: white bold text on black */
.day--inverse {
  background: var(--color-black);
  color: var(--text-on-dark);
  font-weight: var(--weight-bold);
}
.day--inverse .day__weekday { color: var(--text-on-dark); }
.day--inverse .day__number,
.day--inverse .event__time { font-weight: var(--weight-bold); }
.day--inverse .event--muted { color: var(--text-on-dark-muted); }

/* A date's box turns crimson with white text under the pointer, and gold with black text
   while it is pressed (a click, or a tap on a phone, which has no pointer to hover). The
   date and the services take the box's colour. */
.day { transition: background var(--duration) var(--ease), color var(--duration) var(--ease); }
@media (hover: hover) {
  .day:has(.day__date:hover) {
    --focus-ring: var(--color-gold);
    background: var(--color-crimson);
    color: var(--text-on-dark);
  }
  .day:has(.day__date:hover) :is(.day__weekday, .day__number, .event--muted) { color: inherit; }
}
.day:has(.day__date:active) {
  --focus-ring: var(--color-black);
  background: var(--color-gold);
  color: var(--color-black);
}
.day:has(.day__date:active) :is(.day__weekday, .day__number, .event--muted) { color: inherit; }

.events {
  display: grid;
  gap: var(--space-2);
  font-size: var(--size-small);
  line-height: var(--leading-tight);
  /* a title typed longer than its box breaks rather than runs out of it */
  overflow-wrap: break-word;
  hyphens: auto;
}
.event__time { font-variant-numeric: tabular-nums; font-weight: var(--weight-medium); }
.event__place { display: block; }
.event--muted { color: var(--text-faint); }
.event--cancelled .event__time,
.event--cancelled .event__title { text-decoration: line-through; }

@container month (min-width: 48rem) {
  .month__weekdays,
  .month__days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--space-2);
  }
  .month__weekdays {
    display: grid;
    margin-bottom: var(--space-2);
    color: var(--text-muted);
    font-size: var(--size-small);
  }
  /* each name stands over the dates' numbers */
  .month__weekdays > * { padding-inline: var(--space-3); }
  .day {
    grid-template-columns: none;
    align-content: start;
    gap: var(--space-2);
    min-height: var(--day-min-height);
    padding: var(--space-3);
  }
  /* the first of the month stands under its weekday */
  .day:first-child { grid-column-start: var(--first-column); }
  .day__weekday { display: none; }
}

/* Nav toggle — the menu button on small screens */
.nav-toggle {
  display: none;
  place-items: center;
  width: var(--tap-target);
  height: var(--tap-target);
  border: 0;
  background: transparent;
  color: var(--text-on-dark);
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: var(--space-5);
  height: 2px;
  background: currentColor;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before,
.nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: calc(-1 * var(--space-2)); }
.nav-toggle__bars::after { top: var(--space-2); }

/* Page head — title band of the inner pages */
.page-head {
  /* the band's standard height: its padding, the title and one line under it */
  --head-height: calc(var(--space-8) + var(--space-7) + var(--size-display) * var(--leading-tight)
                      + var(--space-3) + var(--size-lead) * var(--leading-body));
  /* A page may ask for a taller band (--head-height-scale, from site.json). The added height
     goes half above and half below the words. */
  --head-added: calc(var(--head-height) * (var(--head-height-scale, 1) - 1) / 2);
  position: relative;
  padding-block: calc(var(--space-8) + var(--head-added)) calc(var(--space-7) + var(--head-added));
  background: var(--color-paper-warm);
  border-bottom: var(--hairline) solid var(--rule);
}
/* a picture behind the title, faded into the band's colour so that the words stay easy to read */
.page-head__picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* a page may ask for a stronger or weaker picture (--head-opacity-scale, from site.json) */
  opacity: calc(var(--head-picture-opacity) * var(--head-opacity-scale, 1));
}
.page-head > .wrap { position: relative; }
/* a news post: the strip behind its short title shows a little stronger */
.page-head--post {
  --head-opacity-scale: var(--post-head-opacity-scale);
  /* in the colour of its picture's edges, and the date in a colour that stays readable on
     it, on every screen (build.py, news.titleBand in site.json); without them, the usual band */
  background: var(--post-head-band, var(--color-paper-warm));
}
.page-head--post .page-head__title { color: var(--post-head-ink, var(--color-crimson)); }
.page-head--post .page-head__label { color: var(--post-head-ink, var(--text-muted)); }
/* darkened as much as its band, where the band was darkened for the date to stand out */
.page-head--post .page-head__picture { filter: brightness(var(--post-head-shade, 1)); }
/* Wider than a phone, the band is much wider than the strip: stretched across, the strip
   would be enlarged until nothing in it can be made out. So it keeps its own shape, at the
   band's height, and ends where the page's content column ends (the right edge of .wrap),
   so it lines up with the text below at any width. It fades into the band at both sides
   (--post-head-fade of its width each), so it has no edge. */
@media (min-width: 48rem) {
  /* the picture whole */
  .page-head--post { --head-opacity-scale: var(--post-head-opacity-wide); }
  .page-head--post .page-head__picture {
    left: auto;
    right: max(var(--gutter), (100% - var(--wrap)) / 2);
    width: auto;
    max-width: 100%;
    /* eased fades (a straight one shows where it stops): the sides over --post-head-fade of
       the width, top and bottom over --post-head-fade-end of the height; the middle is whole */
    mask-image:
      linear-gradient(to right,
        transparent,
        rgb(0 0 0 / 0.1) calc(var(--post-head-fade) * 0.3),
        rgb(0 0 0 / 0.45) calc(var(--post-head-fade) * 0.6),
        rgb(0 0 0 / 0.85) calc(var(--post-head-fade) * 0.85),
        black var(--post-head-fade),
        black calc(100% - var(--post-head-fade)),
        rgb(0 0 0 / 0.85) calc(100% - var(--post-head-fade) * 0.85),
        rgb(0 0 0 / 0.45) calc(100% - var(--post-head-fade) * 0.6),
        rgb(0 0 0 / 0.1) calc(100% - var(--post-head-fade) * 0.3),
        transparent),
      linear-gradient(to bottom,
        transparent, black var(--post-head-fade-end),
        black calc(100% - var(--post-head-fade-end)), transparent);
    mask-composite: intersect;
  }
}

.page-head__title {
  color: var(--color-crimson);
  font-family: var(--font-serif);
  font-size: var(--size-display);
  font-weight: var(--weight-regular);
  line-height: var(--leading-tight);
}
.page-head__label {
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.page-head__lead {
  margin-top: var(--space-3);
  color: var(--text-muted);
  font-size: var(--size-lead);
}

/* Post — one Facebook post: a plain white card. Its date is the heading, and the picture
   sits inside the card's margin, like a photograph on a mount. */
.post {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  --post-gap: var(--space-4);
  --post-padding: var(--space-5);
  gap: var(--post-gap);
  padding: var(--post-padding);
  background: var(--color-white);
}
.post__date {
  /* centred over the picture */
  align-self: center;
  text-align: center;
  font-family: var(--font-serif);
  font-size: var(--size-large);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
}
.post__media { align-self: stretch; }
.post__media img {
  width: 100%;
  aspect-ratio: var(--ratio-post-media);
  object-fit: cover;
}
.post__text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--post-lines);
  line-clamp: var(--post-lines);
  font-size: var(--size-small);
  white-space: pre-line;
}
/* the link is centred at the foot of the card */
.post__more { margin-top: auto; align-self: center; }
/* A post without text: the link follows the picture directly. Its line then takes all the
   height the card has left, which is more than one line only where a taller card stands
   beside it. The link is in the middle of that height and grows with it: up to a share of
   the height, and never wider than the card. In a card that stands alone it has no height
   to spare, so the link is as on every other card. */
.post__media + .post__more {
  --line: calc(var(--size-large) * var(--leading-tight) + var(--hairline));
  --spare: calc(100cqb - var(--line));
  display: grid;
  flex: 1;
  align-self: stretch;
  place-items: center;
  min-height: var(--line);
  /* lets the link measure this line's width and height (cqi, cqb) */
  container-type: size;
}
.post__media + .post__more .arrow-link {
  /* the card's margin is wider than the gap under the picture: with height to spare, shift
     by half the difference, so the white above and below the link is equal */
  translate: 0 min(var(--spare) / 2, (var(--post-padding) - var(--post-gap)) / 2);
  font-size: clamp(var(--size-large), calc(100cqb / var(--solo-link-share)),
                   calc(100cqi / var(--solo-link-ems)));
}

/* Article picture — the picture of one news post, beside its text; it scrolls with the page */
.article-picture {
  width: 100%;
  border: var(--hairline) solid var(--rule);
}

/* Poster — the announcement picture fills its section from edge to edge. It is never
   taller than the screen below the header, so the whole poster is in view at once; where
   that leaves room beside it, the section continues the poster's own edge colour. */
.poster { background: var(--backdrop-portrait); }
@media (orientation: landscape) {
  .poster { background: var(--backdrop-landscape); }
}
.poster__image {
  width: 100%;
  max-height: var(--first-screen);
  object-fit: contain;
}

/* Pull quote */
.pull-quote {
  margin-block: var(--space-6);
  padding: var(--space-1) 0 var(--space-1) var(--space-5);
  border-left: var(--rule-accent-width) solid var(--color-gold);
  color: var(--color-crimson);
  font-family: var(--font-serif);
  font-size: var(--size-large);
  line-height: 1.45;
}

/* Ribbon — service times under the hero. Black, with the next service (from the parish
   calendar) in crimson between them. */
.ribbon {
  --focus-ring: var(--color-gold);
  background: var(--color-black);
  color: var(--text-on-dark);
}
.ribbon-list {
  display: grid;
  /* one column for each service */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: var(--hairline);
  /* the gap shows this colour, which draws the dividers between items */
  background: var(--rule-on-dark);
}
.ribbon-list__item {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--color-black);
  text-align: center;
}
.ribbon-list__item--next {
  position: relative;
  background: var(--color-crimson);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.ribbon-list__item--next a { text-decoration-color: var(--color-gold); }
/* The next service's date opens the window behind it; the whole box is the button. Under
   the pointer the box turns white with crimson text, and gold with black text while it is
   pressed (a click or a tap). */
.next-service {
  padding: 0;
  border: 0;
  background: none;
}
.next-service::after { content: ""; position: absolute; inset: 0; }
.next-service:focus-visible { outline: none; }
.next-service:focus-visible::after {
  outline: var(--rule-accent-width) solid var(--focus-ring);
  outline-offset: calc(-1 * var(--rule-accent-width));
}
@media (hover: hover) {
  .ribbon-list__item--next:has(.next-service:hover) {
    background: var(--color-white);
    color: var(--color-crimson);
  }
}
.ribbon-list__item--next:has(.next-service:active) {
  --focus-ring: var(--color-black);
  background: var(--color-gold);
  color: var(--color-black);
}
.ribbon-list__name {
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.ribbon-list__when {
  font-family: var(--font-serif);
  font-size: var(--size-ribbon);
  font-weight: var(--weight-medium);
  line-height: var(--leading-ribbon);
}
/* Narrow screens: the services stack as bands across the whole width, set smaller
   so that all of them stay on the first screen. */
@media (max-width: 56rem) {
  .ribbon .wrap { width: 100%; }
  .ribbon-list { grid-auto-flow: row; }
  .ribbon-list__item { padding-block: var(--space-3); }
  .ribbon-list__name { line-height: var(--leading-tight); }
}

/* Site footer */
.site-footer {
  --focus-ring: var(--color-gold);
  padding-top: var(--space-8);
  background: var(--color-black);
  color: var(--text-on-dark-muted);
  font-size: var(--size-small);
}
.site-footer a { text-decoration: none; transition: color var(--duration) var(--ease); }
.site-footer a:hover { color: var(--color-gold); }
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--footer-column-min-width), 1fr));
  gap: var(--space-7) var(--space-6);
  padding-bottom: var(--space-7);
}
/* The emblems, and under them the Patriarchate, the Archdiocese and the church's name. The
   block is as wide as its longest line, so the emblems stand over the middle of the words.
   site.js narrows a line that wraps to its longest line. */
.site-footer__identity { display: grid; width: fit-content; }
/* The emblems side by side at one height, in the middle of the block. Their row is a size
   container, so it does not count towards the block's width: the block is as wide as the
   name. Where the name is narrower than the emblems at full size, they get smaller to fit
   over it. */
.site-footer__logos {
  --logos-gap: var(--space-5);
  display: flex;
  justify-content: center;
  gap: var(--logos-gap);
  margin-bottom: var(--space-4);
  container-type: inline-size;
}
.site-footer__logos img {
  width: auto;
  height: min(var(--footer-logo-size),
              calc((100cqi - (var(--logos) - 1) * var(--logos-gap)) / var(--logos-ratio)));
}
/* The three lines are in Times New Roman, like the readings. Its lower-case letters are
   small, so each line is a step larger than it would be in the site's text font. A line
   that wraps breaks into lines of even length. */
.site-footer__identity > p {
  font-family: var(--font-reading);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
.site-footer__patriarchate { font-size: var(--size-small); }
.site-footer__archdiocese {
  margin-top: var(--space-1);
  color: var(--text-on-dark);
  font-size: var(--size-body);
}
/* a thin line between the Archdiocese and the church's name, centred under the emblems */
.site-footer__rule {
  --rule-share: 50%;
  justify-self: center;
  width: var(--rule-share);
  margin-block: var(--space-4);
  border-top: var(--hairline) solid var(--rule-on-dark);
}
.site-footer__name {
  margin-bottom: var(--space-3);
  color: var(--text-on-dark);
  font-size: var(--size-large);
}
.site-footer__heading {
  margin-bottom: var(--space-4);
  color: var(--color-gold);
  font-size: var(--size-label);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.site-footer__list { display: grid; gap: var(--space-3); }
.site-footer__list--icons li {
  display: flex;
  gap: var(--space-3);
  overflow-wrap: anywhere;
}
.site-footer__list--icons .icon { margin-top: var(--space-1); color: var(--color-gold); }
.site-footer__bottom {
  padding-block: var(--space-5);
  border-top: var(--hairline) solid var(--rule-on-dark);
  font-size: var(--size-label);
}

/* Site header */
.site-header {
  --focus-ring: var(--color-gold);
  position: sticky;
  top: 0;
  z-index: var(--layer-header);
  background: var(--color-black);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--header-height);
}
.site-header__tools {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
@media (max-width: 36rem) {
  .site-header__inner,
  .site-header__tools { gap: var(--space-2); }
}

/* Site nav */
.site-nav { display: flex; gap: var(--space-2); }
.site-nav__link {
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--hairline) solid transparent;
  color: var(--text-on-dark);
  font-size: var(--size-small);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-decoration: none;
  text-transform: uppercase;
  transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  border-bottom-color: var(--color-gold);
  color: var(--color-gold);
}
@media (max-width: 56rem) {
  .nav-toggle { display: grid; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: var(--space-3) var(--gutter) var(--space-5);
    background: var(--color-black);
  }
  .site-nav[data-open] { display: flex; }
  .site-nav__link { padding-block: var(--space-3); }
}

/* ── 5. Pages ──────────────────────────────────────────────── */

/* Home: hero + ribbon fill the first screen below the header */
.masthead {
  display: grid;
  grid-template-rows: minmax(var(--hero-min-height), 1fr) auto;
  min-height: var(--first-screen);
}

.hero {
  --focus-ring: var(--color-gold);
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  background: var(--color-black);
}
.hero__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, center);
}
.hero__panel {
  position: relative;
  padding-block: var(--space-6);
  background: var(--scrim);
  color: var(--text-on-dark);
  text-align: center;
}
.hero__text { display: grid; justify-items: center; gap: var(--space-3); }
.hero__title {
  font-family: var(--font-serif);
  font-size: var(--size-display);
  font-weight: var(--weight-regular);
  line-height: var(--leading-display);
  text-wrap: balance;
}
.hero__subtitle {
  color: var(--color-gold);
  font-family: var(--font-serif);
  font-size: var(--size-display-sub);
  line-height: var(--leading-tight);
}
.hero__description { max-width: var(--measure); }
/* Portrait screens: text laid over the video would hide most of it, so the text goes under
   the video. The video is at least its own shape (shown whole) and takes any height the
   first screen has to spare. */
@media (orientation: portrait) {
  .masthead { grid-template-rows: minmax(min-content, 1fr) auto; }
  .hero { grid-template-rows: 1fr auto; align-items: stretch; }
  .hero__media { position: static; height: auto; }
  /* the name is on a lighter black, to set it apart from the service times under it */
  .hero__panel { background: var(--surface-dark-raised); }
}
/* Phones held upright: the video is square, and what the first screen has left under it is
   cut into bands of one height: one for each service (--services, counted by the page) and
   --hero-name-bands for the church's name. The text sizes are worked out from the band
   height, between a smallest and a largest size, so the name and the services fill a tall
   phone and still fit a short one. The description is left out; the welcome section, next
   on the page, introduces the parish. */
@media (orientation: portrait) and (max-width: 36rem) {
  .masthead {
    /* the first screen, less the video and the rules between the service bands */
    --band: calc((var(--first-screen) - 100vw / (var(--ratio-hero-phone))
                  - (var(--services) - 1) * var(--hairline))
                 / (var(--services) + var(--hero-name-bands)));
    --name-height: calc(var(--band) * var(--hero-name-bands));
    --name-gap: var(--space-1);
    --name-padding: var(--space-2);
    --band-gap: var(--space-1);
    --band-padding: var(--space-1);
    --size-subtitle: var(--size-body);
    /* a band holds its padding, the service's name, a gap and the time */
    --size-ribbon: clamp(
      var(--size-small),
      calc((var(--band) - 2 * var(--band-padding) - var(--band-gap)
            - var(--size-label) * var(--leading-tight)) / var(--leading-ribbon)),
      var(--size-lead));
  }
  .hero__media { aspect-ratio: var(--ratio-hero-phone); }
  .hero__panel {
    display: grid;
    align-content: center;
    min-height: var(--name-height);
    padding-block: var(--name-padding);
  }
  .hero__text { gap: var(--name-gap); }
  /* the name's height holds its padding, the title, a gap and one line of subtitle */
  .hero__title {
    font-size: clamp(
      var(--size-large),
      calc((var(--name-height) - 2 * var(--name-padding) - var(--name-gap)
            - var(--size-subtitle) * var(--leading-tight)) / var(--leading-display)),
      var(--size-display));
  }
  .hero__subtitle { font-size: var(--size-subtitle); }
  .hero__description { display: none; }
  .ribbon-list__item {
    align-content: center;
    gap: var(--band-gap);
    min-height: var(--band);
    padding-block: var(--band-padding);
  }
}

/* Home: welcome */
.welcome {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(var(--space-6), 6vw, var(--space-8));
  align-items: center;
}
/* the pictures side by side (--pictures of them), and the link to the map centred under them */
.welcome__pictures {
  display: grid;
  grid-template-columns: repeat(var(--pictures), 1fr);
  gap: var(--space-5);
}
.welcome__figure {
  position: relative;
  grid-row: 1;
  margin: 0 var(--frame-offset) var(--frame-offset) 0;
}
.welcome__action { grid-column: 1 / -1; margin-top: 0; }
/* offset gold frame behind the picture */
.welcome__figure::before {
  content: "";
  position: absolute;
  inset: var(--frame-offset) calc(-1 * var(--frame-offset)) calc(-1 * var(--frame-offset)) var(--frame-offset);
  border: var(--hairline) solid var(--color-gold);
}
.welcome__figure img {
  position: relative;
  width: 100%;
  aspect-ratio: var(--ratio-figure);
  object-fit: cover;
  object-position: var(--focus, center);
}

/* Contact: two equal columns, and the map */
.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(var(--space-6), 6vw, var(--space-8));
  align-items: start;
}
/* The map is blended with the picture behind the section (multiply): its pale ground lets
   the picture show through, its roads, names and pin stay as they are. */
.map {
  width: 100%;
  height: var(--map-height);
  border: var(--hairline) solid var(--rule);
  mix-blend-mode: multiply;
}

@media (max-width: 56rem) {
  .welcome, .columns { grid-template-columns: 1fr; }
}
/* Phones: the pictures one under the other, with the link to the map between them */
@media (max-width: 36rem) {
  .welcome__pictures { grid-template-columns: 1fr; }
  .welcome__figure { grid-row: auto; }
}

@media print {
  .site-header, .hero__media, .page-head__picture, .skip-link { display: none; }
}
