/* lekarz.wiki — the page about Wiktoria Bajek.
   Laid out as a reference entry, which is what the domain promises: the name, one
   paragraph that defines who she is, a card with the facts a patient looks for
   first, and under every section the public register it can be checked in.
   Pale paper and navy ink carry the reading; the card is the one loud thing on
   the page — the blue ECG sheet the placeholder was made of, cut down to size. */

/* Both families are self-hosted so the page asks no third party for anything.
   Polish diacritics live in the latin-ext files; the browser only fetches one
   when a glyph from its range is actually on the page. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin-ext.woff2") format('woff2');
  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: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/fraunces-latin.woff2") format('woff2');
  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;
}
/* Commissioner for everything that is read rather than looked at. Chosen over
   the "hyperlegible" families tried first because those draw a slashed zero that
   cannot be switched off, and this page is mostly registry numbers. */
@font-face {
  font-family: 'Commissioner';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/commissioner-latin-ext.woff2") format('woff2');
  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: 'Commissioner';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/commissioner-latin.woff2") format('woff2');
  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;
}

:root {
  color-scheme: light dark;
  /* Contrast on --paper: --ink 15:1, --ink-2 7.6:1, --accent 5.9:1. */
  --paper: #F3F6FE;
  --ink: #0A1B4A;
  --ink-2: #3B4C7A;
  --accent: #0C52DC;
  --line: #C6D4F4;
  /* The card keeps these in both themes. --blue is the lightest it gets: white
     on it is 6.4:1 and --tint 4.9:1, and the sheet only darkens from there. */
  --blue: #0C52DC;
  --blue-deep: #0838A8;
  --tint: #D3E2FF;
  --gutter: clamp(20px, 5vw, 64px);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Commissioner', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Night: the paper turns navy and the accent lightens to stay readable on it.
   Contrast on --paper: --ink 15:1, --ink-2 8.9:1, --accent 8.4:1. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #081230;
    --ink: #E9EEFF;
    --ink-2: #A9B8E6;
    --accent: #8FB0FF;
    --line: #223366;
  }
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em }
a:hover { text-decoration-thickness: 2px }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px }
::selection { background: var(--blue); color: #fff }

p { margin: 0 0 1em; text-wrap: pretty }
.nb, .pub__role { white-space: nowrap }

/* ── the top line ────────────────────────────────────────────────────────── */
.bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 20px;
  padding-block: max(clamp(20px, 3vw, 32px), env(safe-area-inset-top, 0px)) 0;
}
.bar p { margin: 0 }
.mark {
  font: 520 clamp(1.25rem, 1.1rem + .6vw, 1.6rem)/1 var(--serif);
  letter-spacing: -.01em;
}
.mark span { color: var(--accent) }
/* The way to the other language edition. */
.bar__lang { font-size: .9375rem }

/* ── the name ────────────────────────────────────────────────────────────── */
.hero { padding-block: clamp(44px, 9vw, 124px) clamp(30px, 4.4vw, 60px) }

h1 {
  margin: 0;
  /* On a phone the name takes two lines, which lets it be set as large as the
     longer of the two words allows. */
  font: 400 clamp(3.6rem, 19.5vw, 6rem)/.92 var(--serif);
  letter-spacing: -.035em;
  color: var(--accent);
  /* Fraunces has an optical-size axis, and left on auto it follows the font size
     all the way up. Past about 72px the hairlines get so fine that the bar of the
     "e" disappears and the name reads "Bajck". Held at 72, the strokes scale up
     with the size instead of thinning out. */
  font-variation-settings: "opsz" 72;
}
h1 span { display: block }

.hero__what {
  margin: .7em 0 0;
  font: 400 clamp(1.3rem, 1.05rem + 1.1vw, 1.9rem)/1.25 var(--serif);
  letter-spacing: -.01em;
}

@media (min-width: 720px) {
  h1 { font-size: clamp(5.2rem, 10.6vw, 9.25rem) }
  h1 span { display: inline }
}

/* ── the entry: definition, card, sections ───────────────────────────────── */
/* Source order is definition, card, sections — the order a phone shows them in.
   From 960px the card moves into a column of its own beside the other two. */
.entry {
  display: grid;
  gap: clamp(28px, 4vw, 44px);
  padding-block: clamp(28px, 4vw, 52px) 0;
  border-top: 1px solid var(--line);
}

.lead {
  margin: 0;
  max-width: 34em;
  font-size: clamp(1.2rem, 1.05rem + .55vw, 1.42rem);
  line-height: 1.5;
}

