/* spiegellicht.de — mobile-first, everything self-hosted (see PLAN.md).

   Direction: "Spiegel-Licht" — mirror light. The home page shows each photo
   over its own still-water reflection, with the wordmark floating on the
   waterline. Everything else stays quiet so the photographs carry the page.

   Tokens
     --night   #16181b  page (cool graphite, neutral enough not to tint photos)
     --slate   #1f2226  raised surfaces, table labels
     --rule    #31353b  hairlines
     --silver  #d3d6da  body text
     --fog     #8c929a  secondary text, metadata
     --brass   #c4a26a  "Abendlicht": focus, current page, course dates — used sparingly
   Type
     Marcellus      display — Trajan-like capitals, echoes the existing CKF logo
     Alegreya Sans  body — humanist, calligraphic warmth, good German umlauts
     Alegreya Sans  small caps + tabular figures for photo metadata
*/

@font-face {
  font-family: "Marcellus";
  src: url("../fonts/marcellus-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Marcellus";
  src: url("../fonts/marcellus-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya Sans";
  src: url("../fonts/alegreya-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #16181b;
  --slate: #1f2226;
  --rule: #31353b;
  --silver: #d3d6da;
  --fog: #8c929a;
  --brass: #c4a26a;

  --display: "Marcellus", "Trajan Pro", Georgia, serif;
  --body: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;

  --gutter: 16px;
  --measure: 68ch;
  --wide: 1240px;
}
@media (min-width: 720px) { :root { --gutter: 32px; } }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--night);
  color: var(--silver);
  font-family: var(--body);
  font-size: 1.125rem;          /* Alegreya Sans runs small — 18px reads like 16px */
  line-height: 1.6;
  font-kerning: normal;
}

img { max-width: 100%; height: auto; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
a:hover { color: #fff; text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--slate); color: #fff; padding: 8px 12px;
}
.skip-link:focus { left: 8px; top: 8px; }

/* shared metadata voice: small caps + tabular figures, like a lens barrel */
.meta, .eyebrow, .course__date {
  font-variant-caps: all-small-caps;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.08em;
  color: var(--fog);
  font-size: 1.05rem;
  line-height: 1.4;
}

/* ---------- header ---------- */

.site-head { border-bottom: 1px solid var(--rule); }

.site-head__row {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}

.brand { display: block; line-height: 0; }
.brand img { width: 136px; height: auto; }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 4px;
  background: none; border: 0; color: var(--silver);
  font: 500 1rem var(--body); letter-spacing: 0.04em; cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block; width: 18px; height: 1px; 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: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { top: 0; transform: rotate(-45deg); }

.site-nav { display: none; flex-basis: 100%; }
body.nav-open .site-nav { display: block; }

.site-nav ul {
  list-style: none; margin: 0; padding: 4px 0 12px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px;
}
.site-nav a {
  display: block; padding: 10px 0;
  text-decoration: none; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule);
}
.site-nav .is-marked a { color: var(--brass); }      /* "fotokurse" stays highlighted, as on the live site */
.site-nav a[aria-current="page"] { color: #fff; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; flex-basis: auto; }
  .site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 0; }
  .site-nav a { padding: 6px 0 4px; border-bottom: 1px solid transparent; font-size: 1.05rem; }
  .site-nav a[aria-current="page"] { border-bottom-color: currentColor; }
  .brand img { width: 170px; }
}

/* ---------- page head (all pages except home) ---------- */

main { display: block; }

