/* dorwij.to — the stylesheet of the guides, /blog and /blog/<slug> ("Poradniki").
 *
 * Static HTML in `public/blog/`, served by Caddy without the SPA and read by search engines and
 * AI crawlers that run no JavaScript: everything a reader or a crawler needs is in the markup.
 * Under the site CSP (`style-src 'self'`) this file is the only place their look can live.
 *
 * Metka, like the landing: the wordmark and nav on the heather-lilac field, the page's title on
 * the same field with the steel rail at its foot, the text on paper below. The tokens are copies
 * of the landing's (`landing.css`), light and dark, with the chosen-dark twin that theme.js
 * switches on (test/spa-rules.test.ts keeps the two dark blocks identical). Green is spent only
 * on the wordmark's `.to`: nothing in a guide is "buyable now".
 */

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/public-sans-latin-ext-wght-normal.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: "Public Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("/fonts/public-sans-latin-wght-normal.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;
}

/* ─── tokens (copies of landing.css) ────────────────────────────────────────────────── */

:root {
  color-scheme: light dark;

  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: oklch(0.985 0.004 70);
  --surface: oklch(1 0 0);
  --border: oklch(0.9 0.005 70);
  --border-strong: oklch(0.82 0.006 70);
  --text: oklch(0.2 0.008 60);
  --text-muted: oklch(0.48 0.008 60);
  --live: oklch(0.52 0.155 155);
  --live-ink: oklch(0.45 0.14 155);
  --focus: oklch(0.55 0.16 250);

  --field: oklch(0.875 0.05 300);
  --field-deep: oklch(0.82 0.06 300);
  --field-muted: oklch(0.4 0.035 300);
  --edge: var(--field-deep);

  --rail-hi: oklch(0.93 0.004 270);
  --rail-mid: oklch(0.72 0.006 270);
  --rail-lo: oklch(0.45 0.008 270);
  --rail-shadow: 0 3px 4px -1px oklch(0.2 0.03 300 / 35%);

  --r-control: 8px;
  --r-row: 14px;
  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 40rem;
  --max: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.155 0.006 250);
    --surface: oklch(0.205 0.007 250);
    --border: oklch(0.32 0.009 250);
    --border-strong: oklch(0.42 0.01 250);
    --text: oklch(0.94 0.004 250);
    --text-muted: oklch(0.7 0.008 250);
    --live: oklch(0.72 0.135 155);
    --live-ink: var(--live);
    --focus: oklch(0.72 0.13 250);
    --field: oklch(0.235 0.035 300);
    --field-deep: oklch(0.2 0.03 300);
    --field-muted: oklch(0.8 0.025 300);
    --edge: oklch(0.55 0.08 300);
    --rail-hi: oklch(0.8 0.005 270);
    --rail-mid: oklch(0.58 0.006 270);
    --rail-lo: oklch(0.34 0.008 270);
    --rail-shadow: 0 3px 4px -1px oklch(0 0 0 / 50%);
  }
}

/* The same night when it is CHOSEN (the switch in the top bar, or the app: public/theme.js),
   whatever the system says. Keep this block identical to the one above:
   test/spa-rules.test.ts compares them. */
:root[data-theme="dark"] {
  --bg: oklch(0.155 0.006 250);
  --surface: oklch(0.205 0.007 250);
  --border: oklch(0.32 0.009 250);
  --border-strong: oklch(0.42 0.01 250);
  --text: oklch(0.94 0.004 250);
  --text-muted: oklch(0.7 0.008 250);
  --live: oklch(0.72 0.135 155);
  --live-ink: var(--live);
  --focus: oklch(0.72 0.13 250);
  --field: oklch(0.235 0.035 300);
  --field-deep: oklch(0.2 0.03 300);
  --field-muted: oklch(0.8 0.025 300);
  --edge: oklch(0.55 0.08 300);
  --rail-hi: oklch(0.8 0.005 270);
  --rail-mid: oklch(0.58 0.006 270);
  --rail-lo: oklch(0.34 0.008 270);
  --rail-shadow: 0 3px 4px -1px oklch(0 0 0 / 50%);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

/* ─── page ──────────────────────────────────────────────────────────────────────────── */

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  /* continuous prose, and Polish descenders (ą, ę) need the room */
  line-height: 1.65;
  text-wrap: pretty;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* Blue is the only blue and means only "the keyboard is here"; the halo keeps it at 3:1 on
   lilac as well as on paper. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: 0 0 0 3px var(--bg);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: 0.5rem;
  z-index: 20;
  padding: 0.75rem 1rem;
  border-radius: var(--r-control);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* ─── the field: top bar and the page's title ───────────────────────────────────────── */

.field {
  background: var(--field);
  padding: 0 max(var(--gutter), (100% - var(--max)) / 2);
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 0.75rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-right: auto;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
  white-space: nowrap;
}

/* on the lilac field the light green needs its dark twin (4.5:1) */
.logo .tld {
  color: var(--live-ink);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--r-control);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a:hover {
  background: var(--field-deep);
}

.top-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.top-login {
  box-shadow: inset 0 0 0 1.5px var(--text);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin-left: -0.75rem;
  padding: 0;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--field-deep);
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle[aria-pressed="true"] .theme-icon--moon,
.theme-toggle[aria-pressed="false"] .theme-icon--sun {
  display: none;
}

/* Below ~384px the wordmark, both links and the switch do not fit on one line (at 360 they
   overflow by 9px). The list is still one tap away: the crumb and the footer link it. */
@media (max-width: 24em) {
  .top-nav a[href="/blog"] {
    display: none;
  }
}

.head {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) 0 clamp(1.75rem, 5vw, 2.75rem);
}

.crumb {
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--field-muted);
}

