/*
 * dziegielew.ski — jeden arkusz stylów dla wszystkich stron.
 * Zero zasobów zewnętrznych: tylko systemowe fonty, żadnych odwołań do
 * innych plików (CSP: default-src 'none'; style-src 'self'; img-src 'self').
 *
 * Kolejność ma znaczenie: ciemny motyw przed @media print, bo oba nadpisują
 * te same zmienne w :root, a przy równej specyficzności wygrywa późniejsza
 * reguła — wydruk ma być zawsze jasny.
 */

/* ---------- Zmienne ---------- */

:root {
  color-scheme: light dark;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --color-background: #fafaf9;
  --color-text: #1c1917;
  --color-text-muted: #57534e;
  /* Nagłówki sekcji CV, lata, stopka: kontrast >= 4.5:1 do tła (WCAG AA). */
  --color-text-subtle: #78716c;
  --color-border: #e7e5e4;
  --color-accent: #0f766e;
  --color-accent-hover-background: #f0fdfa;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1c1917;
    --color-text: #e7e5e4;
    --color-text-muted: #a8a29e;
    --color-text-subtle: #8a837e;
    --color-border: #3a3532;
    --color-accent: #5ec2b7;
    --color-accent-hover-background: #16302d;
  }
}

/* ---------- Podstawy ---------- */

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

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

body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.625;
}

/* Linki bez podkreślenia (jak na makietach); podkreślenie na :hover i :focus-visible. */
a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img {
  display: block;
  max-width: 100%;
}

/*
 * Układ: nagłówek, treść i stopka to osobne pasy na całą szerokość okna,
 * a w środku wyśrodkowana kolumna (.container). Dzięki temu nagłówek CV może
 * mieć linię na całą szerokość. Stopka zawsze przy dolnej krawędzi okna.
 */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: 47.5rem;
}

main {
  flex: 1;
}

/* ---------- Nagłówek i stopka serwisu ---------- */

.site-header {
  padding: 40px 0;
  font-size: 0.875rem;
}

.site-header .container {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  color: var(--color-text);
  font-weight: 600;
}

.site-header nav {
  display: flex;
  gap: 24px;
}

.site-header nav a {
  color: var(--color-text-muted);
}

.site-header nav a:hover,
.site-header nav a:focus-visible {
  color: var(--color-accent);
}

/* Bieżąca strona: pogrubiona, ciemna. */
.site-header nav a[aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
}

/* Strona CV: linia pod nagłówkiem na całą szerokość i podkreślona bieżąca pozycja. */
.site-header--ruled {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--color-border);
}

