/* =============================================================================
   homy · main.css
   Gemeinsame Grundlage für alle Seiten (Landingpage + Rechtstexte):
   1. Schriften   2. Design-Tokens   3. Reset & Basis
   4. Layout      5. Typografie   6. Bausteine (Buttons, Badge, Icons, iPhone)
   7. Navigation  8. Footer       9. Hilfsklassen

   Farben stammen 1:1 aus der iOS-App (Code/IOS/Homy/Homy/Theme/HomyColor.swift):
   warme Creme-Flächen + Akzent „Amber“. Die Seite gibt es bewusst nur hell.

   Radius-Regel (überall gleich):
   Buttons/Pillen = rund (999px) · Chips = 10–12px · kleine Karten = 18px ·
   Kacheln/große Karten = 32px · iPhone = eigenes Maß
   ============================================================================= */

/* 1. Schriften ---------------------------------------------------------------
   Lokal ausgeliefert: beim Seitenaufruf geht keine Besucher-IP an Google o. Ä.
   Nunito (wie in der App) als variable Schrift, SIL Open Font License 1.1.
   Caveat nur für die handgeschriebenen Zettel im Chaos-Abschnitt.            */
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin-ext.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Caveat";
  src: url("../fonts/caveat-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Akzentfarben animierbar machen (für den Farbwähler und den Theme-Wechsel). */
@property --accent { syntax: "<color>"; inherits: true; initial-value: #f0772d; }
@property --accent-ink { syntax: "<color>"; inherits: true; initial-value: #b64700; }
@property --accent-tint { syntax: "<color>"; inherits: true; initial-value: #ffe6cf; }

/* 2. Design-Tokens -------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Flächen */
  --bg: #fffbf7;            /* App: screenBg */
  --bg-sunk: #f7f2eb;       /* leicht abgesetzte Abschnitte */
  --bg-deep: #efeae2;       /* App: outerBg */
  --surface: #ffffff;       /* Karten */
  --surface-2: #faf7f2;
  --surface-3: #f1ede6;
  --line: #eae4da;
  --line-strong: #e0d8cc;
  --glass: rgb(255 251 247 / 0.72);

  /* Text */
  --text: #33302b;
  --text-2: #4a443b;
  --text-3: #6e675c;
  --text-4: #a29a8f;        /* nur Deko / große Schrift */

  /* Akzent (App „Amber“) */
  --accent: #f0772d;
  --accent-ink: #b64700;
  --accent-tint: #ffe6cf;
  --accent-text: color-mix(in oklab, var(--accent) 78%, var(--accent-ink));
  --on-accent: #ffffff;

  /* Marke: Verlauf des App-Icons */
  --brand-a: #fb8d67;
  --brand-b: #fb6055;
  --brand-grad: linear-gradient(135deg, var(--brand-a), var(--brand-b));

  /* Bereichsfarben (Kacheln, wie in der App) */
  --t-green-bg: #d4f9e1;  --t-green-fg: #01862f;
  --t-blue-bg: #c4f0ff;   --t-blue-fg: #007192;
  --t-food-bg: #ffe0c9;   --t-food-fg: #aa5910;
  --t-amber-bg: #ffe6cf;  --t-amber-fg: #b64700;
  --t-shift-bg: #ede1ff;  --t-shift-fg: #6e519d;
  --t-honey-bg: #faeec9;  --t-honey-fg: #9c6100;
  --t-rose-bg: #ffe2f5;   --t-rose-fg: #a64290;
  --t-teal-bg: #c8f9ff;   --t-teal-fg: #00888e;

  /* Mitgliederfarben (MemberColors.swift) */
  --m-amber-bg: #ffcfb0;  --m-amber-fg: #8f3400;  --m-amber: #ec7b38;
  --m-blue-bg: #a7e9ff;   --m-blue-fg: #006093;   --m-blue: #00aeee;
  --m-rose-bg: #ffcaef;   --m-rose-fg: #852e6d;   --m-rose: #de73bd;
  --m-green-bg: #b9eec2;  --m-green-fg: #006925;  --m-green: #43b966;
  --m-lav-bg: #e6d3ff;    --m-lav-fg: #623e96;    --m-lav: #ae84f2;
  --m-teal-bg: #9deff3;   --m-teal-fg: #006a74;   --m-teal: #00bac5;

  --ok: #137738;
  --ok-bg: #d5f5da;
  --danger: #e2574c;

  /* Schatten: warm getönt statt schwarz */
  --shadow-rgb: 92 64 38;
  --shadow-sm: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 2px 8px rgb(var(--shadow-rgb) / 0.05);
  --shadow-md: 0 2px 6px rgb(var(--shadow-rgb) / 0.05), 0 12px 32px -6px rgb(var(--shadow-rgb) / 0.12);
  --shadow-lg: 0 4px 12px rgb(var(--shadow-rgb) / 0.05), 0 30px 70px -16px rgb(var(--shadow-rgb) / 0.22);
  --shadow-phone: 0 2px 4px rgb(var(--shadow-rgb) / 0.08), 0 24px 50px -12px rgb(var(--shadow-rgb) / 0.30),
    0 60px 120px -30px rgb(var(--shadow-rgb) / 0.35);

  /* iPhone-Rahmen: Titan schwarz */
  --phone-frame: linear-gradient(145deg, #4a4d55 0%, #2a2c31 24%, #17181c 50%, #33353b 78%, #5a5d66 100%);
  --phone-edge: #0c0d10;

  /* Schrift */
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --fs-display: clamp(2.7rem, 1.45rem + 4.4vw, 5.25rem);
  --fs-h2: clamp(2.15rem, 1.35rem + 3vw, 3.9rem);
  --fs-h3: clamp(1.2rem, 1.08rem + 0.45vw, 1.45rem);
  --fs-lead: clamp(1.08rem, 1rem + 0.35vw, 1.3rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.9375rem;
  --fs-tiny: 0.8125rem;

  /* Abstände & Maße */
  --page: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-y: clamp(88px, 6vw + 48px, 168px);
  --nav-h: 64px;

  --r-chip: 11px;
  --r-card: 18px;
  --r-tile: 32px;
  --r-pill: 999px;

  /* Bewegung */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121,
    1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%,
    0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1);

  /* Ebenen */
  --z-raised: 2;
  --z-nav: 50;
  --z-intro: 80;
  --z-modal: 100;
}

/* 3. Reset & Basis ---------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  /* Kein seitliches Wischen auf dem Handy: Steht overflow nur am body, übertragen Browser
     es auf das Fenster, und iOS/Android verbreitern die Seite trotzdem. Mit „clip“ an html
     UND body schneidet der body selbst ab. „clip“ (statt „hidden“) erzeugt keinen eigenen
     Scrollbereich, festgehaltene Abschnitte und sticky bleiben also intakt. */
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  /* Farbwähler: Akzent gleitet weich in die neue Farbe */
  transition: --accent 0.6s ease, --accent-ink 0.6s ease, --accent-tint 0.6s ease;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video, picture { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 900; line-height: 1.08; letter-spacing: -0.025em; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--accent); color: var(--on-accent); }

section[tabindex="-1"]:focus,
main [id][tabindex="-1"]:focus { outline: none; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: calc(var(--z-modal) + 1);
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--bg);
  font-weight: 800;
  transition: top 0.2s var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* 4. Layout ------------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: calc(var(--page) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { position: relative; padding-block: var(--section-y); }
.section--sunk { background: var(--bg-sunk); }

.section-head {
  max-width: 760px;
  margin-bottom: clamp(40px, 5vw, 72px);
}
.section-head--center { margin-inline: auto; text-align: center; }

/* 5. Typografie ------------------------------------------------------------------ */
.display {
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.h2 {
  font-size: var(--fs-h2);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -0.035em;
}
.h3 { font-size: var(--fs-h3); font-weight: 850; letter-spacing: -0.02em; line-height: 1.2; }
.lead { font-size: var(--fs-lead); color: var(--text-3); line-height: 1.55; max-width: 60ch; }
.section-head .lead { margin-top: 18px; }
.section-head--center .lead { margin-inline: auto; }
.accent-text { color: var(--accent-text); }
.muted { color: var(--text-3); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: var(--fs-small);
  font-weight: 800;
  color: var(--text-2);
}
.eyebrow img { width: 26px; height: 26px; }

/* 6. Bausteine --------------------------------------------------------------------- */

/* Icons (Sprite assets/img/icons.svg) */
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: currentColor;
}

/* Buttons */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-line: var(--line-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-line);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.25s var(--ease-out), background-color 0.25s, border-color 0.25s, box-shadow 0.3s var(--ease-out);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(0.98); transition-duration: 0.08s; }
.btn--dark { --btn-bg: var(--text); --btn-fg: var(--bg); --btn-line: transparent; }
.btn--accent { --btn-bg: var(--accent-tint); --btn-fg: var(--accent-ink); --btn-line: transparent; }
.btn--ghost { --btn-bg: transparent; }
.btn--ghost:hover { --btn-bg: var(--surface); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: 0.9375rem; }
.btn--block { width: 100%; }

.btn__play {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: -10px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
.btn__play .icon { width: 13px; height: 13px; margin-left: 2px; }
.btn__meta { color: var(--text-3); font-weight: 700; }

/* Offizielles App-Store-Badge (unverändert, nur skaliert). */
.store-badge {
  display: inline-block;
  height: 52px;
  border-radius: 12px;
  transition: transform 0.25s var(--ease-out), filter 0.3s;
}
.store-badge img { height: 100%; width: auto; }
.store-badge:hover { transform: translateY(-2px); filter: drop-shadow(0 10px 18px rgb(var(--shadow-rgb) / 0.22)); }
.store-badge:active { transform: scale(0.97); }
.store-badge--sm { height: 40px; }
.store-badge--lg { height: 60px; }

/* Pillen / Chips im App-Stil */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.6;
  white-space: nowrap;
}
.chip--amber { background: var(--m-amber-bg); color: var(--m-amber-fg); }
.chip--blue { background: var(--m-blue-bg); color: var(--m-blue-fg); }
.chip--rose { background: var(--m-rose-bg); color: var(--m-rose-fg); }
.chip--green { background: var(--m-green-bg); color: var(--m-green-fg); }
.chip--lav { background: var(--m-lav-bg); color: var(--m-lav-fg); }
.chip--teal { background: var(--m-teal-bg); color: var(--m-teal-fg); }

/* Emoji-Kachel wie auf der App-Startseite */
.tile-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 22px;
  line-height: 1;
  background: var(--tint, var(--surface-3));
}

/* ---------------------------------------------------------------------------------
   iPhone-Rahmen
   Größe nur über --phone-w steuern; alles andere rechnet sich daraus.
   Seitenverhältnis des Displays = echte Aufnahmen (1320 × 2868).
   --------------------------------------------------------------------------------- */
.phone {
  --phone-w: 300px;
  --bezel: calc(var(--phone-w) * 0.036);
  --screen-r: calc(var(--phone-w) * 0.128);
  position: relative;
  width: var(--phone-w);
  padding: var(--bezel);
  border-radius: calc(var(--screen-r) + var(--bezel));
  background: var(--phone-frame);
  box-shadow: var(--shadow-phone), inset 0 0 0 1px rgb(255 255 255 / 0.14), inset 0 0 0 2px var(--phone-edge);
  isolation: isolate;
}
/* Seitentasten */
.phone::before,
.phone::after {
  content: "";
  position: absolute;
  width: calc(var(--phone-w) * 0.012);
  border-radius: 3px;
  background: var(--phone-frame);
  z-index: -1;
}
.phone::before { left: calc(var(--phone-w) * -0.009); top: 22%; height: 8%; box-shadow: 0 calc(var(--phone-w) * 0.2) 0 0 var(--phone-edge); }
.phone::after { right: calc(var(--phone-w) * -0.009); top: 28%; height: 13%; }

.phone__screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1320 / 2868;
  border-radius: var(--screen-r);
  background: var(--bg);
  /* Safari: abgerundete Ecken auch bei Transform-Animationen sauber halten */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  transform: translateZ(0);
}
.phone__screen > picture,
.phone__screen > picture img,
.phone__screen > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Mehrere Ansichten übereinander (Hero, Scroll-Story) */
.phone__screen .screen {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.phone__screen .screen.is-active { opacity: 1; }
.phone__screen .screen img { width: 100%; height: 100%; object-fit: cover; }

.phone__island {
  position: absolute;
  top: calc(var(--bezel) + var(--phone-w) * 0.027);
  left: 50%;
  width: calc(var(--phone-w) * 0.29);
  height: calc(var(--phone-w) * 0.085);
  translate: -50% 0;
  border-radius: var(--r-pill);
  background: #050506;
  z-index: 3;
}
/* Glanz auf dem Glas */
.phone__glare {
  position: absolute;
  inset: var(--bezel);
  border-radius: var(--screen-r);
  background: linear-gradient(115deg, rgb(255 255 255 / 0.16) 0%, rgb(255 255 255 / 0) 34%);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
}

/* 7. Navigation ------------------------------------------------------------------- */
.nav {
  position: fixed;
  inset: 12px 0 auto;
  z-index: var(--z-nav);
  pointer-events: none;
}
.nav__bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--nav-h);
  max-width: calc(var(--page) + 24px);
  margin-inline: auto;
  padding: 0 10px 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: background-color 0.4s, border-color 0.4s, box-shadow 0.4s, backdrop-filter 0.4s;
}
.nav.is-solid .nav__bar {
  background: var(--glass);
  border-color: var(--line);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}
