/* ==========================================================================
   Poradnia Rodzinna Eskulap – arkusz stylów
   Koncepcja: jasna, spokojna strona "jak dobrze oznakowana poczekalnia" –
   najważniejsze informacje (telefon, godziny, adres) zawsze na wierzchu,
   łuki z logo jako jedyny mocny akcent graficzny.
   Cel dostępności: WCAG 2.1 poziom AA (kontrast tekstu min. 4.5:1).
   ========================================================================== */

:root {
  /* Kolory – kontrasty liczone względem --surface (#fff) */
  --bg: #F5F9FC;          /* tło strony, lekko niebieskie */
  --surface: #FFFFFF;     /* karty, sekcje */
  --tint: #E6F1FA;        /* jasny błękit z logo, tło akcentowe */
  --ink: #17324A;         /* tekst główny (12.9:1) */
  --muted: #465A6C;       /* tekst drugorzędny (7.1:1) */
  --brand: #1F5F8B;       /* linki, przyciski (6.6:1; biały tekst na nim 6.6:1) */
  --brand-dark: #154566;  /* hover */
  --line: #C9D8E5;        /* obramowania */
  --sun: #FBD700;         /* żółty z logo – tylko dekoracja i obrys fokusu */
  --amber: #E5750A;       /* pomarańczowy z logo – tylko dekoracja */
  --focus: #0B2A40;

  /* Typografia */
  --font-display: "Lexend", "Atkinson Hyperlegible Next", Arial, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, Arial, sans-serif;
  --step--1: 0.9375rem;
  --step-0: 1.0625rem;    /* 17 px bazowo – czytelniej niż 16 */
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: clamp(1.9rem, 1.4rem + 2.2vw, 2.75rem);

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1160px;
  color-scheme: light;
}

/* Powiększenie tekstu (przyciski A / A+ / A++) – wszystko w rem, więc skaluje się całość */
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html[data-font="2"] { font-size: 112.5%; }
html[data-font="3"] { font-size: 128%; }

/* Wysoki kontrast (przycisk w pasku dostępności) */
html[data-contrast="high"] {
  --bg: #000; --surface: #000; --tint: #000;
  --ink: #FFF; --muted: #FFF; --brand: #FFEB3B; --brand-dark: #FFF;
  --line: #FFF; --focus: #FFEB3B;
  color-scheme: dark;
}
html[data-contrast="high"] img.znak { filter: grayscale(1) brightness(1.6); }
html[data-contrast="high"] .deco { display: none; }
html[data-contrast="high"] .btn-primary { color: #000; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 600;
  text-wrap: balance;
  margin: 0 0 .5em;
}
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; max-width: 68ch; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }

/* Wyraźny fokus klawiatury – żółty obrys + ciemna obwódka widoczna na każdym tle */
:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus);
  border-radius: 4px;
}

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

.nw { white-space: nowrap; }
@media (max-width: 1320px) { .topbar-info .hide-md { display: none; } }
@media (max-width: 1180px) { .topbar-info .hide-lg { display: none; } }
html[data-font="2"] .topbar-info .hide-lg, html[data-font="3"] .topbar-info .hide-lg { display: none; }

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