.crumb a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-block: -0.75rem;
  text-decoration: none;
}

.crumb a:hover {
  text-decoration: underline;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.lede {
  margin-top: 1rem;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.3125rem);
  line-height: 1.5;
}

.byline {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--field-muted);
  font-variant-numeric: tabular-nums;
}

/* The rail at the foot of the field: the page hangs from it, as every Metka screen does. */
.rail {
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(var(--rail-hi) 0 20%, var(--rail-mid) 55%, var(--rail-lo));
  box-shadow: var(--rail-shadow);
}

.rail::before,
.rail::after {
  content: "";
  position: absolute;
  bottom: -1px;
  width: 9px;
  height: 22px;
  border-radius: 2px 2px 3px 3px;
  background: linear-gradient(90deg, var(--rail-lo), var(--rail-mid) 45%, var(--rail-lo));
}

.rail::before {
  left: -3px;
}

.rail::after {
  right: -3px;
}

/* ─── the text ──────────────────────────────────────────────────────────────────────── */

.body {
  padding: clamp(2rem, 5vw, 3rem) var(--gutter) 0;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
}

.prose > * + * {
  margin-top: 1rem;
}

.prose h2 {
  margin-top: 2.5rem;
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.625rem);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.prose h3 {
  margin-top: 1.75rem;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
}

.prose h2 + *,
.prose h3 + * {
  margin-top: 0.625rem;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose li::marker {
  color: var(--text-muted);
  font-weight: 600;
}

.prose strong {
  font-weight: 700;
}

.note {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--border-strong);
  background: var(--surface);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* A step's picture in the install guides (024): one phone, centred, never wider than a phone
   held in the hand, whatever the column. The files carry their own frame and a transparent
   ground, so they sit on paper and on the night theme alike. */
.prose .shot {
  margin-top: 1.25rem;
  text-align: center;
}

.shot img {
  display: block;
  width: min(100%, 17.5rem);
  height: auto;
  margin: 0 auto;
}

.shot figcaption {
  margin-top: 0.625rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* The one call to action: the product, on its own field, like the landing's request form. */
.cta {
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: var(--r-row);
  background: var(--field);
}

.cta h2 {
  margin-top: 0;
}

.cta p {
  margin-top: 0.625rem;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 1.375rem;
  border-radius: var(--r-control);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
}

/* ink, never green: green is "buyable at your price" and nothing else */
.btn--ink {
  background: var(--text);
  color: var(--bg);
}

.btn--line {
  box-shadow: inset 0 0 0 1.5px var(--text);
  font-weight: 600;
}

.btn--line:hover {
  background: var(--field-deep);
}

@media (max-width: 30em) {
  .cta-actions .btn {
    width: 100%;
  }
}

/* Questions and answers, open (not <details>): the answer is the content a reader and a
   crawler came for. A stitched divider between them, as in the app. */
.faq h3 {
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-strong);
}

.prose .more {
  list-style: none;
  padding-left: 0;
}

.more li + li {
  margin-top: 0;
}

.more a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

/* ─── the guide list (/blog) ────────────────────────────────────────────────────────── */

.prose .posts {
  list-style: none;
  padding: 0;
}

.posts > li + li {
  margin-top: 0;
  border-top: 1px dashed var(--border-strong);
}

.post {
  padding-block: 1.5rem;
}

.post h2,
.post h3 {
  margin-top: 0;
  font-size: 1.375rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.post h2 a,
.post h3 a {
  text-decoration: none;
}

.post h2 a:hover,
.post h3 a:hover {
  text-decoration: underline;
}

/* The list page's sections (Poradniki grouped by what the reader came for). */
.prose .group + .group {
  margin-top: 2.5rem;
}

.prose .group > h2 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.prose .group .posts {
  margin-top: 0;
}

.post p {
  margin-top: 0.5rem;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ─── footer ────────────────────────────────────────────────────────────────────────── */

.foot {
  max-width: var(--measure);
  margin: clamp(3.5rem, 8vw, 5rem) auto 0;
  padding: 1.75rem var(--gutter) calc(2rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  box-sizing: content-box;
}

.foot-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.foot .logo {
  margin-right: 0;
  font-size: 1.25rem;
}

.foot .logo .tld {
  color: var(--live);
}

.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9375rem;
}

.foot-note {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media print {
  .field .top,
  .rail,
  .cta,
  .foot-nav {
    display: none;
  }
}

/* ─── the summary that opens every guide ("W skrócie") ──────────────────────────────── */

/* The answer first, for a reader in a hurry and for a crawler or an assistant that quotes one
   block: the same sentences are the posting's `abstract` in its JSON-LD
   (test/blog-pages.test.ts holds the two together). Paper on paper, held by a lilac edge. */
.prose .tldr {
  padding: clamp(1rem, 3vw, 1.25rem) clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--border);
  border-left: 4px solid var(--edge);
  border-radius: var(--r-control);
  background: var(--surface);
}
.prose .tldr h2 {
  margin-top: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.prose .tldr ul,
.prose .tldr ol {
  margin-top: 0.625rem;
}

/* ─── a comparison table (the alternatives guide) ──────────────────────────────────── */

.compare-wrap {
  margin: 1.75rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.compare {
  width: 100%;
  min-width: 38rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.compare caption {
  text-align: left;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.compare th,
.compare td {
  padding: 0.75rem 0.75rem 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.compare thead th {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.compare tbody th {
  font-weight: 700;
}
/* dorwij.to's own row in a comparison (tr.us), not whatever row happens to be last: a price
   table of someone else's plans has no row of ours to stress. */
.compare tbody tr.us th,
.compare tbody tr.us td {
  font-weight: 650;
}
.prose .note {
  font-size: 0.875rem;
  color: var(--text-muted);
}
