/*
 * Serwis /pomoc — statyczne strony w identyfikacji Panelu Pracownika.
 * Tokeny odpowiadają frontend/src/index.scss; przy zmianie identyfikacji
 * zaktualizuj oba miejsca. Plik nie może zawierać zasobów spoza serwisu.
 */

@font-face {
  font-family: 'Geist Variable';
  font-style: normal;
  font-display: fallback;
  font-weight: 100 900;
  src: url(fonts/geist-5.3.0-latin-ext-wght-normal.woff2) format('woff2-variations');
  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: 'Geist Variable';
  font-style: normal;
  font-display: fallback;
  font-weight: 100 900;
  src: url(fonts/geist-5.3.0-latin-wght-normal.woff2) format('woff2-variations');
  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 {
  --font-family: 'Geist Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --surface-ground: #f4f4f1;
  --surface-card: #ffffff;
  --surface-subtle: #f9f9f7;
  --surface-border: #e3e2dd;
  --border-strong: #cbcac3;
  --surface-hover: #f1f0ec;
  --text-color: #16181d;
  --text-secondary: #5c606a;
  --text-strong: #0a0b0e;
  --primary: #2342d0;
  --primary-hover: #1b35ae;
  --primary-strong: #13278a;
  --primary-contrast: #ffffff;
  --highlight-bg: #edf0fc;
  --highlight-text: #13278a;
  --signal: #cc361c;
  --warning-surface: #fdf6e7;
  --warning-border: #ead19c;
  --warning-text: #865400;
  --focus: var(--primary);
  --radius-sm: 2px;
  --radius: 3px;
  --radius-lg: 4px;
  --logo-ink: #72787b;
  --logo-green: #00963f;
  --logo-blue: #009ee3;
  color-scheme: light;
}

/*
 * Tryb ciemny: wybór z przełącznika (data-theme, wspólny z Panelem przez
 * theme.js), a bez JavaScriptu — ustawienie systemu. Obie reguły muszą mieć
 * te same wartości.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --surface-ground: #0d0e11;
    --surface-card: #15161a;
    --surface-subtle: #18191d;
    --surface-border: #2a2c32;
    --border-strong: #3c3e45;
    --surface-hover: #1d1e23;
    --text-color: #ececee;
    --text-secondary: #a0a3ab;
    --text-strong: #ffffff;
    --primary: #8ea2ff;
    --primary-hover: #a9b8ff;
    --primary-strong: #c9d2ff;
    --primary-contrast: #0a0b0e;
    --highlight-bg: color-mix(in srgb, #8ea2ff 14%, transparent);
    --highlight-text: #c9d2ff;
    --signal: #ff6b4f;
    --warning-surface: color-mix(in srgb, #f5a524 10%, #15161a);
    --warning-border: color-mix(in srgb, #f5a524 38%, #2a2c32);
    --warning-text: #f6c46d;
    --logo-ink: #d4d7d9;
    --logo-green: #2fb866;
    --logo-blue: #33b5ec;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --surface-ground: #0d0e11;
  --surface-card: #15161a;
  --surface-subtle: #18191d;
  --surface-border: #2a2c32;
  --border-strong: #3c3e45;
  --surface-hover: #1d1e23;
  --text-color: #ececee;
  --text-secondary: #a0a3ab;
  --text-strong: #ffffff;
  --primary: #8ea2ff;
  --primary-hover: #a9b8ff;
  --primary-strong: #c9d2ff;
  --primary-contrast: #0a0b0e;
  --highlight-bg: color-mix(in srgb, #8ea2ff 14%, transparent);
  --highlight-text: #c9d2ff;
  --signal: #ff6b4f;
  --warning-surface: color-mix(in srgb, #f5a524 10%, #15161a);
  --warning-border: color-mix(in srgb, #f5a524 38%, #2a2c32);
  --warning-text: #f6c46d;
  --logo-ink: #d4d7d9;
  --logo-green: #2fb866;
  --logo-blue: #33b5ec;
  color-scheme: dark;
}

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

html {
  background: var(--surface-ground);
  color: var(--text-color);
  font-family: var(--font-family);
  font-feature-settings: 'ss01';
  font-size: 100%;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* Stopka zawsze na dole okna; przy dłuższej treści naturalnie pod nią. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
}

a {
  color: var(--primary);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.skip-link:focus {
  width: auto;
  height: auto;
  padding: 0.5rem 0.75rem;
  overflow: visible;
  clip: auto;
  clip-path: none;
  color: var(--primary-contrast);
  white-space: normal;
}

main[tabindex='-1']:focus {
  outline: none;
}

/* Nagłówek */

.site-header__bar {
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-card);
}

.site-header__inner,
.site-footer__inner {
  max-width: 76rem;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  padding-block: 1rem;
}

.brand {
  display: flex;
  align-items: center;
}

.uwm-logo {
  display: block;
  width: auto;
  height: 3rem;
}

.uwm-logo__ink {
  fill: var(--logo-ink);
}

.uwm-logo__green {
  fill: var(--logo-green);
}

.uwm-logo__blue {
  fill: var(--logo-blue);
}

