/* Teczka wnioskodawcy: papier, granat, minia. Paleta i pismo z portfolio michal-wiencek-3d.web.app,
   bo to ten sam człowiek podpisuje obie strony. Warstwy: reset, base, layout, components, responsive. */
@layer reset, base, layout, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, figure { margin: 0; }
  button, input { font: inherit; }
  img { max-width: 100%; display: block; }
  a { color: inherit; }
  [hidden] { display: none !important; }
  svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
  button { cursor: pointer; color: inherit; }
  button:disabled { cursor: default; opacity: .45; }
}

@layer base {
  :root {
    --paper: #f4ead8;
    --paper-2: #eaddc4;
    --paper-3: #e2d4b6;
    --sheet: #fdf9f1;
    --sheet-2: #f7efe0;
    --line: #d9cbb0;
    --line-strong: #c7b797;
    --ink: #12060a;
    --ink-2: #2b2620;
    --muted: #5f5346;
    --navy: #071a52;
    --navy-2: #102f80;
    --navy-3: #1a46ad;
    --navy-soft: #aab6dc;
    --minia: #ff7b1c;
    --minia-2: #f26f0f;
    --minia-ink: #c2540a;
    --minia-tint: #ffe6d1;
    --sun: #ffd75e;
    --sky: #e4f1ff;
    --sky-2: #d8e8ff;
    --radius: 14px;
    --gutter: clamp(24px, 4vw, 64px);
    --sidebar: 272px;
    --paper-overhang: 48px;
  }
  html { scroll-behavior: smooth; scroll-padding-top: 2rem; }
  body {
    font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
    font-weight: 550;
    color: var(--ink);
    background: var(--paper);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  a { text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
  button, a, input { touch-action: manipulation; }
  a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 3px solid var(--navy-3);
    outline-offset: 4px;
    border-radius: 6px;
  }
  h1, h2, h3 { line-height: 1.12; letter-spacing: -.035em; font-weight: 900; text-wrap: balance; }
  h1 { font-size: clamp(2.5rem, 4.4vw, 4.6rem); }
  h2 { font-size: clamp(1.5rem, 2.2vw, 2rem); }
  h3 { font-size: 1.125rem; font-weight: 850; letter-spacing: -.02em; }
  main:focus { outline: none; }
  ::selection { background: var(--sun); color: var(--ink); }
  .workspace, main, .category, .card-body, .gate-intro { min-width: 0; }
}

@layer layout {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: linear-gradient(180deg, #0a2264 0%, var(--navy) 42%);
    color: var(--paper);
    --spine-pad: 22px;
    padding: 34px var(--spine-pad) 26px;
    display: flex;
    flex-direction: column;
    z-index: 5;
  }
  .workspace {
    margin-left: var(--sidebar);
    min-height: 100svh;
    /* biurko: odrobinę głębszy papier niż arkusze, żeby kartki wyraźnie na nim leżały */
    background: radial-gradient(1100px 520px at 100% 0, #faf2e2 0%, transparent 70%), linear-gradient(180deg, #f1e6d0, #efe2c9);
  }
  /* pasek u góry to pasek papieru z podartą dolną krawędzią; cień z filtra idzie po sylwetce, więc widać darcie nad biurkiem */
  .topbar {
    position: relative;
    z-index: 7;
    height: 64px;
    margin-left: calc(-1 * var(--paper-overhang));
    background: var(--sheet);
    filter: drop-shadow(-1px 4px 2px #12060a33) drop-shadow(0 11px 9px #12060a26);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 var(--gutter);
    padding-left: calc(var(--gutter) + var(--paper-overhang));
    font-size: .8125rem;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: .01em;
  }
  .topbar::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: var(--sheet); clip-path: polygon(0 0, 100% 0, 3399px 5.4px, 3366px 2.4px, 3333px 7.4px, 3300px 0.9px, 3267px 5.1px, 3234px 0.7px, 3201px 4.4px, 3168px 3.8px, 3135px 11.0px, 3102px 1.4px, 3069px 6.7px, 3036px 1.1px, 3003px 10.8px, 2970px 3.3px, 2937px 11.0px, 2904px 2.2px, 2871px 7.0px, 2838px 0.3px, 2805px 10.8px, 2772px 1.6px, 2739px 5.2px, 2706px 0.5px, 2673px 9.9px, 2640px 0.2px, 2607px 4.1px, 2574px 0.7px, 2541px 7.2px, 2508px 0.1px, 2475px 9.0px, 2442px 1.5px, 2409px 5.6px, 2376px 3.3px, 2343px 11.9px, 2310px 2.6px, 2277px 9.3px, 2244px 0.2px, 2211px 9.0px, 2178px 1.9px, 2145px 11.5px, 2112px 3.4px, 2079px 7.1px, 2046px 2.3px, 2013px 8.3px, 1980px 2.8px, 1947px 5.8px, 1914px 3.5px, 1881px 8.2px, 1848px 3.1px, 1815px 9.0px, 1782px 0.2px, 1749px 7.4px, 1716px 0.6px, 1683px 9.8px, 1650px 1.7px, 1617px 4.1px, 1584px 3.9px, 1551px 5.6px, 1518px 2.9px, 1485px 10.9px, 1452px 2.1px, 1419px 8.2px, 1386px 1.0px, 1353px 9.3px, 1320px 3.2px, 1287px 5.7px, 1254px 1.8px, 1221px 8.3px, 1188px 1.3px, 1155px 6.8px, 1122px 2.7px, 1089px 4.9px, 1056px 0.2px, 1023px 3.6px, 990px 2.2px, 957px 6.4px, 924px 2.6px, 891px 8.2px, 858px 0.7px, 825px 10.3px, 792px 1.2px, 759px 4.1px, 726px 0.6px, 693px 5.6px, 660px 3.4px, 627px 3.4px, 594px 3.9px, 561px 6.6px, 528px 2.3px, 495px 11.5px, 462px 2.5px, 429px 5.0px, 396px 0.5px, 363px 10.4px, 330px 1.7px, 297px 3.8px, 264px 0.3px, 231px 6.9px, 198px 0.1px, 165px 7.6px, 132px 0.2px, 99px 6.3px, 66px 2.1px, 33px 3.7px, 0px 2.6px); pointer-events: none; }
  main { max-width: 1440px; padding: 44px var(--gutter) 56px; margin: auto; }
  .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 0 0 44px; }
  .page-heading h1 span { display: block; font-style: italic; font-weight: 650; letter-spacing: -.025em; color: var(--navy-3); margin-top: 6px; }
  .lead { max-width: 620px; margin-top: 22px; color: var(--ink-2); font-size: 1.0625rem; font-weight: 550; line-height: 1.65; }
  .category { scroll-margin-top: 28px; margin-bottom: 64px; padding-top: 0; border-top: 2px solid var(--navy); }
  .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
  /* Tytuł sekcji to zakładka zwisająca z linii: arkusz z grubszą dolną krawędzią i cieniem, litery z jasnym podcieniem */
  .section-heading h2 {
    width: fit-content;
    margin: 0 0 16px;
    padding: 15px 24px 16px;
    font-size: clamp(1.75rem, 2.6vw, 2.4rem);
    background: var(--sheet);
    border: 1px solid var(--line-strong);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 1px 0 #fff inset, 0 3px 0 var(--paper-3), 0 14px 26px -16px #12060a66;
    text-shadow: 0 1px 0 #fff;
  }
  footer { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 40px; font-size: .875rem; color: var(--muted); max-width: 900px; }
}

@layer components {
  .skip { position: fixed; z-index: 50; left: 12px; top: 12px; transform: translateY(-160%); background: var(--sheet); color: var(--ink); padding: 14px; border-radius: 10px; font-weight: 800; }
  .skip:focus { transform: none; }
  .locked .skip { display: none; }
  .locked .identity { cursor: default; }

  .identity { display: flex; gap: 13px; align-items: center; text-decoration: none; font-weight: 800; font-size: .95rem; line-height: 1.2; }
  .identity small { display: block; color: var(--navy-soft); font-size: .75rem; font-weight: 600; margin-top: 4px; }
  .monogram {
    position: relative;
    width: 46px; height: 46px; flex-shrink: 0;
    border-radius: 13px;
    background: var(--paper);
    color: var(--navy);
    font-weight: 900;
    font-size: 1.15rem;
    letter-spacing: -.08em;
    display: grid; place-items: center;
    transition: transform .8s cubic-bezier(.2, .8, .2, 1);
  }
  .monogram::after { content: ""; position: absolute; right: 6px; bottom: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--minia); }
  .identity:hover .monogram, .identity:focus-visible .monogram { transform: rotate(360deg); }

  .nav-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; color: var(--navy-soft); margin: 54px 0 14px 12px; }
  nav { position: relative; display: flex; flex-direction: column; gap: 4px; }
  /* Wstążka: papierowy znacznik płynie między zakładkami; sama zakładka po najechaniu wysuwa się z grzbietu */
  .nav-marker {
    position: absolute; left: 0; right: 0; top: 0; height: 0;
    border-radius: 11px;
    background: var(--paper);
    box-shadow: inset 4px 0 0 var(--minia), 0 12px 24px -12px #00000099;
    opacity: 0;
    pointer-events: none;
    transition: top .4s cubic-bezier(.2, .8, .2, 1), height .4s cubic-bezier(.2, .8, .2, 1), opacity .25s;
  }
  nav > a {
    position: relative; z-index: 1;
    display: flex; gap: 12px; align-items: center;
    padding: 11px 12px;
    text-decoration: none;
    font-size: .9375rem;
    font-weight: 650;
    border-radius: 11px;
    transition: background-color .2s, color .25s, transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  .sidebar nav > a::before { content: attr(data-n); font-size: .72rem; font-weight: 800; color: var(--navy-soft); font-variant-numeric: tabular-nums; width: 2.1ch; flex-shrink: 0; transition: color .25s; }
  nav > a:hover { background: #ffffff14; transform: translateX(4px); }
  .sidebar nav > a:hover::before { color: var(--minia); }
  nav > a[aria-current] { background: transparent; color: var(--navy); font-weight: 800; transform: translateX(4px); }
  .sidebar nav > a[aria-current]::before { color: var(--minia-ink); }
  nav > a[aria-current]:hover { background: transparent; }

  /* Zwijanie panelu jak na claude.ai: przycisk na krawędzi, listwa z samymi numerami, treść rozszerza się na zwolnione miejsce */
  .sidebar-toggle {
    position: absolute; top: 92px; right: -15px; z-index: 6;
    width: 30px; height: 30px; padding: 0;
    border-radius: 50%; border: 1px solid var(--line-strong);
    background: var(--sheet); color: var(--navy);
    display: grid; place-items: center;
    box-shadow: 0 4px 12px -4px #12060a66;
    transition: background .15s, transform .2s;
  }
  .sidebar-toggle svg { width: 16px; height: 16px; stroke-width: 2.2; transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
  .sidebar-toggle:hover { background: #fff; transform: scale(1.08); }
  @media (min-width: 761px) {
    body:not(.application-view) .topbar { position: sticky; top: 0; }
    .sidebar { transition: width .32s cubic-bezier(.2, .8, .2, 1), padding .32s cubic-bezier(.2, .8, .2, 1); }
    .workspace { transition: margin-left .32s cubic-bezier(.2, .8, .2, 1); }
    :root.rail { --sidebar: 76px; --paper-overhang: 14px; }
    :root.rail .sidebar { --spine-pad: 14px; padding-left: var(--spine-pad); padding-right: var(--spine-pad); }
    :root.rail .sidebar-toggle { top: 98px; right: 23px; }
    :root.rail .topbar::before { display: none; }
    :root.rail .sidebar-toggle svg { transform: rotate(180deg); }
    :root.rail .sidebar nav { margin-top: 62px; }
    :root.rail .identity-text, :root.rail .nav-label, :root.rail .sidebar-foot { display: none; }
    :root.rail .identity { justify-content: center; }
    :root.rail .sidebar nav > a { font-size: 0; justify-content: center; padding: 11px 0; gap: 0; }
    :root.rail .sidebar nav > a::before { font-size: .8rem; width: auto; color: var(--paper); }
    :root.rail .sidebar nav > a[aria-current]::before { color: var(--navy); }
    :root.rail .sidebar nav > a:hover::before { color: var(--minia); }
    :root.rail .sidebar nav > a:hover, :root.rail .sidebar nav > a[aria-current] { transform: none; }
    :root.rail .nav-marker { box-shadow: inset 3px 0 0 var(--minia), 0 12px 24px -12px #00000099; }
  }
  .locked nav { opacity: .45; pointer-events: none; }
  .sidebar nav { scrollbar-width: thin; scrollbar-color: #607e93 transparent; }

  /* Jeden arkusz zachodzi na granat: ta sama krawędź i cień bez osobnej doklejki.
     Przycisk leży niżej, poza sylwetką papieru. */
  .topbar::before { content: ""; position: absolute; top: 0; left: 0; width: var(--paper-overhang); height: 64px; background: radial-gradient(circle at 20px 31px, #fffc 0 1.4px, #a7adc0 1.8px 3.2px, #454a5e 3.4px 4.6px, #12060a59 4.8px 5.8px, transparent 6.2px); pointer-events: none; }
  /* Karta na dole grzbietu: lekko wypukłe szkło, blik u góry, ciemniejsza podstawa, cienki jasny rant */
  .sidebar-foot {
    position: relative; overflow: hidden; order: 6; margin-top: auto; padding: 14px 14px 12px; border-radius: 12px;
    border: 1px solid #ffffff3a;
    background: linear-gradient(165deg, #ffffff26 0%, #ffffff0d 48%, #ffffff06 100%);
    box-shadow: inset 0 1px 0 #ffffff6b, inset 0 -1px 0 #00000059, inset 0 12px 20px -14px #ffffff5c, 0 14px 26px -18px #000000cc;
    backdrop-filter: blur(6px);
  }
  .sidebar-foot::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(120% 70% at 50% -18%, #ffffff38 0%, #ffffff00 62%); pointer-events: none; }
  .sidebar-foot > * { position: relative; }
  /* Okno w grzbiecie: dolna warstwa z tłoczonym MW (te same glify Nunito, co monogram), a nad nią rozdarta górna warstwa grzbietu, której ząbkowane krawędzie rzucają cień do środka */
  .spine-window {
    position: relative; order: 5; flex: 1 1 auto; min-height: 120px; max-height: 560px;
    margin: auto calc(var(--spine-pad) * -1);
    background: linear-gradient(180deg, #00000080, #0000 46px), linear-gradient(0deg, #00000080, #0000 40px), url(/mw-pattern.svg) center / 168px auto repeat #050f3a;
  }
  .spine-window::before, .spine-window::after { content: ""; position: absolute; left: 0; right: 0; height: 16px; background: var(--navy); }
  .spine-window::before { background: radial-gradient(circle at 18px 5.5px, #fff9 0 1px, #9aa0b4 1.4px 2.2px, #3a3f52 2.4px 3.3px, #12060a66 3.5px 4.3px, transparent 4.6px), radial-gradient(circle at calc(100% - 18px) 5.5px, #fff9 0 1px, #9aa0b4 1.4px 2.2px, #3a3f52 2.4px 3.3px, #12060a66 3.5px 4.3px, transparent 4.6px), var(--navy); }
  .spine-window::before { top: -1px; clip-path: polygon(0 0, 100% 0, 100.000% calc(100% - 7px), 97.222% 100%, 94.444% calc(100% - 7px), 91.667% 100%, 88.889% calc(100% - 7px), 86.111% 100%, 83.333% calc(100% - 7px), 80.556% 100%, 77.778% calc(100% - 7px), 75.000% 100%, 72.222% calc(100% - 7px), 69.444% 100%, 66.667% calc(100% - 7px), 63.889% 100%, 61.111% calc(100% - 7px), 58.333% 100%, 55.556% calc(100% - 7px), 52.778% 100%, 50.000% calc(100% - 7px), 47.222% 100%, 44.444% calc(100% - 7px), 41.667% 100%, 38.889% calc(100% - 7px), 36.111% 100%, 33.333% calc(100% - 7px), 30.556% 100%, 27.778% calc(100% - 7px), 25.000% 100%, 22.222% calc(100% - 7px), 19.444% 100%, 16.667% calc(100% - 7px), 13.889% 100%, 11.111% calc(100% - 7px), 8.333% 100%, 5.556% calc(100% - 7px), 2.778% 100%, 0 calc(100% - 7px)); filter: drop-shadow(0 3px 2px #000000e6) drop-shadow(0 10px 10px #000000a6); }
  .spine-window::after { bottom: -1px; clip-path: polygon(0.000% 7px, 2.778% 0, 5.556% 7px, 8.333% 0, 11.111% 7px, 13.889% 0, 16.667% 7px, 19.444% 0, 22.222% 7px, 25.000% 0, 27.778% 7px, 30.556% 0, 33.333% 7px, 36.111% 0, 38.889% 7px, 41.667% 0, 44.444% 7px, 47.222% 0, 50.000% 7px, 52.778% 0, 55.556% 7px, 58.333% 0, 61.111% 7px, 63.889% 0, 66.667% 7px, 69.444% 0, 72.222% 7px, 75.000% 0, 77.778% 7px, 80.556% 0, 83.333% 7px, 86.111% 0, 88.889% 7px, 91.667% 0, 94.444% 7px, 97.222% 0, 100% 7px, 100% 100%, 0 100%); filter: drop-shadow(0 -4px 5px #000000b3); }
  /* Okno przy nagłówku sekcji: jak w grzbiecie, ale rozdarta górna warstwa to papier biurka; wisi pod linią sekcji */
  .section-window {
    position: relative; align-self: flex-start; flex: 1 1 auto; min-width: 220px; height: 84px; margin: 0 0 0 12px;
    background: linear-gradient(180deg, #00000099, #0000 30px), linear-gradient(0deg, #00000059, #0000 20px), linear-gradient(90deg, #00000073, #0000 26px), linear-gradient(270deg, #0000004d, #0000 18px), url(/mw-pattern.svg) 50% 0 / 168px auto repeat #061443;
    clip-path: polygon(6px 0.000%, 0 5.556%, 6px 11.111%, 0 16.667%, 6px 22.222%, 0 27.778%, 6px 33.333%, 0 38.889%, 6px 44.444%, 0 50.000%, 6px 55.556%, 0 61.111%, 6px 66.667%, 0 72.222%, 6px 77.778%, 0 83.333%, 6px 88.889%, 0 94.444%, 6px 100%, calc(100% - 6px) 100.000%, 100% 94.444%, calc(100% - 6px) 88.889%, 100% 83.333%, calc(100% - 6px) 77.778%, 100% 72.222%, calc(100% - 6px) 66.667%, 100% 61.111%, calc(100% - 6px) 55.556%, 100% 50.000%, calc(100% - 6px) 44.444%, 100% 38.889%, calc(100% - 6px) 33.333%, 100% 27.778%, calc(100% - 6px) 22.222%, 100% 16.667%, calc(100% - 6px) 11.111%, 100% 5.556%, calc(100% - 6px) 0);
  }
  .section-window::before, .section-window::after { content: ""; position: absolute; left: 0; right: 0; height: 12px; background: #f0e4cd; }
  /* gwoździe w rogach: łebek z bliskiem, papier przybity do granatu */
  .section-window::before { background: radial-gradient(circle at 11px 5.5px, #fff9 0 1px, #9aa0b4 1.4px 2.2px, #3a3f52 2.4px 3.3px, #12060a66 3.5px 4.3px, transparent 4.6px), radial-gradient(circle at calc(100% - 11px) 5.5px, #fff9 0 1px, #9aa0b4 1.4px 2.2px, #3a3f52 2.4px 3.3px, #12060a66 3.5px 4.3px, transparent 4.6px), #f0e4cd; }
  .section-window::before { top: 0; clip-path: polygon(0 0, 100% 0, 100.000% calc(100% - 5px), 95.455% 100%, 90.909% calc(100% - 5px), 86.364% 100%, 81.818% calc(100% - 5px), 77.273% 100%, 72.727% calc(100% - 5px), 68.182% 100%, 63.636% calc(100% - 5px), 59.091% 100%, 54.545% calc(100% - 5px), 50.000% 100%, 45.455% calc(100% - 5px), 40.909% 100%, 36.364% calc(100% - 5px), 31.818% 100%, 27.273% calc(100% - 5px), 22.727% 100%, 18.182% calc(100% - 5px), 13.636% 100%, 9.091% calc(100% - 5px), 4.545% 100%, 0 calc(100% - 5px)); filter: drop-shadow(0 3px 2px #000000e6) drop-shadow(0 9px 9px #000000a6); }
  .section-window::after { bottom: -1px; clip-path: polygon(0.000% 5px, 4.545% 0, 9.091% 5px, 13.636% 0, 18.182% 5px, 22.727% 0, 27.273% 5px, 31.818% 0, 36.364% 5px, 40.909% 0, 45.455% 5px, 50.000% 0, 54.545% 5px, 59.091% 0, 63.636% 5px, 68.182% 0, 72.727% 5px, 77.273% 0, 81.818% 5px, 86.364% 0, 90.909% 5px, 95.455% 0, 100% 5px, 100% 100%, 0 100%); filter: drop-shadow(0 -3px 4px #000000a6); }
  /* Druga warstwa: ten sam wzór MW pod grzbietem i pod sekcjami, przypięty do okna przeglądarki, więc każda dziura pokazuje fragment jednej płaszczyzny; --mw-shift z app.mjs przesuwa go do góry przy przewijaniu (paralaksa) */
  .spine-window { background-attachment: scroll, scroll, fixed; background-position: 0 0, 0 0, 50% var(--mw-shift, 0px); }
  .section-window { background-attachment: scroll, scroll, scroll, scroll, fixed; background-position: 0 0, 0 0, 0 0, 0 0, 50% var(--mw-shift, 0px); }
  .sidebar-foot > span { display: block; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; color: var(--navy-soft); line-height: 1.5; }
  .sidebar-foot p { font-size: .875rem; margin-top: 8px; color: var(--paper); font-weight: 650; line-height: 1.45; }

  .eyebrow { display: flex; align-items: center; gap: 10px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--minia-ink); margin-bottom: 14px; }
  .eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--minia); flex-shrink: 0; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 46px; padding: 11px 17px;
    border: 1px solid var(--line-strong);
    background: var(--sheet);
    color: var(--ink);
    border-radius: 11px;
    font-size: .875rem; font-weight: 800; line-height: 1.3;
    text-decoration: none;
    transition: background .15s, border-color .15s, transform .15s;
  }
  .btn:hover:not(:disabled) { background: #fff; border-color: var(--navy-3); }
  .btn-primary { background: var(--minia); border-color: var(--minia); color: var(--ink); }
  .btn-primary:hover:not(:disabled) { background: var(--minia-2); border-color: var(--minia-2); }
  .btn-small { min-height: 44px; padding: 9px 12px; font-size: .8125rem; }
  .btn-quiet { border-color: transparent; background: transparent; }
  .btn[aria-pressed=true] { background: var(--navy); color: var(--paper); border-color: var(--navy); }

  .toast {
    position: fixed; z-index: 200;
    bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: calc(100% - 32px);
    padding: 14px 20px;
    border: 1px solid #ffffff22; border-radius: 12px;
    color: var(--paper); background: var(--navy);
    box-shadow: 0 10px 40px -10px #071a5266;
    font-size: .875rem; font-weight: 700;
  }
}

@layer responsive {
  @media (max-width: 1150px) {
    :root { --sidebar: 228px; --paper-overhang: 18px; }
    .topbar::before { display: none; }
    .sidebar { --spine-pad: 16px; padding: 28px var(--spine-pad) 22px; }
    nav > a { padding: 10px 10px; font-size: .9rem; }
  }
  @media (max-width: 760px) {
    :root, :root.rail { --sidebar: 0px; --paper-overhang: 0px; }
    /* Telefon: grzbiet rozpada się na pasek z nazwiskiem i przyklejony do góry pasek kategorii */
    .sidebar { display: contents; }
    .identity {
      background: linear-gradient(180deg, #0a2264 0%, var(--navy) 100%);
      color: var(--paper);
      padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
    }
    .identity small { font-size: .78rem; }
    .monogram { width: 40px; height: 40px; border-radius: 11px; font-size: 1rem; }
    .nav-label, .sidebar-foot, .nav-marker, .spine-window, .section-window, .sidebar::before { display: none; }
    .sidebar nav {
      position: sticky; top: 0; z-index: 20;
      flex-direction: row; gap: 6px; margin: 0;
      padding: 8px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
      background: var(--navy); color: var(--paper);
      overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
      box-shadow: 0 10px 22px -16px #000000e6;
    }
    .sidebar nav::-webkit-scrollbar { display: none; }
    .sidebar nav > a { white-space: nowrap; padding: 9px 13px; background: #ffffff14; font-size: .875rem; min-height: 44px; border-radius: 10px; }
    .sidebar nav > a::before { display: none; }
    .sidebar-toggle { display: none; }
    .sidebar nav > a:hover, .sidebar nav > a[aria-current] { transform: none; }
    .sidebar nav > a[aria-current] { background: var(--paper); color: var(--navy); box-shadow: inset 4px 0 0 var(--minia); }
    .locked .sidebar nav, .locked .topbar { display: none; }
    .workspace { margin: 0; background: none; }
    .topbar { min-height: 52px; height: auto; padding: 8px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); gap: 10px; }
    .topbar > span { display: none; }
    main { padding: 22px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
    .page-heading { padding-bottom: 26px; }
    .eyebrow { font-size: .68rem; }
    .lead { font-size: .9375rem; margin-top: 16px; }
    .category { margin-bottom: 40px; scroll-margin-top: 74px; }
    footer { font-size: .8125rem; }
  }
  @media (max-height: 500px) and (orientation: landscape) { .sidebar { overflow: auto; } }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
}