@media (min-width: 960px) {
  .entry {
    grid-template-columns: minmax(0, 1fr) 370px;
    grid-template-areas: "lead box" "body box";
    column-gap: clamp(48px, 7vw, 104px);
    align-items: start;
  }
  .lead { grid-area: lead }
  .box { grid-area: box }
  .body { grid-area: body }
}

/* The card follows the reader down the page, but only on a screen it fits on
   whole: a sticky box taller than the viewport hides its own last rows. Its
   height follows the reader's font size, so the limits are in em (in a media
   query that is the browser's default size): the card is about 40.6em tall, and
   74em with a portrait and a booking button. */
@media (min-width: 960px) and (min-height: 42.5em) {
  .box { position: sticky; top: 24px }
  .box:has(.box__photo) { position: static }
}
@media (min-width: 960px) and (min-height: 76em) {
  .box:has(.box__photo) { position: sticky }
}

/* ── the card ────────────────────────────────────────────────────────────── */
.box {
  /* ECG paper: five small squares to a large one. */
  --cell: 22px;
  color: #fff;
  font-size: 1.0625rem;
  line-height: 1.4;
  background-color: var(--blue);
  background-image:
    linear-gradient(rgb(255 255 255 / .11) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .11) 1px, transparent 1px),
    linear-gradient(rgb(255 255 255 / .055) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / .055) 1px, transparent 1px),
    linear-gradient(180deg, var(--blue), var(--blue-deep));
  background-size:
    calc(var(--cell) * 5) calc(var(--cell) * 5),
    calc(var(--cell) * 5) calc(var(--cell) * 5),
    var(--cell) var(--cell),
    var(--cell) var(--cell),
    100% 100%;
}

/* img/pulse.svg is one beat, 240 by 120; tiling it on the height keeps every beat
   the same shape at any width. The strip is taller than the beat so the glow has
   blue to fall on at the card's top edge. A beat is 148px wide here, and the
   370px column is two and a half of them: the right edge cuts the trace on the
   flat stretch after a spike, not through one. */
.box__trace {
  height: 92px;
  background: url("img/pulse.svg") 0 100% / auto 74px repeat-x;
  filter: drop-shadow(0 0 6px rgb(255 255 255 / .35));
}