/* Link „przejdź do treści” – pierwszy element dla klawiatury i czytnika ekranu */
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--brand); color: #fff; padding: .75rem 1rem; border-radius: 8px;
  font-weight: 700;
}
.skip-link:focus { top: 12px; color: #fff; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Pasek górny: kontakt + narzędzia dostępności ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  font-size: var(--step--1);
}
html[data-contrast="high"] .topbar { background: #000; border-bottom: 2px solid #fff; }
.topbar .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1.5rem; padding-block: .4rem;
}
.topbar a { color: #fff; }
html[data-contrast="high"] .topbar a { color: var(--brand); }
.topbar-info { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.a11y-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-left: auto; }
.a11y-tools .label { font-weight: 700; margin-right: .2rem; white-space: nowrap; }
.a11y-tools button {
  font: inherit; font-weight: 700; min-width: 40px; min-height: 36px;
  padding: .2rem .65rem; border-radius: 8px; cursor: pointer; white-space: nowrap; flex: none;
  background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.55);
}
.a11y-tools .tool-btn { display: inline-flex; align-items: center; gap: .4rem; }
.a11y-tools .tool-btn svg { width: 1.05em; height: 1.05em; flex: none; }
.a11y-tools button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: #fff; }
html[data-contrast="high"] .a11y-tools button { color: var(--brand); border-color: var(--brand); }
html[data-contrast="high"] .a11y-tools button[aria-pressed="true"] { background: var(--brand); color: #000; }
.fs-group { display: inline-flex; gap: .3rem; padding-left: .6rem; margin-left: .2rem; border-left: 1px solid rgba(255,255,255,.3); }
.a11y-tools button.fs-2 { font-size: 1.1em; }
.a11y-tools button.fs-3 { font-size: 1.25em; }

/* ---------- Nagłówek i nawigacja ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding-block: .6rem;
}
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand img.znak { width: 64px; height: auto; flex: none; }
.brand-text { display: grid; line-height: 1.1; }
.brand-text small {
  font-family: var(--font-display); font-size: .75rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand); font-weight: 500; white-space: nowrap;
}
.brand-text strong { font-family: var(--font-display); font-size: 1.75rem; font-weight: 600; }
.brand-text span { font-size: .875rem; color: var(--muted); }

.nav-toggle {
  display: none; font: inherit; font-weight: 700; min-height: 44px; padding: .4rem .9rem;
  border: 2px solid var(--brand); color: var(--brand); background: var(--surface);
  border-radius: 10px; cursor: pointer; align-items: center; gap: .5rem;
}
.nav-toggle svg { width: 20px; height: 20px; }

.main-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.main-nav a {
  display: block; padding: .6rem .65rem; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.main-nav a:hover { background: var(--tint); color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--brand); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 3px; text-decoration-color: var(--sun); }
html[data-contrast="high"] .main-nav a[aria-current="page"] { text-decoration-color: var(--brand); }

@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(23,50,74,.08); }
  .main-nav[data-open="false"] { display: none; }
  .main-nav ul { flex-direction: column; flex-wrap: wrap; padding: .5rem var(--gutter) 1rem; }
  .main-nav a { padding: .8rem .75rem; font-size: 1.1rem; }
  .brand img.znak { width: 52px; }
  .brand-text strong { font-size: 1.45rem; }
}

/* ---------- Przyciski w nagłówku + panel dostępności (telefon) ---------- */
.header-actions { display: flex; align-items: center; gap: .5rem; }
.a11y-toggle {
  display: none; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--brand); background: var(--surface); color: var(--brand); cursor: pointer; padding: 0;
}
.a11y-toggle svg { width: 26px; height: 26px; }
.a11y-toggle[aria-expanded="true"] { background: var(--brand); color: #fff; }
html[data-contrast="high"] .a11y-toggle[aria-expanded="true"] { color: #000; }
.a11y-panel { display: none; }

@media (max-width: 759px) {
  .js .topbar { display: none; }
  .js .a11y-toggle { display: inline-grid; }
  .a11y-panel[data-open="true"] {
    display: block; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(23,50,74,.12); padding: 1rem var(--gutter) 1.25rem;
  }
  .a11y-panel .a11y-tools { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 0; }
  .a11y-panel .a11y-tools .label { grid-column: 1 / -1; color: var(--ink); font-family: var(--font-display); font-size: 1.05rem; }
  .a11y-panel .a11y-tools button {
    color: var(--ink); border: 2px solid var(--line); background: var(--surface);
    min-height: 48px; justify-content: center; white-space: normal; text-align: center;
    display: inline-flex; align-items: center; gap: .45rem; line-height: 1.2;
  }
  .a11y-panel .a11y-tools button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
  html[data-contrast="high"] .a11y-panel .a11y-tools button { color: var(--brand); border-color: var(--brand); background: #000; }
  html[data-contrast="high"] .a11y-panel .a11y-tools button[aria-pressed="true"] { background: var(--brand); color: #000; }
  .a11y-panel .fs-group { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .5rem 0 0; margin: 0; border-left: 0; }
  .site-header .wrap { flex-wrap: nowrap; gap: .5rem; }
  .brand { min-width: 0; }
  .brand img.znak { width: 42px; }
  .brand-text strong { font-size: 1.3rem; }
  .brand-text small { font-size: .66rem; letter-spacing: .06em; }
  .header-actions { gap: .4rem; flex: none; }
  .js .a11y-toggle { width: 44px; height: 44px; }
  .brand-text span { font-size: .8rem; }
  .brand { gap: .55rem; }
  .nav-toggle { min-height: 44px; padding: .35rem .6rem; gap: .35rem; }
  .eyebrow { letter-spacing: .06em; font-size: .78rem; }
}

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  min-height: 48px; padding: .7rem 1.25rem; border-radius: 12px;
  font-weight: 700; text-decoration: none; border: 2px solid var(--brand);
  line-height: 1.2;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--brand); }
.btn-secondary:hover { background: var(--tint); }
.btn .big { white-space: nowrap; font-size: 1.2em; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--surface); border-bottom: 1px solid var(--line); }
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 2rem 3rem; align-items: center; padding-block: clamp(2rem, 5vw, 4rem);
  position: relative; z-index: 1;
}
.eyebrow {
  font-family: var(--font-display); font-weight: 500; font-size: .85rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: .75rem;
}
.lead { font-size: var(--step-1); color: var(--muted); max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* Łuki z logo – jedyny duży element dekoracyjny */
.deco {
  position: absolute; right: -120px; bottom: -220px; width: 640px; height: 640px;
  pointer-events: none; z-index: 0;
}
.deco circle { fill: none; }

.today-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: 0 10px 30px rgba(23,50,74,.08);
}
.today-card h2 { font-size: var(--step-1); margin: 0; }
.today-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1.1rem; }
.today-head .status { margin: 0; }
.info-strip { padding-top: 1.5rem; }
.status {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 700;
  padding: .35rem .75rem; border-radius: 999px; background: var(--tint); color: var(--ink);
  margin-bottom: 1rem;
}
.status::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; background: #1E7B45; }
.status[data-state="closed"]::before { background: #B3261E; }
html[data-contrast="high"] .status { border: 2px solid #fff; }
.facts { display: grid; gap: 1rem 1.5rem; margin: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.facts div { position: relative; padding-left: 2.35rem; }
.facts svg { position: absolute; left: 0; top: .1rem; width: 1.5rem; height: 1.5rem; color: var(--brand); }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--muted); }

/* ---------- Sekcje ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { margin-bottom: 1.75rem; }
.section-head p { color: var(--muted); }

.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; min-width: 0;
}
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: .35rem; }
.card p { margin: 0; color: var(--muted); }
.card .icon {
  width: 48px; height: 48px; border-radius: 12px; background: var(--tint);
  display: grid; place-items: center; margin-bottom: .9rem; color: var(--brand);
}
html[data-contrast="high"] .card .icon { border: 2px solid #fff; }
.card .icon svg { width: 26px; height: 26px; }

/* Lista specjalności: nazwa fachowa + prosty opis */
.spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); }
.spec-list li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.25rem; display: flex; gap: 1rem; align-items: flex-start;
}
.spec-txt { display: grid; gap: .15rem; min-width: 0; }
.spec-list strong { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.spec-list .desc { color: var(--muted); }

/* Tabela telefonów */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 1rem 1.25rem .25rem; font-weight: 700; font-family: var(--font-display); font-size: var(--step-1); }
th, td { text-align: left; padding: .85rem 1.25rem; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-size: var(--step--1); color: var(--muted); font-weight: 700; }
tbody th { font-weight: 700; }
td a { font-weight: 700; white-space: nowrap; }

