/* ==========================================================================
   wiestner.com – Stylesheet
   Vanilla CSS. Schriften selbst gehostet (assets/fonts), Fallback Systemschriften.
   Hell- und Dunkelmodus über Tokens.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #FFFFFF;
  --ink: #111317;
  --muted: #4E545E;
  --line: #E6E8EC;
  --soft: #F3F4F6;
  --photo: #E4E7EB;
  --btn-bg: #111317;
  --btn-ink: #FFFFFF;
  --accent: #2F5BEA;
  --shadow: rgba(17, 19, 23, 0.08);
  --img-filter: none;

  --sans: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --radius-l: 24px;
  --radius-m: 16px;
  --gutter: 1.5rem;
  --space-section: clamp(5rem, 11vw, 9rem);
  --header-h: 4.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1114;
    --ink: #ECEEF1;
    --muted: #A1A7B0;
    --line: #2A2E35;
    --soft: #1B1E23;
    --photo: #1F2329;
    --btn-bg: #ECEEF1;
    --btn-ink: #0F1114;
    --accent: #8AA4FF;
    --shadow: rgba(0, 0, 0, 0.4);
    --img-filter: brightness(0.92);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1114;
  --ink: #ECEEF1;
  --muted: #A1A7B0;
  --line: #2A2E35;
  --soft: #1B1E23;
  --photo: #1F2329;
  --btn-bg: #ECEEF1;
  --btn-ink: #0F1114;
  --accent: #8AA4FF;
  --shadow: rgba(0, 0, 0, 0.4);
  --img-filter: brightness(0.92);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.1; letter-spacing: -0.025em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; }

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

.muted { color: var(--muted); }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-ink);
  font-weight: 500; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.container { width: min(100% - 2 * var(--gutter), 74rem); margin-inline: auto; }

/* ---------- 3. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    -webkit-backdrop-filter: saturate(1.3) blur(14px);
    backdrop-filter: saturate(1.3) blur(14px);
  }
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner { display: flex; align-items: center; gap: 2rem; min-height: var(--header-h); }

.brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.brand .logo { display: block; height: 1.625rem; width: auto; }
.brand .logo-dot { fill: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.theme-toggle {
  display: inline-grid; place-items: center;
  inline-size: 2.75rem; block-size: 2.75rem; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { box-shadow: 0 0 0 3px var(--soft); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* ---------- 4. Buttons & Links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.5rem;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-ink);
  font: inherit; font-size: 1rem; font-weight: 500; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -14px var(--shadow), 0 2px 6px -3px var(--shadow); }
.btn:active { transform: translateY(0); }
.btn--soft { background: var(--soft); color: var(--ink); }
.btn--outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--outline:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn--small { min-height: 2.5rem; padding: 0 1rem; font-size: 0.9375rem; }
.btn--arrow { gap: 0.5rem; padding-right: 1.15rem; }
.btn--arrow .arrow { transition: transform 0.25s var(--ease); }
.btn--arrow:hover .arrow, .btn--arrow:focus-visible .arrow { transform: translateX(3px); }

.text-link {
  font-weight: 500;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 2px;
  transition: background-size 0.3s var(--ease);
}
.text-link:hover, .text-link:focus-visible { background-size: 100% 2px; }

/* ---------- 5. Hero ---------- */
.hero { padding-top: clamp(4.5rem, 10vw, 8rem); }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }

.hero-title {
  max-width: 17ch;
  font-size: clamp(2.75rem, 5.6vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}
.hero-lead {
  max-width: 56ch;
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: clamp(1.125rem, 1.6vw, 1.25rem);
  line-height: 1.55;
}
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-top: 2.25rem; }

.hero-figure { width: 100%; margin-top: clamp(3rem, 6vw, 4.5rem); }
.hero-figure img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: var(--radius-l);
  background: var(--photo);
  filter: var(--img-filter);
}

.areas {
  width: 100%;
  margin-top: 3.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding-block: 1px;
  background: var(--line);          /* die Lücken ergeben die Trennlinien */
  text-align: center;
}
.areas a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  min-height: 6.5rem;
  padding: 1.25rem 1rem;
  background: var(--bg);
  text-decoration: none;
  transition: background-color 0.25s ease;
}
/* Feine Linie wächst beim Überfahren von der Mitte aus */
.areas a::after {
  content: "";
  position: absolute; left: 1.5rem; right: 1.5rem; bottom: -1px;
  height: 2px; background: var(--ink);
  transform: scaleX(0);
  transition: transform 0.35s var(--ease);
}
.areas a:hover { background: var(--soft); }
.areas a:hover::after, .areas a:focus-visible::after { transform: scaleX(1); }
.areas a:focus-visible { outline-offset: -2px; }
.areas strong { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.areas span { font-size: 0.9375rem; color: var(--muted); }

/* ---------- 6. Abschnitte ---------- */
.section { padding-top: var(--space-section); }

.section-head { max-width: 46rem; margin: 0 auto clamp(2.5rem, 5vw, 3.5rem); text-align: center; }
.section-head h2 { font-size: clamp(2rem, 3.6vw, 3rem); letter-spacing: -0.035em; }
.section-head p { margin: 1rem auto 0; max-width: 52ch; color: var(--muted); font-size: 1.1875rem; line-height: 1.55; }

.narrow { max-width: 54rem; margin-inline: auto; }
.sub-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 1rem; }

