/* treść na środku, menu na marginesie z lewej */

@font-face
{
  font-family: 'saira';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-display: swap;
  src: url('saira.woff2') format('woff2');
}

@font-face
{
  font-family: 'saira';
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-display: swap;
  src: url('saira-italic.woff2') format('woff2');
}

@font-face
{
  font-family: 'arimo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('arimo.woff2') format('woff2');
}

@font-face
{
  font-family: 'arimo';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('arimo-italic.woff2') format('woff2');
}

@font-face
{
  font-family: 'jetbrains';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('jetbrains.woff2') format('woff2');
}

:root
{
  /* Material Blue Grey: tekst i struktura */
  --bg: #ffffff;
  --ink: #263238;           /* nagłówki, bieżąca pozycja menu */
  --text: #37474f;          /* tekst */
  --nav: #607d8b;           /* menu */
  --muted: #78909c;         /* linie pod nagłówkami, punkty list */
  --rule: #b0bec5;          /* oś, kropki */
  --code-bg: #eceff1;
  --quote-bg: #f0f8fe;

  /* akcenty */
  --link: #0080f0;
  --link-soft: #f0f8fe;
  --marker: #ffb300;        /* Amber 600: zakładka bieżącej strony */
  --marker-soft: #ffecb3;   /* Amber 100: tło hovera w menu */

  /* uwagi: tło 50, linia 600 */
  --notice-1: #1e88e5;
  --notice-1-bg: #e3f2fd;
  --notice-2: #ffb300;
  --notice-2-bg: #fff8e1;
  --notice-3: #e53935;
  --notice-3-bg: #ffebee;

  --text-width: 56rem;
  --menu-width: 11rem;
  --dash: 1.25rem;          /* długość obu kresek = odstęp menu–oś */
  --ddash: 0rem;            /* przedłużenie niebieskiej kreski pod h1 */
  --indent: 0.75rem;        /* odstęp oś–tekst */
  --thumb: 120px;
  --font: arimo, "Segoe UI", sans-serif;
  --head-font: saira, "Segoe UI", sans-serif;
  --monospace-font: jetbrains, Consolas, monospace;
}

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

/* bez ligatur w kodzie: <=> i === mają być widać znak po znaku */
code, pre
{
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

body
{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font);
}

/* ---------------------------------------------------------------- układ
   trzy kolumny: margines | treść | margines; menu wisi w lewym marginesie,
   dosunięte do treści, więc treść zostaje dokładnie na środku */
.layout
{
  display: grid;
  grid-template-columns: 1fr minmax(0, var(--text-width)) 1fr;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  padding: 0 1.5rem;
}

.navigation
{
  grid-column: 1;
  grid-row: 1 / span 2;
  justify-self: end;
  box-sizing: content-box;
  width: var(--menu-width);
  padding-right: var(--dash);
  align-self: start;
  position: sticky;
  top: 0;
  padding-top: 3.2rem;
}

.main
{
  grid-column: 2;
  padding: 3rem 0 2rem var(--indent);
  border-left: 1px dotted var(--rule);
}

.footer
{
  grid-column: 2;
  padding: 0 0 1.5rem var(--indent);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer:empty
{
  display: none;
}

/* ---------------------------------------------------------------- menu */
.navigation ul
{
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: right;
}

.navigation a
{
  position: relative;
  display: block;
  padding: 0.3rem 0.9rem 0.3rem 0;
  color: var(--nav);
  font-family: var(--head-font);
  font-size: 0.82rem;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.15s;
}

.navigation a:hover
{
  background: linear-gradient(to left, var(--marker-soft), transparent);
  color: var(--ink);
}

/* znacznik bieżącej strony: kreska dotykająca linii treści */
.navigation a.active
{
  color: var(--ink);
}

.navigation a.active::after
{
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--dash));
  width: var(--dash);
  height: 3px;
  background: var(--marker);
  transform: translateY(-50%);
}

/* --------------------------------------------------------------- treść */
h1, h2, h3, h4, h5, h6
{
  color: var(--ink);
  font-family: var(--head-font);
  line-height: 1.25;
}

h1
{
  position: relative;
  margin: 2.2rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dotted var(--muted);
  font-size: 1.6rem;
  font-weight: 600;
  font-stretch: 112.5%;
}

/* kreska od osi do początku tekstu, na wysokości linii pod nagłówkiem */
h1::before
{
  content: "";
  position: absolute;
  left: calc(-1 * var(--indent));
  bottom: -2px;
  width: calc(var(--dash) + var(--ddash));
  height: 3px;
  background: var(--link);
}

h2
{
  margin: 1.8rem 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
}

h3, h4, h5, h6
{
  margin: 1.4rem 0 0.3rem;
  font-size: 1rem;
  font-weight: 700;
}

.main > :first-child
{
  margin-top: 0;
}

p
{
  margin: 0.6rem 0;
}

a
{
  color: var(--link);
  text-decoration: underline dotted;
  text-underline-offset: 0.2em;
}

.main a:hover
{
  background: var(--link-soft);
  text-decoration-style: solid;
}

ul, ol
{
  margin: 0.6rem 0;
  padding-left: 1.4rem;
}

li
{
  margin: 0.15rem 0;
}

/* lista w liście: bez odstępów od punktu */
li > ul, li > ol
{
  margin: 0;
}

.main ul
{
  list-style: square;
}

.main li::marker
{
  color: var(--muted);
}

