/* Elke Knoke – Anæstesipraksis
   Mobile first. Values scale fluidly from the 430px mockup (iPhone 14 Pro Max)
   to the 1920px mockup (Web 1920): clamp(mobile, mobile + Δ · --fl, desktop). */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/cormorant-garamond-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/cormorant-garamond-400italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('assets/fonts/cormorant-garamond-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/inter-400.woff2') format('woff2');
}
/* Arabic letters only (unicode-range): downloaded just when the page is switched to Arabic */
@font-face {
  font-family: 'Noto Naskh Arabic';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/noto-naskh-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
  --fl: calc((100vw - 430px) / 1490); /* 0px at a 430px viewport → 1px at 1920px */

  --ink: #1b1b1b;
  --text: #4a4a4a;
  --text-dark: #2e2e2e;
  --muted: #555;
  --teal: #71d8d1;
  --band: #eeefe9;
  --gap: #f8f8f8;

  --serif: 'Cormorant Garamond', 'Noto Naskh Arabic', Garamond, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --fs-h1: clamp(28.5px, calc(28.5px + 8 * var(--fl)), 36.5px);
  --fs-h2: clamp(27.5px, calc(27.5px + 8.5 * var(--fl)), 36px);
  --fs-acc: clamp(23.3px, calc(23.3px + 7.2 * var(--fl)), 30.5px);
  --fs-intro: clamp(17.2px, calc(17.2px + 5.6 * var(--fl)), 22.8px);
  --fs-body: clamp(17px, calc(17px + 6 * var(--fl)), 23px);
  --fs-strong: clamp(18.8px, calc(18.8px + 5.8 * var(--fl)), 24.6px);
  --fs-foot: clamp(13.8px, calc(13.8px + 3.8 * var(--fl)), 17.6px);

  --inset: clamp(24px, 12.56vw, 54px);      /* text column, 54px at 430 */
  --head-inset: clamp(18px, 7vw, 30px);     /* accordion title, 30px at 430 */
  --chev-inset: clamp(12px, 4vw, 17px);     /* accordion chevron, 17px at 430 */

  --to-top-edge: clamp(12px, calc(12px + 28 * var(--fl)), 40px);
  --to-top-size: clamp(44px, calc(44px + 20 * var(--fl)), 64px);
}