.site-header--ruled nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.site-footer {
  margin-top: 64px;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.site-footer p {
  margin: 0;
  padding: 24px 0 40px;
  border-top: 1px solid var(--color-border);
}

/* ---------- Wizytówka ---------- */

.intro {
  display: flex;
  align-items: center;
  gap: 40px;
  margin-top: 8px;
}

.photo {
  flex-shrink: 0;
  width: 160px;
  height: 160px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  object-fit: cover;
  /* Zdjęcie to awatar z GitHuba: kwadrat 460×460 z całą głową, brodą
     i fragmentem ramion, więc kadr zostaje wyśrodkowany. */
  object-position: 50% 50%;
}

h1 {
  margin: 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.role {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
}

.location {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  color: var(--color-text-subtle);
  font-size: 0.875rem;
  line-height: 1.4;
}

.location svg {
  flex-shrink: 0;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.about {
  margin: 48px 0 0;
  color: var(--color-text-muted);
}

.link-list {
  margin: 48px 0 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
  list-style: none;
}

.link-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.link-list .label {
  color: var(--color-text-muted);
}

.link-list a {
  color: var(--color-text);
  font-weight: 500;
  overflow-wrap: anywhere;
  text-align: right;
}

.link-list a:hover,
.link-list a:focus-visible {
  color: var(--color-accent);
}

.button {
  display: inline-block;
  margin-top: 40px;
  padding: 8px 16px;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  color: var(--color-accent);
  font-weight: 500;
}

.button:hover,
.button:focus-visible {
  background: var(--color-accent-hover-background);
  text-decoration: none;
}

/* ---------- Strona 404 ---------- */

.not-found {
  padding-top: 48px;
}

.not-found p {
  margin: 16px 0 0;
  color: var(--color-text-muted);
}

/* ---------- CV ---------- */

.cv main {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.cv-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--color-border);
}

.cv-header .role {
  font-size: 1rem;
}

.cv-header .photo {
  width: 120px;
  height: 120px;
}

.contact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

/* Kropka rozdzielająca e-mail, GitHub i LinkedIn (jak na makiecie). */
.contact-list li + li::before {
  content: "·";
  margin-right: 12px;
  color: var(--color-text-subtle);
}

.cv-section {
  margin-top: 48px;
}

.cv-section + .cv-section {
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.cv-section h2 {
  margin: 0 0 24px;
  color: var(--color-text-subtle);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Oś czasu: lata po lewej, opis po prawej. */
.cv-section p {
  margin: 0;
}

.timeline {
  display: grid;
  grid-template-columns: 130px 1fr;
  column-gap: 24px;
  row-gap: 14px;
  align-items: baseline;
  margin: 0;
}

.timeline dt {
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline dd {
  margin: 0;
}

.bullets {
  margin: 0;
  padding-left: 1.25rem;
}

.bullets li {
  margin-bottom: 8px;
  break-inside: avoid;
}

.bullets li::marker {
  color: var(--color-text-subtle);
}

.level {
  color: var(--color-text-subtle);
}

@media (min-width: 48rem) {
  .container--wide {
    padding: 0 40px;
  }

  .bullets--columns {
    column-count: 2;
    column-gap: 40px;
  }
}

/* ---------- Wąskie ekrany (ta sama kolumna, zwężona) ---------- */

@media (max-width: 40rem) {
  body {
    font-size: 1rem;
  }

  .site-header,
  .site-header--ruled {
    padding: 20px 0;
  }

  .intro {
    flex-direction: column;
    gap: 24px;
    text-align: center;
  }

  .intro .location {
    justify-content: center;
  }

  .photo {
    width: 120px;
    height: 120px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .role {
    font-size: 1rem;
  }

  .link-list li {
    padding: 14px 0;
  }

  .button {
    display: block;
    padding: 12px 16px;
    text-align: center;
  }

  .cv-header {
    padding-top: 28px;
  }

  .cv-header .photo {
    width: 88px;
    height: 88px;
  }

  .timeline {
    display: block;
  }

  .timeline dt {
    margin-top: 14px;
  }

  .timeline dd {
    margin-top: 2px;
  }
}

/* ---------- Ciemny motyw systemu + wydruk: zawsze jasny ---------- */

@media print {
  @page {
    size: A4;
    margin: 1.5cm;
  }

  :root {
    color-scheme: light;
    --color-background: #fff;
    --color-text: #000;
    --color-text-muted: #333;
    --color-text-subtle: #444;
    --color-border: #999;
    --color-accent: #000;
    --color-accent-hover-background: #fff;
  }

  body {
    min-height: 0;
    font-size: 11pt;
    line-height: 1.45;
  }

  .site-header,
  .site-footer {
    display: none;
  }

  .container,
  .container--wide {
    max-width: none;
    padding: 0;
  }

  .cv main {
    font-size: 11pt;
  }

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

  /* Papier nie ma linków: przy firmach pokazujemy adres. */
  .timeline a[href^="http"]::after {
    content: " (" attr(href) ")";
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 0.8em;
    overflow-wrap: anywhere;
  }

  .cv-header {
    padding-top: 0;
  }

  .cv-header .photo {
    width: 90px;
    height: 90px;
  }

  .cv-section {
    margin-top: 20pt;
  }

  .cv-section + .cv-section {
    padding-top: 12pt;
  }

  /* Sekcje mogą się łamać między stronami (bez pustych połówek stron);
     nie łamiemy tylko wewnątrz pojedynczego wpisu, a nagłówek sekcji
     nie zostaje sam na dole strony. */
  .cv-section h2 {
    margin-bottom: 10pt;
    break-after: avoid;
  }

  .timeline dt,
  .timeline dd,
  .bullets li,
  .cv-section p {
    break-inside: avoid;
  }

  /* Kolumna dat mieści "2024 – current" w jednej linii. */
  .timeline {
    grid-template-columns: 8rem 1fr;
    row-gap: 6pt;
  }
}