hr
{
  margin: 2rem 0;
  border: 0;
  border-top: 1px dotted var(--rule);
}

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

code
{
  padding: 0.05em 0.3em;
  background: var(--code-bg);
  font-family: var(--monospace-font);
  font-size: 0.86em;
}

pre
{
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  line-height: 1.5;
}

pre code
{
  padding: 0;
  background: none;
}

blockquote
{
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  background: var(--quote-bg);
  color: var(--text);
  font-style: italic;
}

.notice1, .notice2, .notice3
{
  margin: 1rem 0;
  padding: 0.6rem 1rem;
}

.notice1
{
  background: var(--notice-1-bg);
}

.notice2
{
  background: var(--notice-2-bg);
}

.notice3
{
  background: var(--notice-3-bg);
}

.notice1 p, .notice2 p, .notice3 p, blockquote p
{
  margin: 0.3rem 0;
}

/* tabele: tylko linie poziome */
table
{
  display: block;
  max-width: 100%;
  width: max-content;
  overflow-x: auto;
  margin: 1rem 0;
  border-collapse: collapse;
  border-top: 2px solid var(--nav);
  border-bottom: 2px solid var(--nav);
}

table.center
{
  margin-left: auto;
  margin-right: auto;
}

th, td
{
  padding: 0.35rem 1.2rem 0.35rem 0;
  text-align: left;
}

th
{
  font-family: var(--head-font);
}

thead tr:last-child th
{
  border-bottom: 1px solid var(--nav);
}

tr.rule td, tr.rule th
{
  border-top: 1px solid var(--nav);
}

/* [plik](/x.pdf){info}: dopisek za linkiem */
.file-info
{
  color: var(--muted);
  font-size: 0.8em;
  white-space: nowrap;
}

.file-info.missing
{
  color: var(--notice-3);
}

p.image
{
  text-align: center;
}

.gallery
{
  display: grid;

  /* miniatura ma dokładny wymiar */
  grid-template-columns: repeat(auto-fit, var(--thumb));

  /* miniatura może się zwiększyć żeby wypełnić panel */
  /* grid-template-columns: repeat(auto-fill, minmax(var(--thumb), 1fr)); */

  gap: 0.5rem;
  margin: 1rem 0;
}

.gallery a
{
  display: block;
}

.main .gallery a:hover
{
  background: none;
}

.gallery img
{
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--rule);
  cursor: zoom-in;
}

.gallery img:hover
{
  border-color: var(--link);
}

/* skrócona galeria: schowane nie zajmują miejsca, ostatnia widoczna ma +N */
.gallery a[hidden]
{
  display: none;
}

.gallery a[data-more]
{
  position: relative;
}

.gallery a[data-more]::after
{
  content: attr(data-more);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: 700;
  pointer-events: none;
}

/* formularze */
input, button
{
  font: inherit;
}

input[type=password]
{
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--rule);
  border-bottom: 2px solid var(--ink);
}

button, input[type=file]::file-selector-button
{
  padding: 0.35rem 1rem;
  background: var(--ink);
  border: 0;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

input[type=file]::file-selector-button
{
  margin-right: 0.75rem;
  background: var(--code-bg);
  color: var(--ink);
}

button:hover
{
  background: var(--link);
}

/* okno galerii */
.lightbox
{
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

.lightbox::backdrop
{
  background: rgba(20, 24, 30, 0.88);
}

.lightbox img
{
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  cursor: zoom-out;
}

.lightbox .lb-info
{
  margin: 0.6em 0 0;
  color: #ffffff;
  font-size: 0.9em;
  text-align: center;
}

.lightbox button
{
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
}

.lightbox button:hover
{
  background: rgba(255, 255, 255, 0.25);
}

.lightbox svg
{
  width: 1.4rem;
  height: 1.4rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lightbox .lb-close
{
  top: 1rem;
  right: 1rem;
}

.lightbox .lb-prev, .lightbox .lb-next
{
  top: 50%;
  transform: translateY(-50%);
}

.lightbox .lb-prev
{
  left: 1rem;
}

.lightbox .lb-next
{
  right: 1rem;
}

.lightbox.single .lb-prev, .lightbox.single .lb-next
{
  display: none;
}

/* ---------------------------------------------------------------- mniej miejsca
   ekran za wąski na symetrię: menu zostaje z lewej, treść przesuwa się w prawo */
@media (max-width: 86rem)
{
  .layout
  {
    grid-template-columns: auto minmax(0, var(--text-width)) 1fr;
  }
}

/* telefon: menu nad treścią, linia pionowa staje się poziomą */
@media (max-width: 50rem)
{
  .layout
  {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    padding: 0 1rem;
  }

  .navigation
  {
    grid-column: 1;
    grid-row: 1;
    justify-self: stretch;
    width: auto;
    position: static;
    padding: 1rem 0 0.6rem;
    border-bottom: 1px dotted var(--rule);
  }

  .navigation ul
  {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
    text-align: left;
  }

  .navigation a
  {
    padding: 0.25rem 0;
  }

  .navigation a.active::after
  {
    top: auto;
    bottom: -0.15rem;
    right: 0;
    width: 100%;
    height: 2px;
    transform: none;
  }

  .main, .footer
  {
    grid-column: 1;
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .main
  {
    padding-top: 1.5rem;
  }

  h1::before
  {
    left: 0;
    width: 3rem;
  }
}