/*
 * Pasek z nazwą serwisu między nagłówkiem a treścią. Na stronie głównej
 * pełni rolę nagłówka strony (h1 i opis), na pozostałych jest odnośnikiem
 * do strony głównej, a własny h1 ma treść.
 */

.masthead {
  border-bottom: 1px solid var(--surface-border);
}

.masthead__inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
}

.masthead__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.masthead__title a {
  color: inherit;
  text-decoration: none;
}

.masthead__title a:hover {
  color: var(--primary);
}

.masthead--home .masthead__inner {
  position: relative;
  padding-block: 2.75rem 2.5rem;
}

.masthead--home .masthead__title {
  max-width: 20ch;
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.masthead--home .masthead__title::before {
  display: block;
  width: 2rem;
  height: 3px;
  margin-bottom: 1.25rem;
  content: '';
  background: var(--primary);
}

.masthead__lead {
  max-width: 40rem;
  margin: 0.85rem 0 0;
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.eyebrow {
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.search {
  position: relative;
  flex: 1 1 12rem;
  max-width: 34rem;
}

.search[hidden] {
  display: none;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: var(--text-secondary);
  stroke-linecap: round;
  stroke-width: 1.75;
  transform: translateY(-50%);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.35rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--text-color);
  font: inherit;
}

.search input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.search input:focus {
  border-color: var(--primary);
  outline: 2px solid var(--focus);
  outline-offset: 0;
}

.search-results {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  left: 0;
  z-index: 5;
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
}

.search-results:empty {
  display: none;
}

.search-results__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-results__list li {
  border-bottom: 1px solid var(--surface-border);
}

.search-results__list li:last-child {
  border-bottom: 0;
}

.search-results a {
  display: block;
  padding: 0.65rem 0.85rem;
  color: var(--text-color);
  text-decoration: none;
}

.search-results a:hover,
.search-results a:focus {
  background: var(--highlight-bg);
}

.search-results a:focus-visible {
  outline-offset: -2px;
}

.search-results strong {
  display: block;
  color: var(--text-strong);
  font-weight: 600;
}

.search-results span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.search-empty {
  padding: 0.65rem 0.85rem;
  color: var(--text-secondary);
}

.site-header__actions {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-left: auto;
}

.to-panel {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.to-panel:hover {
  color: var(--primary);
}

@media (max-width: 52rem) {
  .site-header__inner {
    gap: 0.85rem 1rem;
    padding-block: 0.75rem;
  }

  .uwm-logo {
    height: 2.5rem;
  }

  .masthead--home .masthead__inner {
    padding-block: 1.75rem 1.5rem;
  }

  .search {
    flex-basis: 100%;
    max-width: none;
  }

  .site-header__actions {
    flex-basis: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
}

/* Przełącznik trybu: dwie połówki, przesuwany wskaźnik pod aktywną ikoną. */

.theme-toggle {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  width: 3.5rem;
  height: 1.875rem;
  padding: 0;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
}

.theme-toggle::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  content: '';
  transition: transform 180ms ease;
}

.theme-toggle[aria-checked='true']::before {
  transform: translateX(100%);
}

.theme-toggle svg {
  position: relative;
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transition: color 180ms ease;
}

.theme-toggle[aria-checked='false'] .theme-toggle__sun,
.theme-toggle[aria-checked='true'] .theme-toggle__moon {
  color: var(--text-strong);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle::before,
  .theme-toggle svg,
  .nav-toggle__chevron {
    transition: none;
  }
}

/* Układ: kolejność w DOM (<nav> przed <main>) odpowiada układowi wizualnemu na desktopie i mobile. */

.layout {
  flex: 1 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
  grid-template-areas: 'nav main';
  gap: 2.5rem;
  max-width: 76rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem;
}

.layout > main {
  grid-area: main;
  min-width: 0;
}

.site-nav {
  grid-area: nav;
  position: sticky;
  top: 1.5rem;
  align-self: start;
  max-height: calc(100vh - 3rem);
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.nav-toggle {
  display: none;
}

@media (max-width: 52rem) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'nav' 'main';
    gap: 1.5rem;
  }

  .site-nav {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--surface-border);
  }

  .site-nav[data-nav-enhanced='true'] .nav-title {
    display: none;
  }

  .site-nav[data-nav-enhanced='true'] .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    background: var(--surface-card);
    color: var(--text-color);
    font: inherit;
    cursor: pointer;
  }

  .site-nav[data-nav-enhanced='true'] .nav-toggle:hover {
    border-color: var(--border-strong);
  }

  .nav-toggle__chevron {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: var(--text-secondary);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.75;
    transition: transform 180ms ease;
  }

  .nav-toggle[aria-expanded='true'] .nav-toggle__chevron {
    transform: rotate(180deg);
  }

  .site-nav[data-nav-enhanced='true'] .site-nav__list {
    margin-top: 0.6rem;
  }

  .site-nav[data-nav-enhanced='true'][data-nav-open='false'] .site-nav__list {
    display: none;
  }
}

.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav > ul > li {
  margin-bottom: 0.15rem;
}

