/*
 * Traditionen und Bräuche der Siebenbürger Sachsen
 *
 * Built on the corporate design of evang.ro (Evangelische Kirche A.B. in Rumänien): the square
 * mosaic of the church's logo, its coral and peach tones, cream side panels, Verdana for headings
 * and navigation. Long texts are set in Georgia for reading. Square corners throughout, no shadows
 * or gradients. Light only, like evang.ro.
 *
 * Contrast: the evang.ro coral (#ff6a4e) is too light for text (2.8:1), so it is used for squares
 * and rules only; headings use --heading (4.7:1), links and small text --link (6.1:1 on white).
 */

:root {
  --white: #ffffff;
  --cream: #faede0;
  --cream-light: #fdf6f0;
  --line: #ecd8c8;
  --ink: #222222;
  --muted: #5c5048;

  /* The logo's squares and spire */
  --square-red: #f16237;
  --square-coral: #ff6a4e;
  --square-peach: #fab69e;
  --square-rose: #fbcac6;
  --spire: #f47e48;

  --heading: #d63a1c;
  --link: #b5321a;
  --focus: #1d5fbf;

  --font-ui: Verdana, Geneva, "DejaVu Sans", sans-serif;
  --font-text: Georgia, "Times New Roman", "DejaVu Serif", serif;

  --gutter: 16px;
  --page: 1100px;
  --measure: 66ch;

  color-scheme: light;
}

@media (min-width: 720px) {
  :root { --gutter: 28px; }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 400 0.9375rem/1.6 var(--font-ui);
  overflow-wrap: break-word;
}

h1, h2, h3, h4 {
  margin: 0 0 0.6em;
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1.25;
}

h1 { color: var(--heading); font-size: clamp(1.45rem, 1.2rem + 1.2vw, 2rem); }
h2 { color: var(--heading); font-size: 1.2rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 1em; }

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--heading); }

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

img, video { display: block; max-width: 100%; height: auto; }

.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  z-index: 100;
  padding: 8px 14px;
  background: var(--heading);
  color: var(--white);
}

.skip-link:focus { top: 8px; }

main { display: block; outline: none; }

main > * {
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

/* The three squares that evang.ro puts after its box headings */
.squares::after,
.section > h2::after,
.section__head > h2::after,
.aside-box > h2::after,
.media-section > h2::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 26px 0 10px;
  vertical-align: 0.05em;
  background: var(--square-rose);
  box-shadow: 12px 0 0 var(--square-peach), 24px 0 0 var(--square-red);
}

/* ---------- Header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--white); }

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
  padding: 12px 0 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { color: var(--ink); }
.brand__logo { width: 40px; height: 45px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__church { color: var(--muted); font-size: 0.72rem; }
.brand__title { font-size: 1.02rem; font-weight: 700; }

.site-nav {
  display: flex;
  order: 3;
  width: calc(100% + 16px);
  margin: 0 -8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover { color: var(--heading); }
.site-nav a.is-active { border-bottom-color: var(--square-red); color: var(--heading); font-weight: 700; }
.site-nav__search { margin-left: auto; }

@media (max-width: 479px) {
  .site-nav__search-label { display: none; }
}

.header-search { display: none; }

@media (min-width: 960px) {
  .site-header__inner { flex-wrap: nowrap; padding: 14px 0; }
  .site-nav { order: 0; width: auto; margin: 0; overflow: visible; }
  .site-nav a { min-height: 40px; }
  .site-nav__search { display: none !important; }

  .header-search { display: flex; width: 210px; border: 1px solid var(--line); }
  .header-search:focus-within { border-color: var(--square-red); }

  .header-search input {
    flex: 1;
    min-width: 0;
    padding: 7px 8px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
  }

  .header-search input:focus { outline: none; }

  .header-search button {
    display: grid;
    place-items: center;
    width: 36px;
    border: 0;
    background: var(--cream);
    color: var(--link);
    cursor: pointer;
  }
}

/* ---------- Photo strip (home): like the carousel of the 2010 site ---------- */

main > .photo-strip { width: 100%; max-width: none; }

.photo-strip ul {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(118px, 1fr);
  gap: 3px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.photo-strip li { scroll-snap-align: start; }
.photo-strip a { display: block; }
.photo-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-strip a:hover img { opacity: 0.85; }

/* ---------- Page heads, sections ---------- */

.page-head { padding: 24px 0 4px; }
.page-head__meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: -4px 0 8px; font-size: 0.88rem; }

.page-head__meta a::before,
.place-mark::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  vertical-align: 0.06em;
  background: var(--square-red);
}

