/* lekarz.wiki — the placeholder.
   One sheet of blue ECG paper: the grid is the paper, the trace is the only thing
   drawn on it, and the headline is the only thing said. */

/* Fraunces, variable on weight and optical size, self-hosted so the page asks no
   third party for anything. The Polish diacritics live in the latin-ext file; the
   browser only fetches it 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;
}

:root {
  /* --blue is the lightest the background ever gets, and every text colour is
     checked against it: white 6.4:1, --tint 4.9:1. The sheet only darkens from
     there, so nothing below can read worse than those two numbers. */
  --blue: #0C52DC;
  --blue-deep: #0838A8;
  --ink: #FFFFFF;
  --tint: #D3E2FF;
  --grid-minor: rgb(255 255 255 / .055);
  --grid-major: rgb(255 255 255 / .11);
  /* ECG paper: five small squares to a large one. */
  --cell: 24px;
  --gutter: clamp(20px, 5.5vw, 76px);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  background-color: var(--blue);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 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%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── the two rows of small print ─────────────────────────────────────────── */
.top, .foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  white-space: nowrap;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}
.top { padding-block: max(clamp(20px, 3.4vw, 40px), env(safe-area-inset-top, 0px)) 0 }
.foot {
  padding-block: clamp(14px, 2vw, 22px) max(clamp(18px, 3vw, 34px), env(safe-area-inset-bottom, 0px));
  color: var(--tint);
  /* 12px, not the body's 13: at 13 the two halves are two pixels too wide for one
     line of a 320px phone and each wraps in the middle. */
  font-size: 12px;
}

.mark {
  font-family: var(--serif);
  font-size: clamp(20px, 1.1rem + .6vw, 27px);
  font-weight: 520;
  letter-spacing: -.01em;
  line-height: 1;
}
.mark__tld { color: var(--tint) }

.label {
  color: var(--tint);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ── the headline ────────────────────────────────────────────────────────── */
main {
  align-self: end;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-block: clamp(48px, 9vh, 120px) clamp(20px, 4vh, 44px);
}

h1 {
  margin: 0;
  max-width: 17ch;
  font-family: var(--serif);
  /* 9.3vw is the largest size at which "Tu powstanie strona" still fits on one
     line of a phone, so the two halves of the sentence break where the sentence
     does instead of leaving "strona" on a line of its own. */
  font-size: clamp(1.75rem, min(9.3vw, 1.1rem + 6.6vw), 6.75rem);
  font-weight: 400;
  letter-spacing: -.022em;
  line-height: 1.02;
  text-wrap: balance;
}
h1 span { display: block }
.lead { color: var(--tint) }

/* Fraunces has an optical-size axis, and left on auto it follows the font size
   all the way up. Past about 72px that is the wrong cut for this page: the
   hairlines get so fine that on a 1x screen the bar of every "e" disappears into
   the blue and the headline reads "powstanic". Held at 72, the strokes scale up
   with the size instead of thinning out. */
@media (min-width: 824px) {
  h1 { font-variation-settings: "opsz" 72 }
}

/* ── the trace ───────────────────────────────────────────────────────────── */
/* img/pulse.svg is one beat, 240 by 120; tiling it on the height keeps every beat
   the same shape at any viewport width, and the strip is as long as the screen.

   The mask is what moves. It is two identical periods wide, so sliding it by
   exactly one of them loops without a seam, and each period is what a bedside
   monitor shows: the trace brightest just behind the pen, a short gap where the
   pen is about to write, and the previous sweep, dimmer, still standing ahead.

   Two boxes because of the order effects apply in: on one element the glow would
   be drawn first and then cut by the mask, leaving a straight vertical edge in
   the light at the pen. On the parent it is drawn around what the mask left. */
.trace {
  height: clamp(72px, 12.5vw, 132px);
  filter: drop-shadow(0 0 7px rgb(255 255 255 / .38));
}
.trace::before {
  content: "";
  display: block;
  height: 100%;
  background: url("img/pulse.svg") 0 50% / auto 100% repeat-x;
  --sweep: linear-gradient(90deg,
    rgb(0 0 0 / .36) 0%, rgb(0 0 0 / .36) 24%, #000 44%,
    transparent 44.05%, transparent 47%,
    rgb(0 0 0 / .36) 50%, rgb(0 0 0 / .36) 74%, #000 94%,
    transparent 94.05%, transparent 97%,
    rgb(0 0 0 / .36) 100%);
  -webkit-mask: var(--sweep) 100% 0 / 200% 100% repeat-x;
  mask: var(--sweep) 100% 0 / 200% 100% repeat-x;
  animation: sweep 5.2s linear infinite;
}

@keyframes sweep {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0 }
  to { -webkit-mask-position: 0% 0; mask-position: 0% 0 }
}

/* ── arrival ─────────────────────────────────────────────────────────────── */
/* Runs once. `backwards` holds the first frame during the delay, and nothing is
   left hidden if the animation never runs: the resting state is the visible one. */
@keyframes rise {
  from { opacity: 0; transform: translateY(.28em) }
}
.lead { animation: rise .7s cubic-bezier(.2, .7, .2, 1) .05s backwards }
.punch { animation: rise .7s cubic-bezier(.2, .7, .2, 1) .17s backwards }

/* A still page for anyone who asked for one: the whole trace, at rest. */
@media (prefers-reduced-motion: reduce) {
  .lead, .punch { animation: none }
  .trace::before { animation: none; -webkit-mask: none; mask: none }
}

/* Short and wide — a phone on its side. The headline gives way before the trace. */
@media (max-height: 520px) {
  h1 { font-size: clamp(2rem, 9.5vh, 3.25rem); max-width: none; font-variation-settings: normal }
  main { padding-block: 20px 12px }
  .trace { height: 64px }
}

@media print {
  body { background: #fff; color: #000 }
  .lead, .mark__tld, .label, .foot { color: #333 }
  .trace { display: none }
}