.page-head,
.prose,
.albums,
.gallery,
.home-body {
  max-width: var(--wide);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.page-head { padding-top: clamp(28px, 6vw, 64px); padding-bottom: 20px; }
.page-head__title {
  margin: 0;
  font: 400 clamp(2rem, 1.2rem + 3.6vw, 3.6rem)/1.08 var(--display);
  letter-spacing: 0.04em;
  color: #fff;
  max-width: 22ch;
  text-wrap: balance;
}
.eyebrow { margin: 0 0 8px; }
.eyebrow a { text-decoration: none; }
.eyebrow a::after { content: " /"; color: var(--rule); }
.page-head .meta { margin: 12px 0 0; }
.page-head__lead { margin: 10px 0 0; max-width: var(--measure); color: var(--fog); }

/* ---------- prose ---------- */

.prose > * { max-width: var(--measure); }
.prose { padding-bottom: 8px; }
.prose .lead { font-size: 1.3rem; color: #fff; margin-top: 0; }
.prose h2 {
  margin: 2.2em 0 0.5em;
  font: 500 1.05rem/1.3 var(--body);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  font-size: 1.3rem;
  color: #fff;
}
.prose h2:first-child { margin-top: 0.4em; }
.prose p { margin: 0.8em 0; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: 0.4em 0; }
.prose li::marker { color: var(--fog); }
.prose strong { font-weight: 500; color: #fff; }
.prose figure { margin: 1.4em 0; }
.prose figure img { display: block; }
.prose figcaption { color: var(--fog); font-size: 1rem; margin-top: 6px; }
.prose blockquote {
  margin: 1.4em 0; padding: 2px 0 2px 18px;
  border-left: 1px solid var(--brass); color: var(--silver); font-style: italic;
}

/* course facts: label above value on phones, two columns from tablet up */
table.data { width: 100%; max-width: var(--measure); border-collapse: collapse; margin: 1.4em 0 2em; }
table.data tr { border-top: 1px solid var(--rule); }
table.data tr:last-child { border-bottom: 1px solid var(--rule); }
table.data th, table.data td { display: block; text-align: left; vertical-align: top; padding: 0; }
table.data th {
  padding-top: 12px;
  font-weight: 400; font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--fog);
}
table.data td { padding-bottom: 12px; }
@media (min-width: 640px) {
  table.data th, table.data td { display: table-cell; padding: 12px 0; }
  table.data th { width: 12em; padding-right: 20px; }
}

/* aktuelles: dated changelog */
table.news { width: 100%; max-width: var(--measure); border-collapse: collapse; margin: 0.6em 0 2em; }
table.news td { display: block; padding: 0; vertical-align: top; }
table.news tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule); }
table.news td:first-child {
  font-variant-caps: all-small-caps; font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em; color: var(--fog);
}
@media (min-width: 640px) {
  table.news tr { display: table-row; padding: 0; }
  table.news td { display: table-cell; padding: 10px 0; }
  table.news td:first-child { width: 11em; white-space: nowrap; padding-right: 20px; }
}

/* download: protected client areas */
.client-list {
  list-style: none; padding: 0; margin: 1em 0;
  display: grid; gap: 0 24px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.prose .client-list { max-width: none; }
.client-list li { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.client-list li::before {           /* a small lock glyph: the areas need a password */
  content: ""; display: inline-block; width: 9px; height: 7px; margin-right: 10px;
  border: 1px solid var(--fog); border-radius: 1px; vertical-align: 0.05em;
  box-shadow: 0 -4px 0 -1px var(--night), 0 -4px 0 0 var(--fog);
}

/* ---------- home: the mirror ---------- */

.hero {
  /* vh fallback first: in min(), an unknown unit (svh on Firefox < 121) would
     invalidate the whole expression and break --h/--deep (mirror disappears).
     Browsers with dynamic viewport units upgrade to svh via @supports, so the
     mobile URL bar can't cover the waterline there. */
  --h: min(62vh, 46vw + 120px, 760px);    /* height of the photo above the waterline */
  --deep: calc(var(--h) * 0.42);           /* depth of the reflection band */
  position: relative;
  overflow: hidden;
  background: var(--night);
}
@supports (height: 1svh) { .hero { --h: min(62svh, 46vw + 120px, 760px); } }
@media (max-width: 719px) {
  .hero { --h: min(56vh, 92vw); --deep: calc(var(--h) * 0.5); }
  @supports (height: 1svh) { .hero { --h: min(56svh, 92vw); } }
}

.hero__stage { position: relative; height: calc(var(--h) + var(--deep)); }

.slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0; transition: opacity 1.4s ease;
}
.slide.is-active { opacity: 1; }

.slide__photo { position: absolute; left: 0; right: 0; top: 0; height: var(--h); padding: 24px var(--gutter) 0; }
.slide__photo img {
  width: 100%; height: 100%;
  object-fit: contain; object-position: 50% 100%;   /* every photo stands on the waterline */
  display: block;
}

/* The reflection: the same image (already cached), flipped about the waterline,
   darkened, softened and fading out with depth. */
.slide__mirror {
  position: absolute; left: 0; right: 0; top: var(--h); height: var(--deep);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), rgba(0,0,0,.3) 40%, transparent 95%);
          mask-image: linear-gradient(to bottom, rgba(0,0,0,.7), rgba(0,0,0,.3) 40%, transparent 95%);
}
.slide__mirror img {
  position: absolute; left: 0; top: 0;
  width: 100%; height: calc(var(--h) - 24px);
  padding: 0 var(--gutter);
  object-fit: contain; object-position: 50% 100%;
  transform: scaleY(-1);           /* flips in place: the photo's foot now touches the waterline */
  filter: blur(1px) brightness(.85) saturate(.9);
}

