/* ============================================================
   Dispersion AI — Old-Money Editorial
   Palette : warm bone paper · deep forest ink · muted brass
   Type    : Fraunces (display) · Instrument Sans (text)
   ============================================================ */

:root {
  /* Surfaces */
  --bg:        #fff;  

  /* Ink */
  --ink:       #1b1a15;   /* warm near-black */
  --ink-soft:  #4b4740;   /* body text */
  --ink-faint: #726c5f;   /* captions / meta (AA-legible) */

  /* Accent */
  --green:      #1e3a2f;  /* deep forest */
  --green-deep: #16281f;
  --green-tint: #2c5142;
  --brass:      #9b7a48;  /* muted gold */
  --cream:      #f6f1e6;  /* light-on-green */

  /* Lines */
  --line:      rgba(27, 26, 21, 0.14);
  --line-soft: rgba(27, 26, 21, 0.08);

  /* System */
  --serif: "Fraunces", "Times New Roman", Georgia, serif;
  --sans:  "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.22, 0.68, 0.18, 1);
  --shell: 1400px;
  --pad: clamp(1.35rem, 5vw, 4.5rem);
}

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

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 100%;
  line-height: 1.5;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  position: relative;
}

/* Printed-paper grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--green); color: var(--cream); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 4px;
  border-radius: 1px;
}

/* ---------- Shell ---------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--pad);
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 2;
}

/* ---------- Hero ---------- */
.hero {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  padding-block: clamp(1rem, 2.4vw, 2rem);
}

.hero__grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 4.5vw, 3rem);
  align-items: center;
}

/* Headline */
.headline {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  font-weight: 470;
  font-size: clamp(2.7rem, 6.6vw, 5.4rem);
  line-height: 0.99;
  letter-spacing: -0.022em;
  color: var(--ink);
  text-wrap: balance;
  max-width: 16ch;
}
.headline em {
  font-style: italic;
  font-weight: 420;
  color: var(--green);
}