/* Ramki informacyjne */
.note {
  border-left: 6px solid var(--sun); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.note-urgent { border-left-color: #B3261E; }
.note h3 { margin-bottom: .25rem; }
.note p:last-child { margin-bottom: 0; }

.check-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.check-list li { display: grid; grid-template-columns: 1.5rem minmax(0,1fr); gap: .6rem; }
.check-list svg { width: 1.4rem; height: 1.4rem; color: var(--brand); margin-top: .15rem; }

/* Dokumenty do pobrania */
.docs { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.docs li + li { border-top: 1px solid var(--line); }
.docs a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; padding: .9rem 1.25rem; text-decoration: none; }
.docs a:hover { background: var(--tint); }
.docs .doc-name { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.docs .doc-meta { color: var(--muted); font-size: var(--step--1); white-space: nowrap; }

.proc { display: grid; gap: 1rem; }
.proc + .proc { margin-top: 2.5rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; color: var(--muted); font-size: var(--step--1); margin: 0; }
.meta-row dt { font-weight: 700; display: inline; }
.meta-row dd { display: inline; margin: 0; }

.page-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.page-head .wrap { padding-block: clamp(1.75rem, 4vw, 3rem); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .75rem; font-size: var(--step--1); }
.breadcrumbs li + li::before { content: "›"; margin-right: .4rem; color: var(--muted); }

.prose { max-width: 72ch; }
.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .4rem; }

.todo {
  background: #FFF6CC; color: #3D3200; border: 1px dashed #8A6D00; border-radius: 6px;
  padding: .1rem .4rem; font-size: .95em;
}

/* ---------- Stopka ---------- */
.site-footer { background: var(--ink); color: #E8EEF3; margin-top: 0; }
html[data-contrast="high"] .site-footer { background: #000; border-top: 2px solid #fff; }
.site-footer .wrap { padding-block: 2.5rem 1.5rem; display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.site-footer h2 { font-size: 1.1rem; color: #fff; margin-bottom: .75rem; }
.site-footer a { color: #fff; }
html[data-contrast="high"] .site-footer a { color: var(--brand); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.site-footer p { margin-bottom: .4rem; }
.footer-legal { border-top: 1px solid rgba(255,255,255,.2); }
.footer-legal .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1rem; padding-block: 1rem; font-size: var(--step--1); color: #C9D6E1; }

/* ---------- Responsywność ---------- */
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); }
  .deco { width: 420px; height: 420px; right: -160px; bottom: auto; top: -140px; opacity: .6; }
}
@media (max-width: 560px) {
  .topbar-info .hide-sm { display: none; }
  .btn { width: 100%; justify-content: center; }
}

/* Ograniczenie ruchu – szanujemy ustawienia systemu */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .btn, .main-nav a, .docs a { transition: background-color .15s ease, color .15s ease; }
}

@media print {
  .topbar, .nav-toggle, .main-nav, .deco, .skip-link { display: none !important; }
  .site-header { position: static; }
  body { background: #fff; }
}

/* ---------- Okno z podglądem obrazu (np. plakat) ---------- */
.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(92vw, 760px); max-height: 92vh;
  width: 100%; overflow: visible; color: var(--ink);
}
.lightbox::backdrop { background: rgba(10, 25, 40, .72); }
.lightbox-inner {
  background: var(--surface); border-radius: var(--radius); padding: .75rem;
  display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden;
  gap: .75rem; max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  border: 1px solid var(--line);
}
.lightbox-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.lightbox-bar h2 { font-size: var(--step-0); margin: 0; }
.lightbox-actions { display: flex; gap: .5rem; }
.lightbox-actions .btn { font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; padding: .45rem .9rem; width: auto; }
.lightbox-img { overflow: auto; border-radius: 8px; min-height: 0; }
.lightbox-img img { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] .lightbox-inner { animation: lb-in .25s ease-out; }
  @keyframes lb-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
}

/* ---------- Przewijanie do sekcji z menu: nagłówek nie zasłania tytułu ---------- */
/* --header-h ustawia skrypt (wysokość przyklejonego nagłówka); 88px to wartość zapasowa */
[id] { scroll-margin-top: calc(var(--header-h, 88px) + 1.25rem); }
.section[id] { scroll-margin-top: calc(var(--header-h, 88px) - clamp(2.5rem, 6vw, 4.5rem) + 1.25rem); }