.box dl { margin: 0; padding: 6px 26px 22px }
.box dl > div { padding-block: 13px; border-top: 1px solid rgb(255 255 255 / .2) }
.box dl > div:first-child { border-top: 0 }
.box dt { font-size: .875rem; color: var(--tint) }
.box dd { margin: 2px 0 0; font-weight: 500 }
.box a { color: #fff }
.box a:focus-visible { outline-color: #fff }

/* Not in the markup yet — README.md, "Sekcje, na które jest miejsce".
   The portrait goes first in the card and bleeds to its edges; the trace then
   runs under it. 4:5 with the crop held high keeps a face in frame whatever the
   photo's own proportions are. */
.box__photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 22%;
}
/* The booking button closes the card, so on a wide screen it is on screen for
   as long as the card is. It points at the booking section, or straight at the
   place where a visit is booked. */
/* `.box .box__cta`, not `.box__cta`: it has to outrank `.box a`, which is white. */
.box .box__cta {
  display: block;
  margin: 0 26px 26px;
  padding: 14px 18px;
  background: #fff;
  color: var(--blue-deep);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.box .box__cta:hover { background: var(--tint) }

/* ── sections ────────────────────────────────────────────────────────────── */
/* A container, so the tables below can ask how wide the text column is rather
   than how wide the screen is. */
.body { max-width: 41em; container-type: inline-size }
.body > section { padding-block: clamp(34px, 4.6vw, 56px) }
.body > section + section { border-top: 1px solid var(--line) }
.body > section:first-child { padding-top: clamp(8px, 1.6vw, 20px) }
.body > section > :last-child { margin-bottom: 0 }
/* A link to a section lands with its heading clear of the screen's edge. */
.body > section { scroll-margin-top: 12px }

h2 {
  margin: 0 0 .7em;
  font: 480 clamp(1.7rem, 1.35rem + 1.3vw, 2.25rem)/1.1 var(--serif);
  letter-spacing: -.02em;
}
h3 { margin: 0; font: 700 1.125rem/1.35 var(--sans) }

/* Where the section's facts come from. Quiet, but a real line of text: it is the
   part of the page a doctor's own site usually lacks. */
.src { margin-top: 1.5em; font-size: .9375rem; line-height: 1.5; color: var(--ink-2) }

.places { list-style: none; margin: 0 0 1.3em; padding: 0 }
.places li { padding-block: 16px; border-top: 1px solid var(--line) }
.places li:last-child { border-bottom: 1px solid var(--line) }
.places p { margin: 0 }
.places__addr { color: var(--ink-2) }

.facts { margin: 0 }
.facts > div { display: grid; gap: 2px 24px; padding-block: 12px; border-top: 1px solid var(--line) }
.facts > div:last-child { border-bottom: 1px solid var(--line) }
.facts dt { font-size: .9375rem; color: var(--ink-2) }
.facts dd { margin: 0 }
.facts ul { margin: 0; padding-left: 1.05em }
.facts li + li { margin-top: 3px }
/* Label beside value only when the column has room for both. Asked of the
   column, not the screen: just above 960px the card takes its own column and
   the text column is narrower than it was on a tablet. */
@container (min-width: 33em) {
  .facts > div { grid-template-columns: 13.5em minmax(0, 1fr); align-items: baseline }
}
p + .facts { margin-top: 1.3em }

/* Running text is justified where a line is long enough to carry it: on a
   phone a justified line of five or six words opens gaps nothing can close, so
   there the right edge stays ragged. `hyphens: auto` divides words where the
   browser has a dictionary for the page's language; Chromium has none for
   Polish, so there the Polish lines are spaced a little wider. `text-wrap` goes
   back to plain filling, which leaves the fewest short lines to stretch. The
   source lines stay ragged: one long link in a two-line paragraph justifies
   badly. The definition is asked of the screen and the paragraphs below of
   their column, like the tables above. */
@media (min-width: 720px) {
  .lead { text-align: justify; text-wrap: wrap; hyphens: auto; hyphenate-limit-chars: 6 3 3 }
}
@container (min-width: 33em) {
  .body > section > p:not(.src) { text-align: justify; text-wrap: wrap; hyphens: auto; hyphenate-limit-chars: 6 3 3 }
}

/* The one filled button in the text column, for the booking section when it
   exists. Same blue in both themes: white on it is 6.4:1. */
.cta {
  display: inline-block;
  padding: 14px 22px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.cta:hover { background: var(--blue-deep) }

/* ── publications ────────────────────────────────────────────────────────── */
.year {
  margin: 1.6em 0 0;
  font: 480 1.35rem/1 var(--serif);
  color: var(--accent);
  font-variant-numeric: lining-nums;
}
.pubs { list-style: none; margin: .6em 0 0; padding: 0 }
.pub { padding-block: 15px; border-top: 1px solid var(--line) }
.pub__title {
  display: block;
  font-weight: 600;
  line-height: 1.38;
  color: var(--ink);
  /* Ink-coloured, so the underline has to say "link" on its own: 7.8:1 on the
     paper, 9.4:1 at night. */
  text-decoration-color: var(--ink-2);
  text-wrap: pretty;
}
.pub__title:hover { color: var(--accent); text-decoration-color: currentColor }
.pub__meta { margin: 5px 0 0; font-size: .9375rem; line-height: 1.45; color: var(--ink-2) }
.pub--first .pub__role { color: var(--accent); font-weight: 600 }

/* ── the last line ───────────────────────────────────────────────────────── */
/* One line of credit, under a rule that runs the full width like the one below
   the name. */
.foot { margin-top: clamp(48px, 7vw, 96px) }
.foot p {
  margin: 0;
  padding-block: 20px max(26px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  font-size: .875rem;
  color: var(--ink-2);
}
.foot a { color: inherit }
.foot a:hover { color: var(--accent) }

/* On paper the card is a plain bordered table, and each article prints its DOI
   address after the title, since a title cannot be clicked there. Sizes hang off
   the root so the small print stays smaller than the text. */
@media print {
  :root { --paper: #fff; --ink: #000; --ink-2: #333; --accent: #000; --line: #999; font-size: 10pt }
  .hero { padding-block: 20pt 16pt }
  .box { position: static; color: #000; background: none; border: 1px solid #000 }
  .box dt, .box a { color: #000 }
  .box dl > div { border-top-color: #999 }
  .box__trace, .box__cta, .cta { display: none }
  .pub__title::after { content: " — " attr(href); font-weight: 400 }
  h2, h3 { break-after: avoid }
  .pub, .places li, .facts > div, .box dl > div { break-inside: avoid }
}