/* Zwei Spalten */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.duo--plain { gap: 2.5rem; margin-top: 3.5rem; }

.panel {
  display: flex; flex-direction: column; gap: 0.9rem;
  padding: clamp(1.75rem, 3.5vw, 2.5rem);
  background: var(--soft);
  border-radius: var(--radius-m);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.panel:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -28px var(--shadow); }
.panel h3 { font-size: 1.5rem; letter-spacing: -0.025em; }
.panel > p { color: var(--muted); }
.panel .text-link { align-self: flex-start; margin-top: auto; padding-top: 0.5rem; }

.list { list-style: none; display: grid; gap: 0.55rem; margin: 0.35rem 0 0.5rem; font-size: 0.9875rem; }
.list li { display: flex; gap: 0.75rem; align-items: baseline; }
.list li::before {
  content: ""; flex: none;
  width: 0.35rem; height: 0.35rem; border-radius: 999px;
  background: var(--ink); opacity: 0.55;
  transform: translateY(-0.15em);
}

/* comdaily */
.feature {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 6vw, 5.5rem);
  align-items: center;
}
.feature-main { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.feature-kicker { font-size: 0.9375rem; font-weight: 500; color: var(--muted); }
.feature-main h2 { font-size: clamp(2.25rem, 4vw, 3.25rem); letter-spacing: -0.04em; margin-top: -0.4rem; }
.feature-main > p:not(.feature-kicker) { max-width: 46ch; font-size: 1.125rem; color: var(--muted); }
.feature-main .btn { margin-top: 0.5rem; }
.feature-figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 38%;
  border-radius: var(--radius-l);
  background: var(--photo);
  filter: var(--img-filter);
}

/* Publikationen */
.pubs { list-style: none; border-top: 1px solid var(--line); }
.pub {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.pub-year { color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.pub-title { font-family: var(--serif); font-size: 1.25rem; line-height: 1.35; letter-spacing: -0.005em; max-width: 52ch; }
.pub-meta { margin-top: 0.3rem; color: var(--muted); font-size: 0.9375rem; }
.pub-link {
  font-size: 0.9375rem; font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: text-underline-offset 0.2s ease;
}
.pub-link:hover { text-underline-offset: 6px; }

/* Über mich */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.about-photo {
  width: 100%;
  max-width: 30rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-m);
  background: var(--photo);
  filter: var(--img-filter);
}
.about-text h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); letter-spacing: -0.03em; margin-bottom: 1.25rem; }
.about-text p { max-width: 58ch; color: var(--muted); font-size: 1.125rem; }
.about-text p + p { margin-top: 1rem; }
.about-text .about-lead { color: var(--ink); font-family: var(--serif); font-size: clamp(1.3rem, 2vw, 1.55rem); line-height: 1.42; letter-spacing: -0.01em; }

/* Fotostreifen: fünf Hochformate, auf kleinen Bildschirmen wischbar */
.photos { margin-top: clamp(3.5rem, 7vw, 5rem); }
.photos-note { margin-bottom: 1rem; color: var(--muted); font-size: 0.9375rem; }
.photo-strip { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
.photo-strip li { overflow: hidden; border-radius: var(--radius-m); background: var(--photo); }
.photo-strip img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  filter: var(--img-filter);
  transition: transform 0.6s var(--ease);
}
.photo-strip li:hover img { transform: scale(1.03); }
.photo-controls { display: none; }
@media (max-width: 60rem) {
  .photo-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
  }
  .photo-strip::-webkit-scrollbar { display: none; }
  /* Abstand am Ende, damit das letzte Bild nicht am Rand klebt */
  .photo-strip::after { content: ""; flex: 0 0 calc(var(--gutter) - 0.75rem); }
  .photo-strip li { flex: 0 0 clamp(11rem, 62vw, 16rem); scroll-snap-align: start; }
  .photo-strip:focus-visible { outline-offset: 4px; }

  .photo-controls:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
  }
  .photo-btn {
    display: inline-grid; place-items: center;
    inline-size: 2.75rem; block-size: 2.75rem; padding: 0;
    border: 1px solid var(--line); border-radius: 999px;
    background: transparent; color: var(--ink); cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  }
  .photo-btn:active { transform: scale(0.94); }
  .photo-btn:disabled { opacity: 0.35; cursor: default; }
  .photo-count { min-width: 3.5rem; text-align: center; color: var(--muted); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
}