/* Per-character reveal — letters resolving out of blur (dispersion) */
.headline .word {
  display: inline-block;
  white-space: nowrap;   /* keep each word intact; only break at spaces */
}
.headline .char {
  display: inline-block;
  opacity: 0;
  filter: blur(14px);
  transform: translateY(0.14em);
  transition:
    opacity 0.62s var(--ease),
    filter 0.62s var(--ease),
    transform 0.62s var(--ease);
  transition-delay: calc(var(--ci) * 30ms + 120ms);
  will-change: opacity, filter, transform;
}
body.is-ready .headline .char {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

/* Lead */
.lead {
  margin-top: clamp(1.25rem, 2.4vw, 1.75rem);
  max-width: 46ch;
  font-size: clamp(1.05rem, 1.35vw, 1.28rem);
  line-height: 1.62;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* Actions / Button */
.actions {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}
/* Actions / Button — liquid "gooey" merge (SVG #goo filter on wrapper) */
.actions {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
}
.btn-goo {
  display: inline-block;
  /* #goo merges the blobs into one liquid shape */
  filter: url("#goo");
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.05rem 1.9rem;
  background: var(--green);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 0.85em;
  position: relative;
  overflow: visible;
}
/* Two blobs emerge from opposite corners and gooily merge with the button */
.btn::before,
.btn::after {
  content: "";
  position: absolute;
  width: 3.3em;
  height: 2.3em;
  background: var(--green);
  border-radius: 50%;
  z-index: -1;
  transform: scale(0);
  transition: transform 0.9s var(--ease);
}
.btn::before { top: -32%; left: 15%; }
.btn::after  { bottom: -32%; right: 15%; }
.btn:hover::before,
.btn:hover::after,
.btn:focus-visible::before,
.btn:focus-visible::after {
  transform: none;
}
.btn:active { transform: translateY(1px); }

/* Label + arrow stay crisp (composited atop the goo) */
.btn__label {
  position: relative;
  z-index: 1;
}
.btn__arrow {
  position: relative;
  z-index: 1;
  transition: transform 0.5s var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

/* ---------- Media plate ---------- */
.hero__media {
  display: flex;
  justify-content: flex-start;
}
.plate {
  position: relative;
  width: 100%;
  max-width: clamp(340px, 84vw, 540px);
}
.plate__img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  /* Let the render's flat background pick up the page's grain + warm tint
     so it merges seamlessly instead of reading as a pasted rectangle. */
  mix-blend-mode: multiply;
  filter: saturate(0.8);
}

/* ---------- Footer ---------- */
.footer {
  padding-block: clamp(1rem, 2vw, 1.6rem);
}
.footer__inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.footer__mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--ink);
}
.footer__mark span {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.55em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin-left: 0.3em;
  vertical-align: 0.35em;
}
.footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.9rem;
}
.footer__nav a {
  position: relative;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  transition: color 0.35s var(--ease);
}
.footer__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
.footer__nav a:hover { color: var(--green); }
.footer__nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}
.footer__copy {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

/* ---------- Legal / Impressum modal ---------- */
.modal {
  width: min(92vw, 540px);
  max-height: min(86vh, 720px);
  margin: auto;
  inset: 0;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.modal::backdrop {
  background: rgba(22, 24, 21, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.modal[open]::backdrop { opacity: 1; }

.modal__panel {
  position: relative;
  max-height: inherit;
  overflow-y: auto;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px -20px rgba(22, 24, 21, 0.35);
}

/* Enter animation */
.modal {
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition:
    opacity 0.4s var(--ease),
    transform 0.4s var(--ease),
    overlay 0.4s var(--ease) allow-discrete,
    display 0.4s var(--ease) allow-discrete;
}
.modal[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

.modal__close {
  position: absolute;
  top: clamp(0.8rem, 2vw, 1.15rem);
  right: clamp(0.8rem, 2vw, 1.15rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition:
    color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}
.modal__close:hover,
.modal__close:focus-visible {
  color: var(--green);
  border-color: var(--green);
  background: var(--cream);
}

.modal__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
  padding-right: 2.5rem;
}
.modal__body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.02rem;
  color: var(--green);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.modal__body h3:first-child { margin-top: 0; }
.modal__body p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 0.85rem;
}
.modal__body strong { color: var(--ink); font-weight: 600; }
.modal__body a {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.modal__body a:hover { color: var(--green-deep); }

/* ============================================================
   Entrance motion
   ============================================================ */
[data-animate] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 1s var(--ease),
    transform 1s var(--ease);
  transition-delay: calc(var(--d, 0) * 1ms);
  will-change: opacity, transform;
}
.hero__media[data-animate] { transform: translateY(18px) scale(0.985); }
body.is-ready [data-animate] {
  opacity: 1;
  transform: none;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Small — refine spacing, stack footer nicely */
@media (min-width: 560px) {
  .footer__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

/* Tablet — keep single column but center the plate elegantly */
@media (min-width: 680px) and (max-width: 899px) {
  .hero__media { justify-content: flex-start; }
  .plate { max-width: min(740px, 70vh); }
}

/* Desktop — asymmetric two-column editorial layout */
@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: clamp(2.5rem, 4vw, 4.5rem);
    align-items: center;
  }
  .hero__media { justify-content: flex-end; }
  .plate { max-width: min(900px, 80vh); }
  .headline__br { display: block; }
}

@media (min-width: 1200px) {
  .plate { max-width: min(980px, 82vh); }
}

/* Below 900 the manual break in the headline shouldn't force awkward wraps */
@media (max-width: 899px) {
  .headline__br { display: none; }
  .headline { max-width: 18ch; }
  .plate { max-width: min(clamp(440px, 86vw, 660px), 56vh); }
}

/* Phones — tighten so everything still fits on one screen */
@media (max-width: 560px) {
  .hero { padding-block: 0.75rem; }
  .hero__grid { gap: clamp(1.1rem, 4vw, 1.6rem); }
  .plate { max-width: min(90vw, 54vh); }
  .lead { margin-top: 1rem; font-size: 1rem; line-height: 1.55; }
  .actions { margin-top: 1.3rem; }
  .footer__inner { gap: 0.9rem; }
}

/* Very small phones */
@media (max-width: 400px) {
  .plate { max-width: min(88vw, 52vh); }
  .btn { width: 100%; justify-content: center; }
}

/* Short phones — compress further so a full screen still avoids scrolling.
   Placed last so it wins over the width-based phone rules above. */
@media (max-width: 560px) and (max-height: 750px) {
  .hero { padding-block: 0.35rem; }
  .hero__grid { gap: 0.78rem; }
  .plate { max-width: min(70vw, 34vh); }
  .lead { margin-top: 0.75rem; font-size: 0.92rem; line-height: 1.46; }
  .actions { margin-top: 0.9rem; }
  .footer__inner { gap: 0.7rem; }
}

/* Short laptops — the narrower text column makes the headline taller, so
   trim the vertical rhythm to keep everything on one screen. */
@media (min-width: 900px) and (max-height: 780px) {
  .hero { padding-block: 0.75rem; }
  .lead { margin-top: 1.1rem; }
  .actions { margin-top: 1.35rem; }
  .plate { max-width: min(720px, 66vh); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-animate] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .headline .char {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}
