/* ============================================================
   STYL: TERMINAL — ciemny monospace, akcent emerald,
   tło z pulpitu użytkownika (drewno + neon) z winietą.
   Wspólny HTML, osobny arkusz — brak zależności od JS.
   ============================================================ */

:root {
  --term-bg-deep: #050a08;
  --term-bg: #071009;
  --term-panel: rgba(6, 16, 12, 0.62);
  --term-panel-strong: rgba(4, 12, 9, 0.86);
  --term-fg: #dcf7e7;
  --term-fg-soft: #b9d9c8;
  --term-muted: #8fb3a2;
  --term-emerald: #3ef2a0;
  --term-emerald-dim: #1f9e6a;
  --term-cyan: #7fe9d8;
  --term-amber: #ffd479;
  --term-line: rgba(62, 242, 160, 0.18);
  --term-line-soft: rgba(62, 242, 160, 0.09);
  /* Ostre, „linuksowe” narożniki — bez zaokrągleń w stylu macOS. */
  --term-radius: 6px;
  --term-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SFMono-Regular",
    Consolas, "Liberation Mono", "Courier New", monospace;
  --term-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  font-family: var(--term-mono);
  font-size: 16px;
  line-height: 1.65;
  color: var(--term-fg);
  background-color: var(--term-bg-deep);
  /* Warstwy: przyciemnienie + zdjęcie pulpitu + winieta + delikatny neon */
  background-image:
    linear-gradient(180deg, rgba(3, 8, 6, 0.74) 0%, rgba(3, 9, 7, 0.6) 45%, rgba(2, 6, 5, 0.82) 100%),
    radial-gradient(120% 80% at 50% 0%, rgba(62, 242, 160, 0.1) 0%, transparent 55%),
    radial-gradient(140% 110% at 50% 45%, transparent 45%, rgba(2, 6, 5, 0.78) 100%),
    url("../img/desktop-bg.jpg");
  background-size: cover, cover, cover, cover;
  background-position: center center, center top, center center, center 35%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

/* Bardzo delikatne scanline'y — czytelność bez „brudu” */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(180, 255, 220, 0.028) 0px,
    rgba(180, 255, 220, 0.028) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: soft-light;
  opacity: 0.7;
}

/* Neonowa poświata w tle (nie przeszkadza w czytaniu) */
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  top: -18vmax;
  right: -12vmax;
  width: 46vmax;
  height: 46vmax;
  pointer-events: none;
  background: radial-gradient(circle, rgba(62, 242, 160, 0.16) 0%, rgba(62, 242, 160, 0.05) 42%, transparent 68%);
  filter: blur(10px);
}

/* ---------- Nagłówek: okno terminala ---------- */

/* Szerokość dobrana do miary wiersza (~75ch), żeby tekst wypełniał panel. */
.pw-header {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 64px 24px 0;
}

/* Pasek tytułu jak w GNOME / KDE (Adwaita), nie jak macOS:
   po lewej ikonka-prompt i „user@host: ~/katalog”, po prawej
   prostokątne kontrolki „— □ ✕” w szarości. */
.pw-header::before {
  content: ">_ lukasz@przybyl: ~/personal_www";
  display: block;
  margin: 0 auto -1px;
  max-width: 100%;
  padding: 10px 132px 10px 16px;
  font-size: 12.5px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--term-fg-soft);
  background: linear-gradient(180deg, rgba(20, 32, 27, 0.94), rgba(7, 16, 12, 0.94));
  border: 1px solid var(--term-line);
  border-left: 3px solid var(--term-emerald-dim);
  border-bottom: 1px solid rgba(62, 242, 160, 0.3);
  border-radius: var(--term-radius) var(--term-radius) 0 0;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(62, 242, 160, 0.18);
}

/* Kontrolki okna w stylu Adwaita: szare, prostokątne, bez kropek. */
.pw-header::after {
  content: "—\00a0\00a0\00a0□\00a0\00a0\00a0✕";
  position: absolute;
  /* Pasek startuje po 64px paddingu nagłówka — kontrolki leżą w jego obrębie. */
  top: 64px;
  right: 24px;
  display: flex;
  align-items: center;
  height: 39px;
  padding: 0 12px;
  font-family: var(--term-mono);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--term-fg-soft);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--term-line);
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0 var(--term-radius) 0 0;
  transition: background-color 140ms ease, color 140ms ease;
}

.pw-header::after:hover {
  color: var(--term-fg);
  background: rgba(255, 255, 255, 0.08);
}