.site-nav a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-color);
  text-decoration: none;
}

.site-nav a:focus-visible {
  outline-offset: -2px;
}

.site-nav a:hover {
  background: var(--surface-hover);
}

.site-nav a[aria-current='page'] {
  border-left-color: var(--primary);
  background: var(--highlight-bg);
  color: var(--highlight-text);
  font-weight: 600;
}

.site-nav ul ul {
  margin: 0.1rem 0 0.4rem 0.75rem;
  font-size: 0.9375rem;
}

.site-nav .nav-title {
  margin: 0 0 0.6rem 0.6rem;
}

/* Treść */

main {
  min-width: 0;
}

.page-head {
  position: relative;
  margin-bottom: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--surface-border);
}

.page-head::before {
  position: absolute;
  top: -1px;
  left: 0;
  width: 1.5rem;
  height: 2px;
  content: '';
  background: var(--primary);
}

h1 {
  margin: 0.35rem 0 0.5rem;
  color: var(--text-strong);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.125rem;
}

.meta {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.section-links a {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
}

.section-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.content {
  max-width: 46rem;
  font-size: 1.0625rem;
  overflow-wrap: break-word;
}

/* Długie adresy w treści nie wychodzą poza ekran telefonu. */
.content a {
  overflow-wrap: anywhere;
}

.content h2,
.content h3,
.content h4 {
  margin: 2em 0 0.6em;
  color: var(--text-strong);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.content h2 {
  font-size: 1.5rem;
}

.content h3 {
  font-size: 1.25rem;
}

.content h4 {
  font-size: 1.0625rem;
}

.content p,
.content ul,
.content ol,
.content table,
.content blockquote,
.content pre,
.content figure {
  margin: 0 0 1.1em;
}

.content li + li {
  margin-top: 0.3em;
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25em 0;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
}

.content img.img-small {
  max-width: min(100%, 20rem);
}

.content img.img-medium {
  max-width: min(100%, 32rem);
}

.content img.img-full {
  width: 100%;
}

.content .align-left {
  text-align: left;
}

.content .align-center {
  text-align: center;
}

.content .align-right {
  text-align: right;
}

/* Obraz jest blokiem, więc wyrównanie akapitu przenosimy na jego marginesy. */
.content img.align-center,
.content figure.align-center,
.content .align-center > img {
  margin-right: auto;
  margin-left: auto;
}

.content img.align-right,
.content figure.align-right,
.content .align-right > img {
  margin-left: auto;
}

.content figcaption {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.content blockquote {
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 2px solid var(--border-strong);
  color: var(--text-secondary);
}

.content code {
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  font-size: 0.9em;
}

.content pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
}

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

.content mark {
  padding: 0 0.15em;
  border-radius: var(--radius-sm);
  background: var(--highlight-bg);
  color: var(--highlight-text);
}

.content hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--surface-border);
}

.content .table-wrap {
  margin: 0 0 1.1em;
  overflow-x: auto;
}

.content table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.content .table-wrap table {
  margin: 0;
  max-width: none;
}

.content caption {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: left;
}

.content th,
.content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--surface-border);
  text-align: left;
  vertical-align: top;
}

.content th {
  background: var(--surface-subtle);
  font-weight: 600;
}

.content .note,
.content .warning {
  margin: 0 0 1.1em;
  padding: 0.85rem 1rem;
  border: 1px solid var(--surface-border);
  border-left: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface-card);
}

.content .warning {
  border-color: var(--warning-border);
  border-left-color: var(--signal);
  background: var(--warning-surface);
}

.content .note > :last-child,
.content .warning > :last-child {
  margin-bottom: 0;
}

/* Listy stron */

.page-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: block;
  height: 100%;
  padding: 1rem 1.15rem;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--text-color);
  text-decoration: none;
}

.card:hover {
  border-color: var(--primary);
}

.card strong {
  display: block;
  color: var(--text-strong);
  font-weight: 600;
}

.card:hover strong {
  color: var(--primary);
}

.card span {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 2.5rem;
  padding: 0;
  list-style: none;
}

/* Kafelki ze znaczników [[menu]] i [[dzial:…]] w treści artykułu. */
.content .tiles {
  margin: 1.5rem 0 1.75rem;
  font-size: 1rem;
}

.content .tiles li + li {
  margin-top: 0;
}

.content .tiles a {
  overflow-wrap: normal;
}

/* Widoczne tylko w podglądzie redaktora. */
.shortcode-error {
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--warning-border);
  border-radius: var(--radius);
  background: var(--warning-surface);
  color: var(--warning-text);
  font-size: 0.9375rem;
}

.block-title {
  margin: 0 0 0.85rem;
}

.empty {
  color: var(--text-secondary);
}

/* Stopka */

.site-footer {
  border-top: 1px solid var(--surface-border);
  background: var(--surface-card);
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  padding-block: 1.25rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--primary);
}

.preview-banner {
  padding: 0.5rem clamp(1rem, 4vw, 2.5rem);
  background: var(--warning-surface);
  color: var(--warning-text);
  font-size: 0.875rem;
  font-weight: 600;
}