.lead { max-width: var(--measure); color: var(--muted); font-family: var(--font-text); font-size: 1.1rem; }

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.78rem;
}

.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.breadcrumbs a { color: var(--muted); }

.section { padding: 32px 0 0; }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 16px;
}

.section__head h2 { margin-bottom: 0.4em; }

.more { font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.more:hover { text-decoration: underline; }

.jump-links { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.88rem; }
.empty { color: var(--muted); font-style: italic; }

/* ---------- Search ---------- */

.big-search { display: flex; max-width: 560px; margin: 20px 0 8px; border: 2px solid var(--square-peach); }
.big-search:focus-within { border-color: var(--square-red); }

.big-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 0;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.big-search input:focus { outline: none; }

.big-search button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: var(--heading);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.big-search button:hover { background: var(--link); }

@media (max-width: 420px) {
  .big-search button span { display: none; }
}

.search-summary { margin-top: 16px; color: var(--muted); }

/* ---------- Registers (lists of traditions and places) ---------- */

.register {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  columns: 2 13em;
  column-gap: 32px;
}

.register li { break-inside: avoid; }

.register a {
  display: inline-block;
  padding: 5px 0;
  color: var(--ink);
  text-decoration: none;
}

.register a:hover { color: var(--heading); text-decoration: underline; }
.register small { color: var(--muted); font-size: 0.8rem; }

.aside-box .register { columns: auto; }

.inline-list { margin: 8px 0 0; padding: 0; list-style: none; line-height: 2.1; }
.inline-list li { display: inline; }
.inline-list li + li::before { content: " · "; color: var(--square-red); }

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 24px 18px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 519px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
}

.card { display: block; color: var(--ink); text-decoration: none; }
.card__image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--cream); }
.card--video .card__image { aspect-ratio: 16 / 9; }

/* A tradition without a photo: a cream tile with the logo's squares */
.card__placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  background: var(--cream);
}

.card__placeholder::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: -48px;
  background: var(--square-rose);
  box-shadow: 16px 0 0 var(--square-peach), 32px 0 0 var(--square-red), 16px -16px 0 var(--square-peach), 16px 16px 0 var(--square-rose);
}

.card__body { padding: 8px 0 0; }
.card__title { margin: 0; font-size: 0.95rem; line-height: 1.35; hyphens: auto; overflow-wrap: anywhere; }
.card__title .icon { color: var(--square-red); }
.card__context { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
.card:hover .card__title { color: var(--heading); text-decoration: underline; }
.card:hover .card__image { opacity: 0.9; }

/* ---------- Article layout with the cream side panel ---------- */

.layout { display: grid; gap: 32px; padding: 8px 0 0; }

@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
}

.prose { max-width: var(--measure); font-family: var(--font-text); font-size: 1.075rem; line-height: 1.65; }
.prose h2, .prose h3, .prose h4, .prose h5 { margin: 1.5em 0 0.5em; font-size: 1.05rem; }
.prose h2 { color: var(--heading); }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin: 0.25em 0; }
.prose img { margin: 1.2em 0; }
.prose figure { margin: 1.5em 0; }
.prose figure img { margin: 0; }
.prose figcaption { margin-top: 6px; color: var(--muted); font-family: var(--font-ui); font-size: 0.8rem; line-height: 1.5; }
.prose blockquote { margin: 1.2em 0; padding-left: 1em; border-left: 3px solid var(--square-peach); color: var(--muted); }

.signature { color: var(--muted); font-style: italic; text-align: right; }

.aside-box { padding: 18px 20px; background: var(--cream); }
.aside-box + .aside-box { margin-top: 12px; }
.aside-box > h2 { font-size: 0.95rem; }
.aside-box address { margin-bottom: 1em; font-style: normal; }
.small { color: var(--muted); font-size: 0.82rem; }

.link-list { margin: 0; padding: 0; list-style: none; font-size: 0.88rem; }