.pw-header h1 {
  margin: 0;
  padding: 34px 32px 0;
  font-family: var(--term-mono);
  font-size: clamp(28px, 4.4vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #eafff3;
  background: var(--term-panel);
  border: 1px solid var(--term-line);
  border-top: 0;
  border-bottom: 0;
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  text-shadow: 0 0 26px rgba(62, 242, 160, 0.35), 0 1px 0 rgba(0, 0, 0, 0.6);
}

.pw-header h1::before {
  content: "$ ";
  color: var(--term-emerald);
  font-weight: 400;
  text-shadow: 0 0 14px rgba(62, 242, 160, 0.55);
}

.pw-header .pw-tagline {
  margin: 0;
  padding: 10px 32px 26px;
  font-size: clamp(13px, 1.4vw, 15px);
  color: var(--term-cyan);
  background: var(--term-panel);
  border: 1px solid var(--term-line);
  border-top: 0;
  border-radius: 0 0 var(--term-radius) var(--term-radius);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  /* Bez „unoszącego się okna” — tylko cienka linia i delikatny cień. */
  box-shadow: 0 16px 32px -28px rgba(0, 0, 0, 0.9);
  overflow-wrap: anywhere;
}

.pw-header .pw-tagline::before {
  content: "> ";
  color: var(--term-emerald-dim);
}

/* ---------- Treść ---------- */

.pw-container {
  position: relative;
  z-index: 1;
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px 8px;
  display: grid;
  gap: 18px;
}

.pw-section {
  position: relative;
  padding: 26px 28px 28px;
  background: var(--term-panel);
  border: 1px solid var(--term-line);
  border-radius: var(--term-radius);
  box-shadow: 0 16px 36px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(190, 255, 220, 0.05);
  backdrop-filter: blur(14px) saturate(125%);
  -webkit-backdrop-filter: blur(14px) saturate(125%);
}

/* Lewy „pasek promptu” */
.pw-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--term-emerald), rgba(62, 242, 160, 0.08));
  opacity: 0.85;
}

.pw-section h2 {
  margin: 0 0 12px;
  font-family: var(--term-mono);
  font-size: clamp(15px, 1.7vw, 17px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--term-emerald);
  text-shadow: 0 0 18px rgba(62, 242, 160, 0.35);
}

.pw-section h2::before {
  content: "❯ ";
  color: var(--term-emerald-dim);
}

.pw-section p {
  /* Odstęp między akapitami — monospace potrzebuje go wyraźnie więcej. */
  margin: 0 0 1.2em;
  color: var(--term-fg-soft);
  font-size: 15px;
  width: 100%;
  max-width: 110ch;
}

.pw-section p:last-child {
  margin-bottom: 0;
}

.pw-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 110ch;
  display: grid;
  gap: 2px;
}

.pw-section li {
  position: relative;
  padding: 9px 0 9px 26px;
  color: var(--term-fg-soft);
  font-size: 15px;
  border-bottom: 1px dashed var(--term-line-soft);
}

.pw-section li:last-child {
  border-bottom: 0;
}

.pw-section li::before {
  content: "›";
  position: absolute;
  left: 4px;
  top: 7px;
  color: var(--term-emerald);
  opacity: 0.85;
}

.pw-section a {
  color: var(--term-emerald);
  text-decoration: none;
  border-bottom: 1px solid rgba(62, 242, 160, 0.45);
  padding-bottom: 1px;
  overflow-wrap: anywhere;
}

.pw-section a:hover,
.pw-section a:focus-visible {
  color: #b6ffe0;
  border-bottom-color: #b6ffe0;
  text-shadow: 0 0 16px rgba(62, 242, 160, 0.5);
}

/* ---------- Stopka / przełącznik ---------- */

.pw-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px 24px;
  max-width: 1160px;
  margin: 22px auto 0;
  padding: 18px 24px 40px;
  color: var(--term-muted);
  font-size: 13px;
  border-top: 1px solid var(--term-line-soft);
}

.pw-theme-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pw-theme-switch label {
  color: var(--term-muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

#theme-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 34px 8px 12px;
  font-family: var(--term-mono);
  font-size: 13px;
  color: var(--term-fg);
  background-color: rgba(6, 18, 13, 0.95);
  background-image: linear-gradient(45deg, transparent 50%, var(--term-emerald) 50%),
    linear-gradient(135deg, var(--term-emerald) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid rgba(62, 242, 160, 0.35);
  border-radius: 6px;
  cursor: pointer;
}

#theme-select:hover {
  border-color: var(--term-emerald);
}

#theme-select:focus-visible {
  outline: 2px solid var(--term-emerald);
  outline-offset: 2px;
}

/* ---------- Responsywność ---------- */

@media (max-width: 760px) {
  body {
    background-attachment: scroll;
    background-position: center center, center top, center center, 62% center;
  }

  .pw-header {
    padding: 28px 16px 0;
  }

  .pw-header::before {
    padding: 9px 112px 9px 12px;
    font-size: 11.5px;
  }

  .pw-header::after {
    top: 28px;
    right: 16px;
    height: 35px;
    padding: 0 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .pw-header h1 {
    padding: 26px 20px 0;
  }

  .pw-header .pw-tagline {
    padding: 8px 20px 20px;
    line-height: 1.55;
  }

  .pw-container {
    padding: 20px 16px 4px;
    gap: 14px;
  }

  .pw-section {
    padding: 22px 20px 22px;
  }

  .pw-section::before {
    top: 14px;
    bottom: 14px;
  }

  .pw-section p,
  .pw-section ul {
    max-width: 100%;
  }

  .pw-section p,
  .pw-section li {
    font-size: 14.5px;
  }

  .pw-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 16px 32px;
  }
}

@media (max-width: 420px) {
  .pw-header h1 {
    font-size: 26px;
  }

  .pw-theme-switch {
    width: 100%;
    justify-content: space-between;
  }

  #theme-select {
    max-width: 62%;
  }
}

/* ---------- Dostępność / preferencje ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  body::after {
    filter: none;
  }

  .pw-header::after {
    transition: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --term-panel: rgba(2, 8, 5, 0.94);
    --term-fg-soft: #e6fff1;
    --term-muted: #c2e2d2;
    --term-line: rgba(62, 242, 160, 0.45);
  }
}

::selection {
  background: rgba(62, 242, 160, 0.32);
  color: #f2fff8;
}