/* Kontakt */
.section--contact { padding-bottom: var(--space-section); }
.contact { display: flex; flex-direction: column; align-items: center; text-align: center; }
.contact h2 { font-size: clamp(2.25rem, 4.6vw, 3.75rem); letter-spacing: -0.04em; }
.contact > p { margin-top: 1rem; max-width: 44ch; color: var(--muted); font-size: 1.1875rem; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.625rem; margin-top: 2rem; }
.contact .contact-address { margin-top: 1.25rem; font-size: 0.9375rem; }
.contact-address a { color: var(--muted); text-underline-offset: 3px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.75rem; color: var(--muted); font-size: 0.9375rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; list-style: none; }
.footer-links a { text-decoration: none; transition: color 0.2s ease; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 7. Rechtliche Seiten ---------- */
.legal { padding-block: clamp(3.5rem, 8vw, 6rem) var(--space-section); }
.legal-inner { width: min(100% - 2 * var(--gutter), 44rem); margin-inline: auto; }
.legal h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); letter-spacing: -0.04em; margin-bottom: 2.5rem; }
.legal h2 { font-size: 1.1875rem; letter-spacing: -0.01em; margin: 2.5rem 0 0.6rem; }
.legal p, .legal li { max-width: 65ch; }
.legal p + p { margin-top: 0.8rem; }
.legal ul { padding-left: 1.25rem; margin-top: 0.6rem; }
.legal li + li { margin-top: 0.3rem; }
.legal address { font-style: normal; }
.legal a { text-underline-offset: 3px; }
.legal .meta { margin-top: 3rem; color: var(--muted); font-size: 0.9375rem; }

/* ---------- 8. Bewegung ---------- */
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to   { opacity: 1; transform: none; }
}

/* Ein ruhiger Einstieg: der Hero blendet gestaffelt ein */
.load {
  animation: rise 0.9s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 100ms + 60ms);
}

/* Abschnitte: Fade-in/Slide-up beim Laden … */
[data-reveal] { animation: rise 0.9s var(--ease) both; animation-delay: 0.5s; }
/* … in modernen Browsern erst beim Hineinscrollen (reines CSS) */
@supports (animation-timeline: view()) {
  [data-reveal] {
    animation: rise var(--ease) both;
    animation-timeline: view();
    animation-range: entry 0% entry 35%;
    animation-delay: 0s;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .load, [data-reveal] { animation: none !important; }
  .btn:hover, .panel:hover, .photo-strip li:hover img { transform: none; }
}

/* ---------- 9. Responsive ---------- */
@media (max-width: 60rem) {
  .areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .duo { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; align-items: start; }
  .feature-figure { max-width: 28rem; }
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 32rem; }
}

@media (max-width: 44rem) {
  :root { --gutter: 1.25rem; }
  .hero-figure img { aspect-ratio: 4 / 3; border-radius: var(--radius-m); }
  .pub { grid-template-columns: 1fr; }
  .pub-link { justify-self: start; margin-top: 0.4rem; }
  .duo--plain { gap: 2rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 26rem) {
  .hero-actions .btn, .contact-actions .btn { width: 100%; }
}

/* Weitere Publikationen (aufklappbar) */
.more-pubs { margin-top: 0; }
.more-pubs summary {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.25rem; min-height: 2.75rem; padding: 0 1.1rem;
  border-radius: 999px; background: var(--soft);
  font-size: 0.9375rem; font-weight: 500; cursor: pointer; list-style: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.more-pubs summary::-webkit-details-marker { display: none; }
.more-pubs summary::after {
  content: ""; width: 0.5rem; height: 0.5rem;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.more-pubs[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.more-pubs summary:hover { box-shadow: 0 0 0 3px var(--line); }
.more-count { color: var(--muted); }
.pubs--more { margin-top: 1.25rem; }
.more-pubs[open] .pubs--more { animation: rise 0.45s var(--ease) both; }

/* Beide Beratungs-Felder zeilengleich ausrichten: Titel, Einleitung, Liste und Link
   stehen nebeneinander auf derselben Höhe, auch wenn ein Text einmal umbricht. */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 60.01rem) {
    .duo:not(.duo--plain) .panel {
      display: grid;
      grid-row: span 4;
      grid-template-rows: subgrid;
      row-gap: 0.9rem;
      align-content: start;
    }
    .duo:not(.duo--plain) .panel .text-link { align-self: end; justify-self: start; }
  }
}

.about-text .about-link { display: inline-block; margin-top: 1.25rem; color: var(--ink); }