.link-list a {
  display: block;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.link-list li:last-child a { border-bottom: 0; }
.link-list a:hover, .link-list a:hover strong { color: var(--heading); }
.link-list span { display: block; color: var(--muted); font-size: 0.8rem; }
.link-list--wide { max-width: 560px; }

.notice {
  max-width: var(--measure);
  padding: 14px 18px;
  border-left: 4px solid var(--square-red);
  background: var(--cream-light);
  font-family: var(--font-text);
}

.notice p { margin: 0; }

/* ---------- Media ---------- */

.media-section { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }

.video-list { display: grid; gap: 24px; }
.video { margin: 0; }
.video video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.video figcaption { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 6px; font-size: 0.85rem; }
.video figcaption span { color: var(--muted); }
.video__duration { margin-left: auto; font-variant-numeric: tabular-nums; }

.gallery + .gallery { margin-top: 24px; }
.gallery__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: 0.9rem; }
.gallery__count { color: var(--muted); font-weight: 400; }

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(31%, 150px), 1fr));
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery__item { display: block; background: var(--cream); }
.gallery__item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery__item:hover img { opacity: 0.85; }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(20 16 14 / 96%);
  color: #f4ece4;
}

.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgb(0 0 0 / 60%); }

.lightbox__bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; font-size: 0.85rem; }

.lightbox button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  background: rgb(255 255 255 / 12%);
  color: inherit;
  cursor: pointer;
}

.lightbox button:hover { background: var(--heading); }

.lightbox__stage { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; margin: 0; padding: 0 8px; }
.lightbox__stage img { width: auto; max-height: calc(100% - 4em); object-fit: contain; }
.lightbox__stage figcaption { max-width: 70ch; padding: 10px 8px 0; color: #ddd3c8; font-size: 0.88rem; text-align: center; }

.lightbox__nav { position: absolute; top: 50%; translate: 0 -50%; }
.lightbox__nav--prev { left: 8px; }
.lightbox__nav--next { right: 8px; }

.lightbox__thumbs { display: flex; gap: 4px; padding: 8px; overflow-x: auto; scrollbar-width: thin; }
.lightbox .lightbox__thumbs button { flex: none; width: 60px; height: 45px; padding: 0; overflow: hidden; opacity: 0.5; }
.lightbox .lightbox__thumbs button[aria-current="true"] { opacity: 1; outline: 2px solid var(--square-peach); }
.lightbox__thumbs img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 599px) {
  .lightbox .lightbox__nav { display: none; }
}

/* ---------- Map ---------- */

/* No width or inline margin here: in main the page width applies (main > *), in the aside the box's */
.map { height: clamp(300px, 55vw, 500px); margin-block: 8px 16px; background: var(--cream); }
.aside-box .map { height: 220px; margin: 0 0 12px; }
.map-popup { display: flex; flex-direction: column; color: var(--ink); font: 400 0.85rem/1.4 var(--font-ui); text-decoration: none; }
.map-popup strong { color: var(--heading); }
.map-popup span { color: var(--muted); }

/* ---------- Places ---------- */

.place-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 0 32px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}

.place {
  display: block;
  height: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.place__name { display: block; font-weight: 700; }
.place__traditions { display: block; color: var(--muted); font-size: 0.82rem; }
.place__count { color: var(--link); font-size: 0.8rem; }
.place:hover .place__name { color: var(--heading); text-decoration: underline; }

/* ---------- Footer ---------- */

.site-footer { margin-top: 56px; padding: 32px 0 20px; background: var(--cream); font-size: 0.85rem; }

.site-footer__inner {
  display: grid;
  gap: 24px;
  width: min(100% - 2 * var(--gutter), var(--page));
  margin-inline: auto;
}

@media (min-width: 800px) {
  .site-footer__inner { grid-template-columns: 2fr 1fr 1fr; }
}

.site-footer__church { display: flex; gap: 16px; align-items: flex-start; }
/* The logo's palest squares disappear on cream, so it sits on a white tile */
.site-footer__logo { flex: none; padding: 8px 9px; background: var(--white); }
.site-footer__logo img { width: 44px; height: 50px; }
.site-footer h2 { margin-bottom: 0.5em; color: var(--ink); font-size: 0.85rem; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-footer li a { display: inline-block; padding: 4px 0; }
.site-footer__meta { grid-column: 1 / -1; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
.site-footer__meta a { color: var(--muted); }

/* ---------- Print ---------- */

@media print {
  .site-header nav, .header-search, .site-footer, .layout__aside, .media-section, .map, .big-search, .photo-strip { display: none !important; }
  a { color: inherit; }
}

/* ---------- Home: intro, the registers in the cream panel, then films, places, the project ---------- */

.home { display: grid; gap: 24px; padding-top: 24px; }

@media (min-width: 900px) {
  .home {
    grid-template-areas: "intro aside" "main aside";
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    column-gap: 48px;
  }

  .home__intro { grid-area: intro; }
  .home__registers { grid-area: aside; }
  .home__main { grid-area: main; }
}

.home__intro h1 { max-width: 24em; }
.home__main > .section:first-child { padding-top: 8px; }