/* the waterline + wordmark floating on it */
.hero__water {
  position: absolute; left: 0; right: 0; top: var(--h);
  padding: clamp(18px, 4vw, 44px) var(--gutter) 0;
  text-align: center;
  pointer-events: none;
}
.hero__water::before {             /* the waterline: a thin highlight, brightest under the photo */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(211,214,218,.45) 30%, rgba(211,214,218,.45) 70%, transparent);
}
.wordmark {
  margin: 0;
  font: 400 clamp(1.9rem, 1rem + 4.2vw, 4.4rem)/1 var(--display);
  letter-spacing: 0.2em;
  margin-right: -0.2em;           /* optically re-centre the tracked caps */
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 18px rgba(22,24,27,.9);
}
.hero__by {
  margin: 10px 0 0;
  font-style: italic; color: var(--silver);
  text-shadow: 0 1px 10px rgba(22,24,27,.9);
}
.hero__caption { margin: 4px 0 0; min-height: 1.4em; }

/* ---------- home body ---------- */

.home-body { padding-top: 8px; }
.home-block { padding-top: clamp(32px, 6vw, 72px); }
.home-block__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px;
  border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 20px;
}
.section-title {
  margin: 0;
  font: 400 clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem)/1.15 var(--display);
  letter-spacing: 0.04em; color: #fff;
}
.more { color: var(--fog); text-decoration: none; }
.more::after { content: " →"; }
.more:hover { color: #fff; }

.home-body .albums { padding: 0; }

.courses { list-style: none; margin: 0; padding: 0; display: grid; gap: 0 32px; }
@media (min-width: 720px) { .courses { grid-template-columns: 1fr 1fr; } }
.course { border-bottom: 1px solid var(--rule); }
.course__link { display: block; padding: 14px 0 18px; text-decoration: none; }
.course__date { display: block; color: var(--brass); }
.course__title { display: block; font-size: 1.3rem; line-height: 1.3; color: #fff; margin: 2px 0 4px; }
.course__link:hover .course__title { text-decoration: underline; text-decoration-color: var(--fog); }

/* ---------- gallery overview ---------- */

.albums {
  list-style: none; margin-top: 8px; margin-bottom: 0;
  display: grid; gap: 28px 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}
.album__link { display: block; text-decoration: none; }
.album__frame { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--slate); }
.album__frame img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .6s;
  filter: brightness(.92);
}
.album__link:hover .album__frame img,
.album__link:focus-visible .album__frame img { transform: scale(1.03); filter: none; }
.album__title {
  display: block; margin-top: 12px;
  font: 400 1.45rem/1.2 var(--display); letter-spacing: 0.05em; color: #fff;
}
.album .meta { display: block; margin-top: 2px; }

/* ---------- gallery: justified rows, each photo keeps its own shape ---------- */

.gallery {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 12px;
  --row: 150px;
}
@media (min-width: 720px) { .gallery { --row: 230px; gap: 6px; } }
.gallery__item {
  flex: var(--ar) 1 calc(var(--ar) * var(--row));
  aspect-ratio: var(--ar);
  display: block; overflow: hidden; background: var(--slate);
}
.gallery__item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .3s; filter: brightness(.94); }
.gallery__item:hover img, .gallery__item:focus-visible img { filter: brightness(1.06); }
.gallery__item:focus-visible { outline-offset: 1px; }
.gallery__filler { flex: 10 1 0; height: 0; }   /* keeps the last row from stretching */

/* PhotoSwipe caption (registered in js/lightbox.js) */
.pswp__caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px var(--gutter) 18px; text-align: center;
  font: 1.05rem/1.4 var(--body);
  font-variant-caps: all-small-caps; letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
  color: var(--silver);
  background: linear-gradient(to top, rgba(22,24,27,.75), transparent);
  pointer-events: none;
}
.pswp { --pswp-bg: #101214; }

/* ---------- footer ---------- */

.site-foot {
  margin-top: clamp(48px, 8vw, 96px);
  padding: 28px var(--gutter) 36px;
  text-align: center;
  border-top: 1px solid var(--rule);
}
.slogan { margin: 0 0 6px; font-style: italic; color: var(--silver); }
.copyright { margin: 0; color: var(--fog); font-size: 0.95rem; }

/* ---------- motion ---------- */

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