/* ============================================================
   Praxis Dr. Nazary — v4 "Rasterbau"
   Swiss International Style · visible grid · hairlines · cold blue
   ============================================================ */

:root {
  --paper: #F4F8FC;
  --ink: #0A1A2E;
  --blue-700: #1B4E8A;
  --blue-300: #A9CCEA;
  --blue-100: #DDEAF6;
  --pulse: #4D9DE8; /* Signalblau — EKG trace, status dots, CTA */
  --line: #BFD3E4;

  --rail-w: 56px;
  --rail-h-mobile: 40px;

  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
  --head: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --ease: 150ms ease-out;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
}

::selection { background: var(--blue-300); color: var(--ink); }

a { color: var(--blue-700); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--pulse); outline-offset: 2px; }

.mono { font-family: var(--mono); font-weight: 400; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

h1, h2, h3 {
  font-family: var(--head);
  font-stretch: 112.5%; /* SemiExpanded */
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-align: left;
}

h2 { font-size: clamp(30px, 4.4vw, 46px); margin-bottom: 40px; }
h3 { font-size: 19px; font-weight: 600; line-height: 1.2; }

/* ============================================================
   EKG rail — the vertical "Lebenslinie"
   ============================================================ */

.ekg-rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  background: var(--paper);
  z-index: 200;
  overflow: hidden;
}

/* Monitor principle: the trace stands still, the pulse travels along it.
   Geometry is generated by JS in real pixels (no viewBox stretching). */
.ekg-ghost, .ekg-pulse {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
.ekg-ghost polyline, .ekg-pulse polyline {
  fill: none;
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ekg-ghost polyline { stroke: var(--blue-300); opacity: .6; }
.ekg-pulse polyline {
  stroke: var(--pulse);
  stroke-width: 2;
  stroke-dasharray: 14 86;           /* bright segment travelling the trace */
  animation: ekg-travel 1s linear infinite;  /* 1 full pass/second = 60 BPM */
}
@keyframes ekg-travel { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

.ekg-bpm {
  position: absolute;
  left: 0; bottom: 10px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: var(--paper);
  padding-top: 6px;
}
.ekg-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--pulse);
}

/* page offset for the rail */
.page { margin-left: var(--rail-w); }

/* ============================================================
   Notfall block (below Sprechzeiten)
   ============================================================ */

.notfall {
  margin-top: 48px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: 0 1px 2px rgba(10,26,46,.04), 0 10px 28px rgba(10,26,46,.05);
}
.notfall h3 { margin-bottom: 10px; }
.notfall p { max-width: 62ch; color: rgba(10, 26, 46, .78); }
.notfall dl { margin-top: 24px; display: grid; gap: 6px; }
.notfall dl div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
}
.notfall dt { font-size: 13px; color: rgba(10, 26, 46, .7); }
.notfall dd { font-size: 15px; }
.notfall dd a { color: var(--blue-700); text-decoration: none; font-weight: 500; }
.notfall dd a:hover { text-decoration: underline; }

/* ============================================================
   Header
   ============================================================ */

.site-header {
  position: fixed;
  top: 0; left: var(--rail-w); right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 40px;
  height: 64px;
  color: #fff;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.site-header.scrolled {
  background: var(--paper);
  color: var(--ink);
  border-bottom-color: var(--line);
}

