/* Zone Five – static rebuild of the Squarespace site (palette, fonts and layout taken from its theme). */

:root {
  --white: hsl(0 0% 100%);
  --black: hsl(0 0% 0%);
  --accent: hsl(0 0% 85.1%);
  --light-accent: hsl(0 0% 96.08%);
  --dark-accent: hsl(0 0% 47.45%);

  /* Roles. Light values are the original Squarespace palette; the dark block below follows the
     visitor's system setting (values from the Zone Five design system proposal). */
  --bg: var(--white);
  --fg: var(--black);
  --muted: var(--dark-accent);
  --line: var(--accent);
  --surface-muted: var(--light-accent);   /* title sections */
  --surface-strong: var(--dark-accent);   /* grey content sections */
  --on-strong: var(--white);              /* text on --surface-strong, black sections and photos */

  color-scheme: light dark;

  --font-heading: "Manrope", system-ui, sans-serif;
  --font-body: "Poppins", system-ui, sans-serif;

  --page-max: 1700px;
  --gutter: clamp(16px, 4vw, 6vw);
  --header-h: 72px;
}

/* Dark values apply when the system asks for them, unless the visitor picked light with the
   footer switch (data-theme="light"), and always when they picked dark (data-theme="dark"). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: hsl(0 0% 6.7%);              /* #111111 */
    --fg: hsl(0 0% 95%);               /* #f2f2f2, 16.9:1 on --bg */
    --muted: hsl(0 0% 64%);            /* #a3a3a3, 7.5:1 on --bg */
    --line: hsl(0 0% 22.7%);           /* #3a3a3a */
    --surface-muted: hsl(0 0% 11%);    /* #1c1c1c */
    --surface-strong: hsl(0 0% 16.9%); /* #2b2b2b */
    --on-strong: hsl(0 0% 95%);        /* #f2f2f2, 12.7:1 on --surface-strong */
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: hsl(0 0% 6.7%);              /* #111111 */
    --fg: hsl(0 0% 95%);               /* #f2f2f2, 16.9:1 on --bg */
    --muted: hsl(0 0% 64%);            /* #a3a3a3, 7.5:1 on --bg */
    --line: hsl(0 0% 22.7%);           /* #3a3a3a */
    --surface-muted: hsl(0 0% 11%);    /* #1c1c1c */
    --surface-strong: hsl(0 0% 16.9%); /* #2b2b2b */
    --on-strong: hsl(0 0% 95%);        /* #f2f2f2, 12.7:1 on --surface-strong */
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

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

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

/* Fluid type, roughly following Squarespace's scale (h1 4rem, h2 2.8rem, h3 2.2rem). */
h1 { font-size: clamp(2.25rem, 1.4rem + 3.2vw, 4rem); }
h2 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.8rem); }
h3 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); }

p { margin: 0 0 1em; }

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

:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  color: var(--fg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 24px;
}

.site-title {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 1.5rem;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(16px, 2.5vw, 40px);
}

.site-nav a {
  text-decoration: none;
  font-size: 1rem;
  padding-block: 4px;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { border-bottom-color: currentColor; }

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 10px;
  margin-right: -10px;
  color: inherit;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 28px;
  height: 1px;
  background: currentColor;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.menu-toggle span + span { margin-top: 8px; }

@media (max-width: 767px) {
  :root { --header-h: 64px; }

  .site-title { font-size: 1.3rem; }

  /* Without JS the links simply stay visible in the header. */
  .js .menu-toggle { display: block; position: relative; z-index: 2; }
  .js .site-title { position: relative; z-index: 2; }

  .js .site-nav {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s;
  }
  .js .site-nav ul { flex-direction: column; align-items: center; gap: 24px; }
  .js .site-nav a { font-family: var(--font-heading); font-size: 2rem; letter-spacing: -0.02em; }

  .js.menu-open .site-nav { opacity: 1; visibility: visible; }
  .js.menu-open body { overflow: hidden; }
  .js.menu-open .menu-toggle span:first-child { transform: translateY(4.5px) rotate(45deg); }
  .js.menu-open .menu-toggle span:last-child { transform: translateY(-4.5px) rotate(-45deg); }

  html:not(.js) .site-nav ul { gap: 14px; font-size: 0.9rem; }
}

/* ---------- Sections and themes ---------- */

.section { position: relative; padding-block: clamp(48px, 8vw, 120px); }

.theme-light { background: var(--surface-muted);  color: var(--fg); }
.theme-dark  { background: var(--surface-strong); color: var(--on-strong); }
.theme-black { background: var(--black);          color: var(--on-strong); }

.section-small  { min-height: 33vh; }
.section-medium { min-height: 66vh; }
.section-large  { min-height: 100vh; }

.section-small, .section-medium, .section-large { display: flex; align-items: center; }
.section > .wrap { position: relative; z-index: 1; }

/* Full-bleed background image with a dark overlay, like Squarespace's section backgrounds. */
.section-bg { position: absolute; inset: 0; overflow: hidden; }
.section-bg img { width: 100%; height: 100%; object-fit: cover; }
.section-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--black);
  opacity: var(--overlay, 0.15);
}

/* Parallax (as on the Squarespace original, intensity 30): the background photo trails the page
   by 30% of the scroll distance. Meant for a section at the top of the page: the photo starts 30%
   above its section and, after one screen of scrolling, has caught up with its top edge.
   Driven by the page's CSS scroll timeline where supported; site.js does the same elsewhere. */
@media (prefers-reduced-motion: no-preference) {
  .section-bg.parallax img { position: absolute; top: -30%; left: 0; height: 130%; }
}
@keyframes parallax-trail {
  from { translate: 0 0; }
  to { translate: 0 30svh; }
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-bg.parallax img {
      animation: parallax-trail linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100svh;
    }
  }
}

