/* =========================================================
   Literaturdienst – Redesign 2026
   ========================================================= */

@font-face {
  font-family: 'Fakt Pro';
  src: url('../fonts/FaktPro-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fakt Pro';
  src: url('../fonts/FaktPro-MediumItalic.woff') format('woff');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --bg-sage: #e1e6cf;
  --ink: #0a0a0a;
  --ink-soft: #2a2a2a;
  --rule: #0a0a0a;
  --pad-x: clamp(18px, 2.4vw, 40px);
  --pad-y: clamp(18px, 2vw, 32px);
  /* Two text sizes only: body and project hero. */
  --fs-body: 30px;
  --fs-hero: clamp(56px, 12vw, 220px);
  --img-radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Fakt Pro', -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: 1;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html, body { min-height: 100vh; min-height: 100dvh; }

/* Only the R / r get the FaktPro ss01 alternate glyph (R.ss09 / r.ss10).
   JS in the footer wraps every R and r in <span class="alt-r">. */
.alt-r { font-feature-settings: "ss01" 1; }

img { max-width: 100%; height: auto; display: block; border-radius: var(--img-radius); }

/* Texte index: starts white, hover background is set via JS per project. */
body { transition: background-color 0.25s ease; }
body.tpl-projects { background: #ffffff; }
/* Single-project page bg is driven by the page's `Bgcolor` field (see header.php).
   No CSS default here — that would beat the dynamic style on specificity. */

/* ---------- Header / Nav (both fixed) ---------- */
.site-logo {
  position: fixed;
  top: var(--pad-y);
  left: var(--pad-x);
  z-index: 9999;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: 'Cutive Mono', ui-monospace, monospace;
  font-size: 19px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  line-height: 0.85;
  pointer-events: auto;
}
.site-logo .logo-stars { letter-spacing: 0.18em; line-height: 0.6; }
.site-logo .logo-stars:last-child { margin-top: 4px; }
.site-logo .logo-name  { padding: 0; }

.site-nav {
  position: fixed;
  top: var(--pad-y);
  right: var(--pad-x);
  z-index: 9999;
  font-size: var(--fs-body);
}
.site-nav .nav-toggle {
  display: none; /* desktop hides toggle */
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  letter-spacing: inherit;
}
.site-nav .nav-items {
  display: flex;
  gap: 0.7em;
}
.site-nav .nav-link {
  color: var(--ink);
  text-decoration: none;
}
.site-nav .nav-link:hover     { font-style: italic; }
.site-nav .nav-link.is-active { font-style: italic; }

/* ---------- Main ---------- */
.site-main {
  /* Reserve room for the fixed logo (top) and fixed nav (bottom-left). */
  padding:
    calc(var(--pad-y) + 4em)
    var(--pad-x)
    calc(var(--pad-y) + 3em);
}

/* ---------- Generic content text (default + home stream entries) ---------- */
.content-text {
  max-width: none;
  font-size: var(--fs-body);
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.content-text p  { margin: 0 0 0.8em; }
/* h1 inside content: same style as p, kept as h1 for semantics.
   Override here if a distinct h1 style is wanted later. */
.content-text h1 {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  margin: 0 0 0.6em;
}
.content-text a {
  color: inherit;
  text-decoration: none;
  font-style: italic;
}
.content-text a:hover { font-style: italic; opacity: 0.65; }
.content-text img {
  display: block;
  margin: clamp(20px, 2.4vw, 40px) auto;
  max-width: min(100%, 700px);
  height: auto;
  border-radius: var(--img-radius);
}
.content-text iframe {
  display: block;
  margin: clamp(20px, 2.4vw, 40px) auto;
  max-width: 700px;
  width: 100%;
  border-radius: var(--img-radius);
}

/* ---------- Default-template image gallery ---------- */
.gallery {
  margin-top: clamp(40px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 2.5vw, 40px);
}
.gallery .image-wrapper,
.gallery a {
  display: block;
  text-decoration: none;
  width: 80%;
  max-width: 700px;
}
.gallery img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* ---------- Home / Presse stream ---------- */
.stream { max-width: none; }
.stream-entry { margin: 0 0 clamp(48px, 6vw, 90px); }
.stream-entry h2 {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  margin: 0;
}
/* Text left + full-width; images get centered separately. */
.stream-entry .content-text { text-align: left; }
.stream-entry .content-text p:first-child { margin-top: 0; }
.stream-entry img,
.stream-entry .image-wrapper { margin-left: auto; margin-right: auto; }
.stream-entry .gallery { margin-top: 24px; gap: 24px; }

/* ---------- Single project page ---------- */
.project-hero { padding: 0; margin: 0 0 0.4em; }
.project-hero h1 {
  font-family: 'Fakt Pro', sans-serif;
  font-weight: 500;
  letter-spacing: inherit;
  font-size: var(--fs-body);
  line-height: 1;
  margin: 0;
}
.project-hero .project-year { margin: 0; }

.project-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(48px, 5vw, 90px);
  align-items: center;
  margin-top: clamp(40px, 5vw, 80px);
}
.project-pages a,
.project-pages .image-wrapper {
  display: block;
  width: 100%;
  background: transparent;
  padding: 0;
  border-radius: var(--img-radius);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 14px 26px rgba(0,0,0,0.10);
  transform-origin: center;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1), box-shadow 0.35s ease;
}
.project-pages a:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 10px rgba(0,0,0,0.10), 0 22px 40px rgba(0,0,0,0.16);
}
.project-pages img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

/* ---------- Texte (projects index) – stacked-paper grid ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: clamp(36px, 3.6vw, 70px) clamp(28px, 2.8vw, 48px);
  margin-top: clamp(20px, 3vw, 40px);
}
.project-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 18px 12px 14px;
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.project-stack:hover { transform: translateY(-4px); }

.stack-images {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.25;
}
.stack-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  aspect-ratio: 4 / 5;
  height: auto;
  margin: 0;
  background: #ffffff;
  padding: 0;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 14px 26px rgba(0,0,0,0.10);
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1), box-shadow 0.4s ease;
  transform-origin: center;
}
.layer-1 { transform: translate(-50%, -50%) rotate(-7deg) translate(-6px, 10px); z-index: 1; }
.layer-2 { transform: translate(-50%, -50%) rotate(4deg)  translate(8px,  -2px); z-index: 2; }
.layer-3 { transform: translate(-50%, -50%) rotate(-2deg) translate(-1px, -8px); z-index: 3; }
.layer-4 { transform: translate(-50%, -50%) rotate(1deg)  translate(0,    0);    z-index: 4; }

.project-stack:hover .layer-1 {
  transform: translate(-50%, -50%)
             rotate(calc(-14deg + var(--r1, 0deg)))
             translate(calc(-22px + var(--x1, 0px)), calc(22px + var(--y1, 0px)));
}
.project-stack:hover .layer-2 {
  transform: translate(-50%, -50%)
             rotate(calc(10deg + var(--r2, 0deg)))
             translate(calc(22px + var(--x2, 0px)), calc(-10px + var(--y2, 0px)));
}
.project-stack:hover .layer-3 {
  transform: translate(-50%, -50%)
             rotate(calc(-6deg + var(--r3, 0deg)))
             translate(calc(-6px + var(--x3, 0px)), calc(-18px + var(--y3, 0px)));
}
.project-stack:hover .layer-4 {
  transform: translate(-50%, -50%)
             rotate(calc(1deg + var(--r4, 0deg)))
             translate(calc(2px + var(--x4, 0px)), calc(-4px + var(--y4, 0px)))
             scale(1.06);
  z-index: 5;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12), 0 28px 50px rgba(0,0,0,0.18);
}

.project-title {
  margin-top: clamp(16px, 1.6vw, 24px);
  text-align: center;
  transition: transform 0.3s ease;
}
.project-stack:hover .project-title,
.project-stack.is-tapped .project-title {
  transform: translateY(2px);
}
/* Tap feedback on touch devices: a brief press-down on the stack. */
.project-stack:active,
.project-stack.is-tapped { transform: translateY(-2px) scale(0.98); }

/* ---------- Footer ---------- */
.site-footer {
  padding: clamp(40px, 5vw, 80px) var(--pad-x) clamp(20px, 2vw, 32px);
  font-family: 'Cutive Mono', monospace;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ---------- Lightbox ---------- */
.glightbox-container .goverlay {
  background-color: var(--page-bg-overlay, rgba(255,255,255,0.7)) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
}
.gslide-media, .gslide-inner-content, .ginner-container {
  background: transparent !important;
  box-shadow: none !important;
}
.gslide-image img {
  max-width: calc(100vw - 120px) !important;
  max-height: calc(100vh - 120px) !important;
  background: transparent !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.18) !important;
  border-radius: var(--img-radius);
}

/* Replace the default X close button with a Cutive Mono * matching the logo. */
.gclose svg { display: none !important; }
.gclose {
  width: 88px !important;
  height: 88px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 0 !important;
  color: var(--ink) !important;
  opacity: 1 !important;
}
.gclose::after {
  content: "*";
  font-family: 'Cutive Mono', ui-monospace, monospace;
  font-size: 72px;
  line-height: 1;
  letter-spacing: 0;
}

/* Prev / next arrows: < and > in Cutive Mono, black. */
.gprev svg, .gnext svg { display: none !important; }
.gprev, .gnext {
  width: 88px !important;
  height: 88px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  border: 0 !important;
  color: var(--ink) !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.gprev::after, .gnext::after {
  font-family: 'Cutive Mono', ui-monospace, monospace;
  font-size: 56px;
  line-height: 1;
  color: var(--ink);
}
.gprev::after { content: "<"; }
.gnext::after { content: ">"; }

/* Hide GLightbox slide title/description (no caption under image). */
.gslide-title, .gslide-desc, .gslide-description, .gdesc-inner { display: none !important; }

::selection      { background: #fff066; color: #000; }
::-moz-selection { background: #fff066; color: #000; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  :root {
    --pad-x: 18px;
    --pad-y: 18px;
    --fs-body: 17px;
  }
  /* Smaller hero too. */
  .project-hero h1 { font-size: clamp(40px, 13vw, 90px); }

  /* Logo stays top-left, smaller. */
  .site-logo {
    top: var(--pad-y);
    left: var(--pad-x);
    font-size: 14px;
  }
  /* Nav becomes a "Menü" button that reveals the links underneath. */
  .site-nav {
    right: var(--pad-x);
    top: var(--pad-y);
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
  }
  .site-nav .nav-toggle { display: inline-block; align-self: flex-end; }
  .site-nav .nav-items {
    display: none;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    line-height: 1;
    margin-top: 0;
  }
  .site-nav.is-open .nav-items { display: flex; }
  .site-nav .nav-toggle[aria-expanded="true"] { font-style: italic; }
  .site-main {
    padding:
      calc(var(--pad-y) + 4em)
      var(--pad-x)
      calc(var(--pad-y) + 1em);
  }

  /* Texte overview: 2 cols on phones, scales up to 3 if there's room. */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(20px, 5vw, 36px) 14px;
  }
  /* Slightly smaller paper stack: less protrusion. */
  .stack-layer { width: 84%; }

  /* Single project page: 2 thumbnails per row. */
  .project-pages {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(20px, 4vw, 36px);
  }
}

/* Slightly larger phones / small tablets: allow 3 cols when it fits. */
@media (min-width: 480px) and (max-width: 720px) {
  .projects-grid { grid-template-columns: repeat(3, 1fr); }
}