.wordmark {
  font-family: var(--head);
  font-stretch: 112.5%;
  font-weight: 700;
  font-size: 16px;
  color: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.wordmark span { font-family: var(--sans); font-weight: 400; font-size: 13px; opacity: .8; }
.brand-mark { width: 20px; height: 20px; flex: 0 0 auto }
.brand-mark circle { fill: #3FB2A8; transition: fill var(--ease) }
.site-header.scrolled .brand-mark circle { fill: #0E7C7B }
.wordmark:hover { text-decoration: none; }

.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a {
  color: inherit;
  font-size: 15px;
  font-weight: 500;
}
.site-nav a:hover { color: var(--pulse); text-decoration: none; }
.site-header.scrolled .site-nav a:hover { color: var(--blue-700); }

.header-phone {
  font-family: var(--mono);
  font-size: 14px;
  color: inherit;
  white-space: nowrap;
}

/* ============================================================
   Hero
   ============================================================ */

.hero { position: relative; height: 92vh; min-height: 540px; overflow: hidden; }

.hero-photo {
  position: absolute; inset: 0;
  background-color: #0A1A2E;
  background-size: cover;
  background-position: center;
  filter: saturate(.85);
}

.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(10,26,46,.55) 0%,
      rgba(10,26,46,.18) 12%,
      transparent 24%),
    linear-gradient(to top,
      rgba(10,26,46,.88) 0%,
      rgba(10,26,46,.42) 45%,
      transparent 78%);
  pointer-events: none;
}

.hero-content {
  position: absolute;
  left: 40px; right: 40px; bottom: 56px;
  color: #fff;
  max-width: 860px;
}
.hero-content h1 {
  font-size: clamp(36px, 5.4vw, 64px);
  margin-bottom: 18px;
}
.hero-sub { font-size: 17px; opacity: .92; max-width: 640px; }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 26px;
  border-radius: 12px;
  border: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.btn:hover { text-decoration: none; }

.btn-pulse { background: var(--pulse); color: var(--ink); }
.btn-pulse:hover { background: #63ACEC; }

.btn-outline {
  color: #fff;
  background: rgba(255,255,255,.14);
  font-size: 15px;
}
.btn-outline:hover { background: rgba(255,255,255,.24); }

.hero-note { margin-top: 20px; font-size: 14px; opacity: .78; }

/* ============================================================
   Sections
   ============================================================ */

.section { padding: 96px 40px; max-width: 1240px; }

.band {
  background: var(--blue-100);
  max-width: none;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.band > * { max-width: 1160px; }

/* --- Praxis: 5/7 split --- */
.split {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.split-left { padding: 44px 44px 44px 0; }
.split-left h2 { margin-bottom: 36px; }

.facts { border-top: 1px solid var(--line); font-size: 14px; }
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--blue-700); }
.facts dd { text-align: right; }

.split-right {
  padding: 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
}
.tint { background: var(--blue-100); border-radius: 16px; }

/* --- Leistungen: 3x2 cards --- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 30px;
  box-shadow: 0 1px 2px rgba(10,26,46,.04), 0 10px 28px rgba(10,26,46,.05);
  transition: box-shadow var(--ease), transform var(--ease);
}
.card:hover {
  box-shadow: 0 2px 4px rgba(10,26,46,.05), 0 16px 36px rgba(10,26,46,.09);
  transform: translateY(-2px);
}
.card h3 { margin-bottom: 12px; }
.card p { font-size: 15px; line-height: 1.55; }

/* --- Team --- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  background-color: #10345E;
  background-size: cover;
  background-position: center;
  border-radius: 16px;
  overflow: hidden;
  filter: saturate(.85);
}

.member figcaption { padding-top: 14px; }
.member strong { display: block; font-weight: 500; font-size: 16px; }
.member figcaption span { display: block; font-size: 14px; color: var(--blue-700); }

/* --- Anfahrt / Karte --- */
.map {
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 24px;
  align-items: stretch;
}
.map-frame {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(10,26,46,.04), 0 10px 28px rgba(10,26,46,.05);
  min-height: 380px;
}
.map-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 380px;
  border: 0;
}
.map-info {
  background: #fff;
  border-radius: 16px;
  padding: 32px 30px;
  box-shadow: 0 1px 2px rgba(10,26,46,.04), 0 10px 28px rgba(10,26,46,.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.map-info strong { font-weight: 600; font-size: 17px; }
.map-info .map-hint { margin-top: 8px; font-size: 14px; color: var(--blue-700); }
.btn-route {
  margin-top: auto;
  align-self: flex-start;
  background: var(--ink);
  color: #fff;
}
.btn-route:hover { background: var(--blue-700); }
@media (max-width: 760px) {
  .map { grid-template-columns: 1fr; }
  .btn-route { margin-top: 20px; }
}

/* --- Sprechzeiten --- */
.hours {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.hours th, .hours td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 400;
}
.hours tbody tr:first-child th,
.hours tbody tr:first-child td { border-top: 1px solid var(--line); }
.hours th[scope="row"] { width: 120px; color: var(--blue-700); }
.hours .closed { color: rgba(10,26,46,.5); }
.hours .closed th[scope="row"] { color: rgba(27,78,138,.5); }

.hours tr.today { background: var(--blue-100); }
.hours tr.today th[scope="row"] { position: relative; }
.hours .open-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 10px;
  border-radius: 999px;
  background: var(--pulse);
  vertical-align: 1px;
}

/* --- Terminanfrage --- */
.booking {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 40px;
  margin-bottom: 56px;
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-head {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue-700);
  text-align: center;
  padding: 4px 0 8px;
}

.cal-day {
  appearance: none;
  border: none;
  border-radius: 10px;
  background: #fff;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  padding: 10px 2px;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
  transition: background var(--ease), border-color var(--ease);
}
.cal-day small { display: block; font-size: 10px; color: var(--blue-700); }
.cal-day:hover:not(:disabled) { background: var(--blue-300); }
.cal-day:disabled {
  color: var(--line);
  background: transparent;
  cursor: not-allowed;
}
.cal-day:disabled small { color: var(--line); }
.cal-day.selected { background: var(--ink); color: #fff; }
.cal-day.selected small { color: var(--blue-300); }

.slots-title { font-size: 13px; margin-bottom: 16px; color: var(--blue-700); }

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.slot {
  appearance: none;
  border: none;
  border-radius: 10px;
  background: #fff;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  padding: 9px 4px;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
}
.slot:hover:not(:disabled) { background: var(--blue-300); }
.slot:disabled {
  color: var(--line);
  background: transparent;
  cursor: not-allowed;
}
.slot.selected { background: var(--ink); color: #fff; }

.booking-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
  max-width: 760px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 500; }

.field input,
.field textarea {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 14px;
}
.field input:focus,
.field textarea:focus { outline: 2px solid var(--pulse); outline-offset: 0; }
.field textarea { resize: vertical; }

.btn-submit { background: var(--ink); color: #fff; }
.btn-submit:hover { background: var(--blue-700); }

.helper { font-size: 13px; color: var(--blue-700); margin-top: 10px; }

.form-error {
  grid-column: 1 / -1;
  color: #B4322A;
  font-size: 14px;
}

.confirmation:not(:empty) {
  max-width: 760px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  box-shadow: 0 1px 2px rgba(10,26,46,.04), 0 10px 28px rgba(10,26,46,.05);
}
.confirmation h3 { margin-bottom: 14px; }
.confirmation dl div {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  font-size: 15px;
}
.confirmation dt { font-family: var(--mono); width: 110px; flex-shrink: 0; color: var(--blue-700); }
.confirmation .confirm-note { margin-top: 16px; font-size: 14px; }
.confirmation .confirm-note a { font-family: var(--mono); }

/* ============================================================
   Footer
   ============================================================ */

.footer {
  background: var(--ink);
  color: #fff;
  padding: 72px 40px 40px;
}
.footer a { color: var(--blue-300); }

.footer-ekg {
  display: block;
  width: 100%;
  max-width: 1160px;
  height: 40px;
  margin-bottom: 48px;
}
.footer-ekg polyline {
  fill: none;
  stroke: var(--pulse);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 900;
  stroke-dashoffset: 0;
}
.footer-ekg.pulse polyline { animation: footer-pulse 1.4s ease-out 1 both; }
@keyframes footer-pulse {
  from { stroke-dashoffset: 900; }
  to { stroke-dashoffset: 0; }
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  max-width: 760px;
  font-size: 15px;
}
.footer-cols p { margin-bottom: 10px; }
.footer-cols .mono { font-size: 14px; }

.copyright {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid rgba(191,211,228,.25);
  font-size: 13px;
  color: rgba(255,255,255,.6);
}

/* ============================================================
   Scroll reveal
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .45s ease-out, transform .45s ease-out;
}
.reveal.in { opacity: 1; transform: none; }

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

@media (max-width: 980px) {
  .cards, .team-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .split-left { border-right: none; padding-right: 0; }
  .booking { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}

@media (max-width: 760px) {
  :root { --rail-w: 0px; }

  .page { margin-left: 0; padding-bottom: calc(var(--rail-h-mobile) + env(safe-area-inset-bottom, 0px)); }

  /* rail becomes a bottom strip; lifted above the iPhone home-indicator /
     rounded-corner zone via safe-area inset */
  .ekg-rail {
    top: auto; left: 0; right: 0;
    bottom: env(safe-area-inset-bottom, 0px);
    width: auto;
    height: var(--rail-h-mobile);
  }
  /* opaque continuation below the strip so content never peeks through the gap */
  .ekg-rail::after {
    content: "";
    position: absolute;
    top: 100%; left: 0; right: 0;
    height: env(safe-area-inset-bottom, 0px);
    background: var(--paper);
  }
  .ekg-bpm {
    left: auto; bottom: 0; top: 0;
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: auto;
    flex-direction: row;
    align-items: center;
    padding: 0 4px;
  }

  .site-header { left: 0; padding: 0 20px; }
  .hero-content { left: 20px; right: 20px; bottom: 84px; }
  .section { padding: 72px 20px; }
  .cards, .team-grid { grid-template-columns: 1fr; }
  .booking-form { grid-template-columns: 1fr; }
  .split-right { padding: 32px 24px; }
  .footer { padding: 56px 20px 32px; }
  .footer-cols { grid-template-columns: 1fr; }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ekg-pulse { display: none; }
  .footer-ekg.pulse polyline { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .ekg-pulse polyline { animation: none !important; }
}