/* ---------- Home ---------- */

.hero { min-height: calc(100svh - var(--header-h)); }

.quote {
  margin: 0 0 0 auto;
  max-width: 34ch;
  text-align: right;
}
.quote p { margin: 0; font-size: clamp(1rem, 0.9rem + 0.4vw, 1.2rem); }

@media (max-width: 767px) {
  .quote { margin: 0; text-align: left; }
}

/* ---------- About ---------- */

.about-hero h1 { margin: 0; }

.about-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
.about-body .portrait { width: min(240px, 60%); }

@media (min-width: 768px) {
  .about-body {
    grid-template-columns: minmax(0, 12fr) minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
  .about-body .text { grid-column: 1; }
  .about-body .portrait { grid-column: 2; width: 100%; }
}

/* ---------- Simple text pages (Kontakt, Impressum, Datenschutz) ---------- */

.page-title h1 { margin: 0; }

.text-block { max-width: 46rem; }

.text-block a { text-underline-offset: 3px; }

/* ---------- Galerie ---------- */

.gallery-head { padding-block: clamp(40px, 7vw, 104px) clamp(24px, 3vw, 40px); }
.gallery-head h1 { margin: 0.1em 0 0; }
.gallery-meta { margin: 0.4em 0 0; color: var(--muted); font-size: 0.9rem; letter-spacing: 0.02em; }
.gallery-body { padding-bottom: clamp(48px, 8vw, 120px); }

.back-link { font-size: 0.9rem; color: var(--muted); text-decoration: none; }
.back-link::before { content: "← "; }
.back-link:hover { color: var(--fg); }

/* Overview: a mosaic. The first album is featured; the rest fill the cells around it. */
.album-mosaic {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(8px, 1vw, 16px);
}
@media (min-width: 600px) {
  .album-mosaic { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .album-mosaic {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(220px, 20vw, 340px);
    grid-auto-flow: dense;
  }
  .album-mosaic .album-tile { aspect-ratio: auto; } /* height comes from the grid rows */
  .album-tile:nth-child(1) { grid-column: span 2; grid-row: span 2; }
  .album-tile:nth-child(2) { grid-column: span 2; }
}

.album-tile { position: relative; overflow: hidden; background: var(--line); aspect-ratio: 4 / 3; }
.album-tile a { position: absolute; inset: 0; display: block; color: hsl(0 0% 100%); text-decoration: none; }
.album-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.6s ease;
}
/* A soft shade at the bottom keeps the white title readable on bright photos. */
.album-tile a::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(to top, hsl(0 0% 0% / 0.65), hsl(0 0% 0% / 0));
  pointer-events: none;
}
.album-tile-text {
  position: absolute;
  left: clamp(16px, 2vw, 28px);
  right: clamp(16px, 2vw, 28px);
  bottom: clamp(14px, 1.6vw, 24px);
  z-index: 1;
  display: grid;
  gap: 2px;
}
.album-tile-title {
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-size: clamp(1.4rem, 1rem + 1.4vw, 2.2rem);
}
.album-tile:nth-child(1) .album-tile-title { font-size: clamp(1.8rem, 1.1rem + 2.6vw, 3.4rem); }
.album-tile-count { font-size: 0.85rem; opacity: 0.85; }
.album-tile a:hover img, .album-tile a:focus-visible img { transform: scale(1.04); filter: brightness(1.06); }
.album-tile a:focus-visible { outline: 2px solid var(--fg); outline-offset: -6px; }

/* Album: justified rows. Each photo grows in proportion to its aspect ratio, so every row
   spans the full width and no photo is cropped. The last row keeps its natural width. */
.justified {
  --row: clamp(200px, 32vw, 460px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 0.8vw, 12px);
}
.justified::after { content: ""; flex-grow: 999999; }
.justified a {
  flex: calc(var(--ratio) * 1000) 1 calc(var(--ratio) * var(--row));
  display: block;
  aspect-ratio: var(--ratio);
  background: var(--line);
  overflow: hidden;
  cursor: zoom-in;
}
.justified img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.justified img.is-loading { opacity: 0; }
.justified a:hover img { transform: scale(1.02); }
.justified a:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
@media (max-width: 599px) {
  /* On phones every photo gets its own full-width row. */
  .justified a { flex-basis: 100%; }
}

.album-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(40px, 6vw, 72px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.album-nav a { text-decoration: none; display: grid; gap: 2px; }
.album-nav .label { font-size: 0.9rem; color: var(--muted); }
.album-nav .title { font-family: var(--font-heading); font-size: 1.4rem; letter-spacing: -0.02em; }
.album-nav .next { margin-left: auto; text-align: right; }

/* PhotoSwipe: match the site's type and keep the counter calm. */
.pswp { --pswp-bg: hsl(0 0% 4%); font-family: var(--font-body); }
.pswp__counter { font-size: 0.9rem; opacity: 0.8; }

/* ---------- Page transitions ---------- */

/* Cross-document view transitions (progressive enhancement): pages cross-fade, and an album's
   title glides from its tile in the overview into the album heading. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: 0.35s; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }

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

.site-footer { padding-block: 40px; font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.site-footer nav a { text-decoration: none; }
.site-footer nav a:hover { text-decoration: underline; }
.site-footer .bar { margin-inline: 0.6em; }
.site-footer p { margin: 0; }

/* Light/dark switch: shows the moon in light mode and the sun in dark mode (the mode it switches to). */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-top: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
html:not(.js) .theme-toggle { display: none; }

/* ---------- Motion ---------- */

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