@media (max-width: 1300px) { .nav { inset-inline: var(--gutter); } }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
}
.brand img { width: 34px; height: 34px; }

.nav__links {
  display: flex;
  gap: 2px;
  margin-left: auto;
  padding: 4px;
}
.nav__links a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-weight: 750;
  font-size: 0.96rem;
  color: var(--text-2);
  transition: color 0.2s, background-color 0.2s;
}
.nav__links a:hover { color: var(--text); background: var(--surface-3); }
.nav__links a[aria-current="true"] { color: var(--text); }
.nav__links a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 5px;
  height: 5px;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 899px) {
  .nav__links { display: none; }
}

/* 8. Footer ------------------------------------------------------------------------ */
.footer {
  padding-block: 56px 40px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: start;
}
.footer__claim { margin-top: 12px; color: var(--text-3); max-width: 34ch; }
.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 22px;
  font-weight: 750;
}
.footer__links a { color: var(--text-2); }
.footer__links a:hover { color: var(--accent-text); }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: var(--fs-small);
}
.footer__bottom a:hover { color: var(--text); }
@media (max-width: 700px) {
  .footer__grid { grid-template-columns: 1fr; }
  .footer__links { justify-content: flex-start; }
}

/* 9. Hilfsklassen ------------------------------------------------------------------ */
.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;
}
.only-desktop { display: none; }
@media (min-width: 900px) {
  .only-desktop { display: revert; }
  .only-mobile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
