/* ==========================================================================
   Larissa Ihly - Oelmalerei
   Ein einziges Stylesheet, keine Frameworks, keine externen Requests.
   Aufbau: Tokens -> Reset -> Layout -> Navigation -> Inhalt -> Galerie ->
           Lightbox -> Utilities
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   Die Bilder sind sehr farbstark. Die Seite haelt sich bewusst zurueck:
   warmes Weiss, viel Luft, ein einziger gedeckter Akzent.
   -------------------------------------------------------------------------- */
:root {
  --paper: #faf8f5;
  --paper-deep: #f2ede6;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-soft: #57504a;
  --ink-mute: #8a817a;
  --line: #e3dbd1;
  --line-soft: #efe9e1;
  --accent: #9a5b3f;
  --accent-soft: #f0e3dc;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  --sidebar-w: 17.5rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --radius: 2px;

  --shadow-lift: 0 1rem 2.5rem -1rem rgb(28 25 23 / 0.28);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

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

::selection {
  background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Layout
   Ab 900px steht die Navigation als ruhige Spalte links und bleibt beim
   Scrollen stehen. Darunter wird sie zur Schublade (siehe Navigation).
   -------------------------------------------------------------------------- */
.layout {
  min-height: 100vh;
}

@media (min-width: 56.25em) {
  .layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }
}

.main {
  min-width: 0;
  padding: var(--gutter);
  padding-top: clamp(1.5rem, 4vw, 4rem);
}

@media (max-width: 56.24em) {
  .main {
    padding-top: 1.5rem;
  }
}

.main--prose {
  max-width: 58rem;
}

/* --------------------------------------------------------------------------
   Navigation - Desktop
   -------------------------------------------------------------------------- */
.sidebar {
  background: var(--paper-deep);
  border-right: 1px solid var(--line);
}

@media (min-width: 56.25em) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 3.5rem 2rem 2rem;
    overflow-y: auto;
  }
}

.brand {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.brand a {
  text-decoration: none;
}

.brand a:hover {
  color: var(--accent);
}

.brand__tag {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.nav {
  margin: 2.75rem 0 0;
  padding: 0;
  list-style: none;
}

.nav a {
  position: relative;
  display: block;
  padding: 0.45rem 0;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
}

.nav a::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s var(--ease);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a:hover::before,
.nav a[aria-current="page"]::before {
  width: 0.65rem;
}

.nav a[aria-current="page"] {
  font-weight: 600;
}

.sidebar__foot {
  margin-top: auto;
  padding-top: 2.5rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--ink-mute);
}

.sidebar__foot a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.sidebar__foot a:hover {
  color: var(--accent);
  border-color: currentColor;
}

/* Pflichtangaben - bewusst ruhig, aber von jeder Seite aus erreichbar. */
.sidebar__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
}

.sidebar__legal a {
  color: var(--ink-mute);
  text-decoration: none;
}

.sidebar__legal a:hover,
.sidebar__legal a[aria-current="page"] {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Navigation - Mobil
   Die Sidebar wird zur Schublade, davor liegt eine schmale Kopfzeile.
   -------------------------------------------------------------------------- */
.topbar,
.nav-scrim {
  display: none;
}

@media (max-width: 56.24em) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem var(--gutter);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
  }

  .topbar .brand {
    font-size: 1.15rem;
  }

  .topbar .brand__tag {
    display: none;
  }

  .nav-toggle {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: -0.5rem;
    border-radius: var(--radius);
    color: var(--ink);
  }

  .nav-toggle:hover {
    background: var(--paper-deep);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(20rem, 84vw);
    padding: 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0.3s;
  }

  .sidebar[data-open="true"] {
    transform: none;
    visibility: visible;
  }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgb(28 25 23 / 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease), visibility 0.3s;
  }

  .nav-scrim[data-open="true"] {
    opacity: 1;
    visibility: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .nav-scrim {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Inhalt
   -------------------------------------------------------------------------- */
.page-head {
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.005em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.15rem);
}

h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.85rem);
  margin-top: 2.5rem;
}