/* Narrower than the mobile mockup: headings shrink with the viewport so they keep their line breaks. */
@media (max-width: 429.98px) {
  :root {
    --fs-h1: 6.63vw;
    --fs-h2: 6.4vw;
    --fs-acc: 5.2vw;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable; /* page doesn't shift sideways when the film overlay stops scrolling */
}

body {
  overflow-x: clip;
  font-family: var(--serif);
  font-size: var(--fs-body);
  font-variant-numeric: lining-nums;
  line-height: 1.3;
  color: var(--text);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
}

.col {
  width: min(700px, 100% - 2 * var(--inset));
  margin-inline: auto;
}

/* ---------- Header ---------- */

.site-header {
  position: relative;
  padding-top: clamp(8px, calc(8px + 12 * var(--fl)), 20px);
}

.logo {
  width: clamp(120px, calc(120px + 40 * var(--fl)), 160px);
  margin-inline: auto;
}

/* Language switcher in the top corner (script.js removes [hidden]) */
.lang {
  position: absolute;
  top: clamp(6px, calc(6px + 18 * var(--fl)), 24px);
  inset-inline-end: clamp(6px, calc(6px + 34 * var(--fl)), 40px);
  display: flex;
  font-family: var(--sans);
  font-size: clamp(12.5px, calc(12.5px + 3 * var(--fl)), 15.5px);
  line-height: 1;
}

.lang[hidden] {
  display: none;
}

.lang button {
  margin: 0;
  padding: 8px clamp(4px, calc(4px + 4 * var(--fl)), 8px);
  border: 0;
  border-radius: 4px;
  background: none;
  font: inherit;
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lang button:lang(ar) {
  letter-spacing: 0; /* spacing would break up the joined Arabic letters */
}

.lang button:hover,
.lang button[aria-pressed='true'] {
  color: var(--ink);
}

.lang button[aria-pressed='true'] {
  text-decoration-line: underline;
  text-decoration-color: var(--teal);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

.lang button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 0;
}

/* ---------- Intro ---------- */

.polaroid {
  margin-inline: auto;
}

.polaroid--hero {
  width: clamp(297px, calc(297px + 281 * var(--fl)), 578px);
  margin-top: clamp(49px, calc(49px + 33 * var(--fl)), 82px);
}

.quote {
  width: min(780px, 100% - 2 * clamp(16px, 9vw, 40px));
  margin: clamp(41.5px, calc(41.5px + 14.5 * var(--fl)), 56px) auto 0;
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: 1.16;
  color: var(--ink);
  text-align: center;
}

/* keeps "– alt" together so the mobile quote breaks before the dash */
.quote .nowrap {
  white-space: nowrap;
}

.intro__text {
  margin-top: 22px;
  font-size: var(--fs-intro);
  line-height: 1.25;
  color: var(--text-dark);
}

.arrow {
  width: clamp(32px, calc(32px + 9 * var(--fl)), 41px);
  margin: clamp(11px, calc(11px + 9.5 * var(--fl)), 20.5px) auto 0;
}

/* ---------- Section titles & portrait ---------- */

.section-title {
  width: calc(100% - 2 * clamp(10px, 4vw, 17px));
  margin-inline: auto;
  margin-bottom: clamp(14.5px, calc(14.5px + 6 * var(--fl)), 20.5px);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  text-align: center;
}

.info .section-title {
  margin-top: clamp(38.5px, calc(38.5px + 11 * var(--fl)), 49.5px);
}

.polaroid--portrait {
  width: clamp(307px, calc(307px + 213 * var(--fl)), 520px);
  margin-top: clamp(72px, calc(72px + 34 * var(--fl)), 106px);
}

.about .section-title {
  margin-top: clamp(40.5px, calc(40.5px + 17 * var(--fl)), 57.5px);
}

/* ---------- Accordion ---------- */

.acc {
  background: var(--band);
}

/* Light separator line between stacked bands */
.acc + .acc {
  border-top: clamp(7px, calc(7px + 1 * var(--fl)), 8px) solid var(--gap);
}

.acc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: clamp(60px, calc(60px + 21 * var(--fl)), 81px);
  padding-block: 8px;
  padding-inline: max(var(--head-inset), 50% - 350px) max(var(--chev-inset), 50% - 350px);
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.acc__head::-webkit-details-marker {
  display: none;
}

.acc__head:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: -4px;
}

.acc__title {
  font-size: var(--fs-acc);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.acc__chevron {
  flex: none;
  width: clamp(26px, calc(26px + 6 * var(--fl)), 32px);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.acc[open]:not(.is-closing) .acc__chevron {
  transform: rotate(180deg);
}

/* script.js closes an open section on click anywhere in its text */
.js .acc__body {
  cursor: pointer;
}

.acc__inner {
  padding-bottom: clamp(39px, calc(39px + 7 * var(--fl)), 46px);
}

.acc__inner--text {
  padding-top: clamp(0px, calc(17px - 17 * var(--fl)), 17px);
}

.acc__inner p + p {
  margin-top: clamp(22px, calc(22px + 6 * var(--fl)), 28px);
}

.acc__inner strong {
  font-size: var(--fs-strong);
  font-weight: 600;
  line-height: 1; /* larger bold text must not make its line taller */
}

.note {
  font-size: 1.03em;
  font-style: italic;
}

.link {
  font-style: italic;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.link:hover,
.contact a:hover,
.impressum a:hover,
.site-footer a:hover {
  color: var(--ink);
}

/* Illustration: fixed-height stage above the text, icon centred in it
   (the stage may be wider than the text column, e.g. the stethoscope on mobile). */
.acc__icon {
  --w: 200px;
  --iw: min(var(--w), 100vw - 24px);
  width: var(--iw);
  max-width: none;
  height: clamp(222px, calc(222px + 132.5 * var(--fl)), 354.5px);
  margin-inline: calc((100% - var(--iw)) / 2);
  object-fit: contain;
  object-position: 50% 42%;
}

.acc__icon--saft {
  --w: clamp(115px, calc(115px + 98 * var(--fl)), 213px);
  transform: translateX(clamp(-20px, calc(-20 * var(--fl)), 0px));
}

.acc__icon--stethoskop {
  --w: clamp(332px, calc(332px + 203 * var(--fl)), 535px);
}

.acc__icon--pflaster {
  --w: clamp(262px, calc(262px + 208 * var(--fl)), 470px);
  transform: translateX(-7%);
}

.acc__icon--handy {
  --w: clamp(118px, calc(118px + 59 * var(--fl)), 177px);
}

.contact {
  text-align: center;
}

.contact a {
  text-decoration: none;
}

.signature {
  width: clamp(200px, calc(200px + 100 * var(--fl)), 300px);
  height: auto;
  margin: clamp(33.5px, calc(33.5px + 1.5 * var(--fl)), 35px) auto -8px;
}

/* ---------- Privatlivspolitik (shown when the footer link targets it) ---------- */

.legal {
  display: none;
  /* space above the heading as padding, not as its margin: keeps the heading off the top edge
     after the jump and lets script.js collapse the section without a jump */
  padding-top: clamp(38.5px, calc(38.5px + 11 * var(--fl)), 49.5px);
}

.legal:target {
  display: block;
}

/* closed again with a click, like the accordions (script.js) */
.legal.is-closed {
  display: none;
}

.js .legal--closable {
  cursor: pointer;
}

.legal__body {
  background: var(--band);
}

.legal__inner {
  padding-block: clamp(39px, calc(39px + 7 * var(--fl)), 46px);
}

.legal__inner h3 {
  margin: 0;
  font-size: var(--fs-strong);
  font-weight: 600;
  line-height: 1.3;
}

.legal__inner p,
.legal__inner ul {
  margin: 0;
}

.legal__inner :is(p, ul, h3) + :is(p, ul, h3) {
  margin-top: clamp(22px, calc(22px + 6 * var(--fl)), 28px);
}

/* text directly under a sub-heading, like "Morgenmedicin:" in the accordions */
.legal__inner h3 + :is(p, ul) {
  margin-top: 0;
}

.legal__inner ul {
  padding-inline-start: 1.2em;
}

.legal__inner ul ul {
  margin-top: 0.3em;
}

.legal__inner li + li {
  margin-top: 0.3em;
}

/* Impressum: short, centred like the contact details */
.impressum {
  font-style: normal; /* <address> is italic by default */
  text-align: center;
}

.impressum strong {
  font-size: var(--fs-strong);
  font-weight: 600;
}

.impressum a {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* ---------- Footer ---------- */

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-top: clamp(31.5px, calc(31.5px + 99 * var(--fl)), 130.5px);
  padding-bottom: calc(clamp(5.5px, calc(5.5px + 14 * var(--fl)), 19.5px) + env(safe-area-inset-bottom, 0px));
  padding-inline: clamp(0px, calc(4px - 4 * var(--fl)), 4px);
  font-family: var(--sans);
  font-size: var(--fs-foot);
  line-height: 1.2;
  color: var(--muted);
}

.site-footer a {
  justify-self: start;
  text-decoration: none;
}

.site-footer a:last-child {
  justify-self: end;
}

.site-footer__sparkle {
  width: clamp(50px, calc(50px + 17 * var(--fl)), 67px);
}

/* ---------- Til toppen ---------- */

.site-header:focus {
  outline: none; /* focus target for "til toppen", not interactive itself */
}

.to-top {
  position: fixed;
  right: calc(var(--to-top-edge) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--to-top-edge) + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  width: var(--to-top-size);
  border-radius: 50%;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
  -webkit-tap-highlight-color: transparent;
}

/* With JS the button only appears after scrolling down; without JS it is always there. */
.js .to-top:not(.is-visible) {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.to-top svg {
  display: block;
  width: 100%;
  height: auto;
}

.to-top__bg {
  fill: var(--band); /* same as the question tiles */
}

.to-top__arrow {
  fill: var(--teal);
}

.to-top:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

/* Narrow screens: the fixed button would cover "Privatlivspolitik" at the very bottom,
   so the page ends with room for the button below the footer links. */
@media (max-width: 880px) {
  .site-footer {
    padding-bottom: calc(var(--to-top-edge) + var(--to-top-size) + 8px + env(safe-area-inset-bottom, 0px));
  }
}

/* ---------- Film overlay (script.js) ---------- */

/* The Finn film is square (1080 × 1080): as big as the screen allows, with room above for the ✕ */
.video-dialog {
  width: min(1080px, 100vw - 32px, 100vh - 136px);
  width: min(1080px, 100vw - 32px, 100dvh - 136px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.video-dialog::backdrop {
  background: rgb(27 27 27 / 0.85); /* --ink */
}

/* the page behind stays put while the film is open */
html:has(.video-dialog[open]) {
  overflow: hidden;
}

.video-dialog__video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 4px;
  background: #000;
}

/* ✕ sits just above the film's top corner (left in Arabic) */
.video-dialog__close {
  position: absolute;
  bottom: calc(100% + 12px);
  inset-inline-end: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--band);
  color: var(--ink);
  cursor: pointer;
}

.video-dialog__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.video-dialog__close:hover {
  background: var(--teal);
}

.video-dialog__close:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

/* ---------- Other languages (script.js + i18n.js) ---------- */

/* opened with ?lang=…: invisible for the moment until the text is swapped (see index.html) */
.i18n-wait body {
  visibility: hidden;
}

/* Arabic reads right to left: flex rows, footer and paddings already follow via logical properties */
[dir='rtl'] .to-top {
  right: auto;
  left: calc(var(--to-top-edge) + env(safe-area-inset-left, 0px));
}

/* Arabic script needs more room between lines than the Latin serif */
html[lang='ar'] body,
html[lang='ar'] .intro__text {
  line-height: 1.7;
}

html[lang='ar'] :is(.quote, .section-title, .acc__title, .legal__inner h3) {
  line-height: 1.5;
}

/* Arabic has no italics; the browser would only slant the letters */
html[lang='ar'] :is(.note, .link, em) {
  font-style: normal;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .acc__chevron,
  .to-top {
    transition: none;
  }
}

/* ---------- Print (script.js opens every section first) ---------- */

@media print {
  .lang,
  .to-top,
  .video-dialog,
  .acc__chevron {
    display: none !important;
  }

  .acc__head {
    break-after: avoid;
  }

  .acc__inner p {
    break-inside: avoid;
  }
}
