/* Gesundheitsnet – QR landing page (layout.md v1.0)
   Palette: white #FFFFFF · petrol #123847 · turquoise #087E79 · mint #E9F7F5 · border #D9E7E8 · text #405968 */
:root {
  --petrol: #123847;
  --turquoise: #087e79;        /* white text on it: 5.0:1 */
  --turquoise-hover: #066a66;
  --turquoise-active: #055753;
  --turquoise-light: #42c9c5;
  --mint: #e9f7f5;
  --line: #d9e7e8;
  --text: #405968;             /* on white: 7.0:1 */
  --surface-soft: #f4f9f9;
  --error: #b42318;

  /* legacy token names used by the calculator dialogs */
  --background: #ffffff;
  --foreground: var(--petrol);
  --muted: var(--mint);
  --muted-foreground: var(--text);
  --border: var(--line);
  --input: #b9cdd0;
  --card: #ffffff;
  --action: var(--turquoise);
  --action-foreground: #ffffff;
  --destructive: var(--error);
  --ring: #1a5fd0;
  --radius: 12px;

  --font-heading: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --gutter: 20px;
}
@media (min-width: 768px) { :root { --gutter: 32px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { font-family: var(--font-heading); color: var(--petrol); letter-spacing: -0.01em; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: var(--turquoise); text-underline-offset: 0.18em; }
a:hover { color: var(--turquoise-hover); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.container {
  width: 100%;
  max-width: calc(1120px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 10;
  padding: 0.5rem 1rem; border-radius: 8px; background: #fff; color: var(--petrol); font-weight: 600;
}
.skip-link:focus { top: 0.5rem; }
.icon { flex: none; }

/* ---------- Header ---------- */
.site-header { background: #fff; }
.site-header__inner { display: flex; align-items: center; min-height: 64px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { width: 168px; height: auto; }
@media (min-width: 768px) { .brand img { width: 200px; } }

/* ---------- Hero ---------- */
.hero {
  padding-block: 8px 32px;
  background:
    radial-gradient(60rem 28rem at 100% 0%, rgba(233, 247, 245, 0.95), rgba(233, 247, 245, 0) 70%),
    #fff;
}
.hero__inner { display: grid; align-items: center; gap: 24px; padding-block: 16px 24px; }
.hero__title {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.hero__underline { position: relative; display: inline-block; }
.hero__underline::after {
  content: "";
  position: absolute;
  left: 4%;
  right: -8%;
  bottom: -0.16em;
  height: 0.12em;
  min-height: 4px;
  border-radius: 999px;
  background: var(--turquoise-light);
  opacity: 0.8;
}
.hero__lead {
  margin-top: 16px;
  max-width: 34rem;
  font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem);
  line-height: 1.5;
  color: var(--text);
}
.hero__art { display: none; }
@media (min-width: 1024px) {
  .hero { padding-block: 16px 48px; }
  .hero__inner { grid-template-columns: minmax(0, 1fr) 320px; padding-block: 24px 32px; }
  .hero__art { display: block; width: 320px; height: auto; justify-self: end; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.btn--primary, .btn--action {
  background: var(--turquoise);
  color: #fff;
  box-shadow: 0 6px 16px rgba(8, 126, 121, 0.22);
}
.btn--primary:hover, .btn--action:hover { background: var(--turquoise-hover); color: #fff; }
.btn--primary:active, .btn--action:active { background: var(--turquoise-active); box-shadow: none; }
.btn--outline { background: #fff; color: var(--petrol); border-color: var(--petrol); }
.btn--outline:hover { background: var(--mint); color: var(--petrol); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn .icon { transition: transform 150ms ease; }
.btn:hover .icon { transform: translateX(2px); }

/* ---------- Action cards ---------- */
.actions { display: grid; gap: 16px; }
@media (min-width: 768px) { .actions { grid-template-columns: repeat(2, minmax(300px, 1fr)); gap: 24px; } }
.action-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(18, 56, 71, 0.06);
}
@media (min-width: 768px) { .action-card { padding: 24px; } }
.action-card--primary {
  background: linear-gradient(180deg, #f3fbfa 0%, #fff 100%);
  border-color: #a9dcd8;
}
.action-card__head { display: flex; gap: 16px; align-items: flex-start; }
.action-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--mint);
  color: var(--turquoise);
}
@media (min-width: 768px) { .action-card__icon { width: 64px; height: 64px; } }
.action-card__title { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem); line-height: 1.2; font-weight: 800; }
.action-card__text { margin-top: 6px; color: var(--text); }
.action-card__btn { margin-top: auto; }
.action-card__direct { margin-top: -8px; text-align: center; font-size: 0.9375rem; }
.action-card__direct[hidden] { display: none; }
.action-card__direct a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
/* Desktop/tablet: share row tracks so both buttons sit at the same height. */
@supports (grid-template-rows: subgrid) {
  @media (min-width: 768px) {
    .actions { grid-template-rows: auto auto auto; row-gap: 0; }
    .action-card { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 20px; }
    .action-card__btn { margin-top: 0; align-self: end; }
    .action-card__direct { margin-top: -8px; }
  }
}

/* ---------- Beratung ---------- */
#beratung { scroll-margin-top: 16px; }
.beratung {
  display: grid;
  gap: 24px;
  margin-block: 32px 48px;
  padding: 24px 20px;
  border-radius: 20px;
  background: var(--surface-soft);
  border: 1px solid #e6efef;
  transition: box-shadow 300ms ease;
}
@media (min-width: 768px) { .beratung { padding: 32px; margin-block: 40px 56px; } }
@media (min-width: 1024px) {
  .beratung { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; padding: 40px; }
}
.beratung__title { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); line-height: 1.2; font-weight: 800; }
.beratung__title:focus { outline: none; }
.beratung__title:focus-visible { outline: 3px solid var(--ring); outline-offset: 4px; border-radius: 4px; }
.beratung__text { margin-top: 12px; font-size: 1.0625rem; max-width: 26rem; }
.beratung-highlight { box-shadow: 0 0 0 3px var(--turquoise-light); }

.test-banner {
  margin-top: 20px;
  padding: 12px 16px;
  border-left: 4px solid var(--error);
  border-radius: 0 8px 8px 0;
  background: #fff;
  font-size: 0.875rem;
}
.test-banner__title { font-weight: 700; color: var(--petrol); }
.test-banner__text { margin-top: 2px; }

/* ---------- Form ---------- */
.form { display: grid; gap: 20px; }
.form__grid { display: grid; gap: 16px; }
@media (min-width: 560px) { .form__grid { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 0.9375rem; font-weight: 600; color: var(--petrol); }
.req { color: var(--turquoise); }
.field__optional { font-weight: 400; color: var(--text); }
input[type="text"], input[type="tel"], input[type="email"] {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--input);
  border-radius: 10px;
  background: #fff;
  color: var(--petrol);
  font-size: 1rem; /* ≥16px avoids iOS zoom */
}
input[type="text"]:hover, input[type="tel"]:hover, input[type="email"]:hover { border-color: #8fb0b4; }
input[type="text"]:focus-visible, input[type="tel"]:focus-visible, input[type="email"]:focus-visible {
  outline: none;
  border-color: var(--turquoise);
  box-shadow: 0 0 0 3px rgba(8, 126, 121, 0.25);
}
input[aria-invalid="true"] { border-color: var(--error); }
.field__error { font-size: 0.875rem; font-weight: 600; color: var(--error); }
.field__error[hidden] { display: none; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.consent { display: grid; gap: 10px; padding-top: 4px; }
.consent__text { font-size: 0.875rem; line-height: 1.55; }
.checkbox { display: flex; align-items: flex-start; gap: 12px; }
.checkbox input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--turquoise); cursor: pointer; }
.checkbox input[aria-invalid="true"] { outline: 2px solid var(--error); outline-offset: 2px; }
.checkbox label { font-size: 0.9375rem; font-weight: 600; color: var(--petrol); cursor: pointer; }
.form__note { font-size: 0.8125rem; }

.submit-btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.submit-btn.is-loading .submit-btn__spinner { display: inline-block; }
.submit-btn.is-loading .submit-btn__arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-summary {
  margin-bottom: 20px;
  padding: 16px;
  border: 2px solid var(--error);
  border-radius: 10px;
  background: #fff;
}
.error-summary__title { font-size: 1rem; color: var(--error); margin-bottom: 4px; }
.error-summary__list { padding-left: 1.25rem; }
.error-summary__list a { color: var(--error); font-weight: 600; }

.form-status:empty { display: none; }
.form-status { padding: 12px 16px; border-radius: 10px; font-size: 0.9375rem; font-weight: 600; }
.form-status--error { border: 1px solid var(--error); color: var(--error); background: #fff; }
.form-status--info { border-left: 4px solid var(--error); background: #fff; color: var(--petrol); }

.success { padding: 24px; border-radius: 14px; background: var(--mint); border: 1px solid #bfe5e1; }
.success[hidden] { display: none; }
.success__title { font-family: var(--font-heading); font-weight: 700; font-size: 1.125rem; color: var(--petrol); }

/* ---------- Thank-you view (user-reported Allianz completion) ---------- */
.thankyou { max-width: 42rem; padding-block: 32px 64px; }
.thankyou[hidden] { display: none; }
.thankyou h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); line-height: 1.15; font-weight: 800; }
.thankyou h1:focus { outline: none; }
.thankyou__cta { margin-top: 28px; }
@media (min-width: 560px) { .thankyou__cta { width: auto; } }
.page.is-thankyou > :not(.thankyou-wrap) { display: none !important; }

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 24px max(24px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  text-align: center;
}
.site-footer__links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 4px;
}
.site-footer__links li { display: inline-flex; align-items: center; min-height: 44px; }
.site-footer__links li + li::before { content: "|"; margin-right: 12px; margin-left: 8px; color: var(--line); }
.site-footer__links a { color: var(--turquoise); }
.site-footer__note { margin-top: 4px; font-size: 0.75rem; }
@media (max-width: 479px) {
  .site-footer__links { gap: 0 24px; }
  .site-footer__links li:first-child { flex-basis: 100%; justify-content: center; }
  .site-footer__links li + li::before { content: none; }
}

/* ---------- Legal placeholder pages ---------- */
.legal { padding-block: 24px 64px; max-width: 46rem; }
.legal h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 800; margin-bottom: 16px; }
.legal h2 { font-size: 1.25rem; margin: 28px 0 8px; }
.legal .todo { background: #fff3c4; color: #5c3d00; border-radius: 4px; padding: 0 4px; }

/* ===================== Allianz calculator dialog ===================== */
/* Mobile first: full screen */
.calc-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--card);
  color: var(--foreground);
  overflow: hidden;
}
.calc-dialog[open] { display: flex; flex-direction: column; }
.calc-dialog::backdrop { background: rgba(10, 29, 38, 0.6); }

.calc-dialog__header {
  position: sticky;
  top: 0;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 56px;
  padding: env(safe-area-inset-top, 0px) max(0.5rem, env(safe-area-inset-right, 0px)) 0 max(1rem, env(safe-area-inset-left, 0px));
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}
.calc-dialog__title {
  flex: 1;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calc-dialog__icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.625rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.calc-dialog__icon-btn:hover { background: rgba(21, 58, 74, 0.08); color: var(--foreground); }
.calc-dialog__ext-label { display: none; }

.calc-dialog__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--background);
  overflow: hidden;
}
.calc-dialog__body iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.calc-dialog__loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted-foreground);
  background: var(--background);
}
.calc-dialog__loading[hidden] { display: none; }
.calc-dialog__spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--foreground);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.calc-dialog__fallback {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 26rem;
  color: var(--foreground);
}
.calc-dialog__fallback[hidden] { display: none; }

.calc-dialog__footer {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.375rem max(1rem, env(safe-area-inset-right, 0px)) max(0.375rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--border);
  background: var(--card);
}
.calc-dialog__privacy { display: none; font-size: 0.8125rem; color: var(--muted-foreground); }
.calc-dialog__actions {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.calc-dialog__direct {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 600;
}
.calc-dialog__back.btn { width: auto; min-height: 44px; padding: 0.5rem 1rem; font-size: 0.875rem; }

/* Desktop: centred overlay */
@media (min-width: 768px) {
  .calc-dialog {
    width: max(800px, 90vw);
    max-width: calc(100vw - 32px); /* keeps a margin on 768–830px screens */
    height: min(92vh, 950px);
    height: min(92dvh, 950px);
    max-height: none;
    margin: auto;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(10, 29, 38, 0.28), 0 2px 8px rgba(10, 29, 38, 0.12);
  }
  .calc-dialog__header { padding: 0 0.75rem 0 1.5rem; min-height: 60px; }
  .calc-dialog__title { font-size: 1.125rem; }
  .calc-dialog__ext-label { display: inline; }
  .calc-dialog__footer { padding: 0.625rem 1.5rem; }
  .calc-dialog__privacy { display: block; }
  .calc-dialog__actions { flex: none; }
  .calc-dialog__direct { display: none; } /* already in header on desktop */
}

/* Exit decision (feature_flow.md): centred on desktop, bottom sheet on mobile */
.calc-exit {
  width: min(540px, calc(100vw - 32px));
  max-height: 90vh;
  max-height: 90dvh;
  padding: 1.5rem;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 20px 48px rgba(10, 29, 38, 0.24);
  overflow: auto;
  overscroll-behavior: contain;
}
.calc-exit::backdrop { background: rgba(10, 29, 38, 0.45); }
.calc-exit__title { font-size: 1.375rem; line-height: 1.3; font-weight: 600; }
.calc-exit__title:focus { outline: none; }
.calc-exit__title:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (min-width: 768px) { .calc-exit__title { font-size: 1.5rem; } }
.calc-exit__text { margin-top: 0.75rem; line-height: 1.55; color: var(--muted-foreground); }
.calc-exit__options { display: grid; gap: 0.75rem; margin-top: 1.5rem; }
.calc-exit__option { display: grid; gap: 0.25rem; }
.calc-exit__btn.btn { width: 100%; min-height: 48px; }
.calc-exit__hint { font-size: 0.875rem; line-height: 1.45; color: var(--muted-foreground); }
.calc-exit__option--quiet { justify-items: center; margin-top: 0.25rem; }
.calc-exit__text-btn {
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.calc-exit__text-btn:hover { background: var(--muted); }
@media (max-width: 767px) {
  .calc-exit {
    margin: auto auto max(16px, env(safe-area-inset-bottom, 0px));
    padding: 1.25rem 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px));
  }
}


/* Background scroll lock while the dialog is open (scroll position restored in JS) */
html.calc-scroll-lock { overflow: hidden; }
html.calc-scroll-lock body { position: fixed; left: 0; right: 0; overflow: hidden; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) { .btn { border: 2px solid ButtonText; } }