.lead {
  max-width: 46ch;
  margin: 1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.prose {
  max-width: 68ch;
}

.prose p {
  margin: 0 0 1.25rem;
  text-wrap: pretty;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.prose ul {
  margin: 0 0 1.25rem;
  padding-left: 1.15rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose li::marker {
  color: var(--ink-mute);
}

/* Auf den Rechtsseiten folgen viele kurze Abschnitte aufeinander - etwas mehr
   Luft davor macht sie ueberhaupt erst ueberfliegbar. */
.prose h2 {
  margin-top: 2.75rem;
  font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.4rem);
}

.prose h2:first-child {
  margin-top: 0;
}

.rule {
  height: 1px;
  margin: clamp(2.5rem, 6vw, 4.5rem) 0;
  border: 0;
  background: var(--line);
}

/* Zweispaltiger Textblock mit Bild (Ueber mich) */
.split {
  display: grid;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 48em) {
  .split {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

.portrait {
  margin: 0;
}

.portrait img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

.portrait figcaption {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--ink-mute);
}

/* Kontaktdaten */
.contact-card {
  display: grid;
  gap: 1.75rem;
  max-width: 34rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.contact-card dl {
  display: grid;
  gap: 1.25rem;
  margin: 0;
}

.contact-card dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.contact-card dd {
  margin: 0.3rem 0 0;
  font-size: 1.05rem;
}

.contact-card a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.contact-card a:hover {
  color: var(--accent);
  border-color: currentColor;
}

/* --------------------------------------------------------------------------
   Filter-Chips
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0 2rem;
}

.chip {
  padding: 0.4rem 0.95rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 100px;
  white-space: nowrap;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

.chip:hover {
  color: var(--ink);
  border-color: var(--ink-mute);
}

.chip[aria-pressed="true"] {
  color: var(--surface);
  background: var(--ink);
  border-color: var(--ink);
}

.chip__count {
  margin-left: 0.4rem;
  font-size: 0.75em;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Galerie
   Masonry-Optik ueber CSS-Spalten: kein Layout-JS, kein Nachrutschen.
   Die Hoehe jeder Kachel steht durch aspect-ratio von Anfang an fest.
   -------------------------------------------------------------------------- */
.gallery,
.mosaic {
  columns: 1;
  column-gap: clamp(0.75rem, 1.6vw, 1.5rem);
}

@media (min-width: 34em) {
  .gallery,
  .mosaic {
    columns: 2;
  }
}

@media (min-width: 62em) {
  .gallery,
  .mosaic {
    columns: 3;
  }
}

@media (min-width: 100em) {
  /* Nur die grosse Galerie geht auf vier Spalten - bei den paar Kursbildern
     wuerden die Kacheln sonst unnoetig klein. */
  .gallery {
    columns: 4;
  }
}

.tile,
.mosaic figure {
  break-inside: avoid;
  margin: 0 0 clamp(0.75rem, 1.6vw, 1.5rem);
}

.mosaic img {
  width: 100%;
  border-radius: var(--radius);
  outline: 1px solid rgb(28 25 23 / 0.09);
  outline-offset: -1px;
}

.tile__btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--paper-deep) center / cover no-repeat;
  border-radius: var(--radius);
  transition: box-shadow 0.35s var(--ease);
}

.tile__btn::after {
  /* Haarfeine Kante - Malerei wirkt mit Rahmen besser als ohne */
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgb(28 25 23 / 0.09);
  border-radius: inherit;
  pointer-events: none;
}

.tile__btn:hover {
  box-shadow: var(--shadow-lift);
}

/*
 * Der Grundzustand ist bewusst voll sichtbar und ohne Transform:
 *  - Ein dauerhaftes scale() mit krummem Faktor zwingt den Browser, das Bild
 *    neu zu rastern. Das sieht auf scharfen Displays unscharf aus.
 *  - Mit opacity:0 als Ausgangswert bliebe bei einem ausgefallenen Uebergang
 *    nur der Unschaerfe-Platzhalter stehen, obwohl das Bild laengst da ist.
 * Das Einblenden macht deshalb eine Animation auf der geladenen Kachel: sie
 * kann ausfallen, ohne dass etwas unsichtbar wird.
 */
.tile img {
  width: 100%;
  transition: transform 0.5s var(--ease);
}

.tile img.is-loaded {
  animation: tile-fade-in 0.45s var(--ease);
}

@keyframes tile-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tile__btn:hover img {
  transform: scale(1.032);
}

.tile__caption {
  position: absolute;
  inset: auto 0 0;
  padding: 2.75rem 0.9rem 0.75rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #fff;
  text-align: left;
  background: linear-gradient(to top, rgb(20 17 15 / 0.72), transparent);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.tile__btn:hover .tile__caption,
.tile__btn:focus-visible .tile__caption {
  opacity: 1;
}

@media (hover: none) {
  /* Auf Touch gibt es kein Hover - Titel stehen dort in der Lightbox. */
  .tile__caption {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile img.is-loaded {
    animation: none;
  }

  .tile img,
  .tile__btn:hover img {
    transition: none;
    transform: none;
  }
}

.gallery-empty {
  padding: 3rem 0;
  color: var(--ink-mute);
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.lightbox::backdrop {
  background: rgb(16 14 13 / 0.94);
}

.lightbox__inner {
  display: grid;
  grid-template-rows: 1fr auto;
  height: 100%;
  padding: clamp(2.75rem, 6vw, 3.5rem) clamp(0.75rem, 3vw, 4.5rem)
    clamp(1rem, 3vw, 2rem);
}

/*
 * Das Bild wird bewusst absolut in die Buehne gelegt statt ueber max-height
 * begrenzt: eine Prozenthoehe kann der Browser hier nicht aufloesen, weil die
 * Hoehe der 1fr-Zeile selbst erst vom Inhalt abhaengt - dabei lief das Bild
 * unten aus dem Fenster. Ausserhalb des Flusses ist die Buehnenhoehe eindeutig,
 * und object-fit:contain skaliert und zentriert seitenverhaeltnistreu.
 */
.lightbox__stage {
  position: relative;
  min-height: 0;
  min-width: 0;
}

.lightbox__stage picture {
  display: contents;
}

.lightbox__stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1rem;
  color: #f5f1ec;
}

.lightbox__title {
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.35rem);
  line-height: 1.3;
}

.lightbox__meta {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: rgb(245 241 236 / 0.6);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lightbox__ctrl {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  color: #f5f1ec;
  background: rgb(255 255 255 / 0.08);
  border-radius: 50%;
  transition: background-color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.lightbox__ctrl:hover {
  background: rgb(255 255 255 / 0.2);
}

.lightbox__ctrl[disabled] {
  opacity: 0.25;
  cursor: default;
}

.lightbox__ctrl--close {
  top: 0.85rem;
  right: 0.85rem;
}

.lightbox__ctrl--prev {
  top: 50%;
  left: 0.85rem;
  transform: translateY(-50%);
}

.lightbox__ctrl--next {
  top: 50%;
  right: 0.85rem;
  transform: translateY(-50%);
}

@media (max-width: 34em) {
  .lightbox__ctrl--prev,
  .lightbox__ctrl--next {
    top: auto;
    bottom: 0.85rem;
    transform: none;
    width: 2.75rem;
    height: 2.75rem;
  }

  .lightbox__bar {
    padding-right: 6.5rem;
  }
}

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

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: none;
}

body.is-locked {
  overflow: hidden;
}
