/* ==========================================================================
   Portfolio — Marcin Łachacz · Technik Informatyk
   Ciemny motyw z subtelnym akcentem inspirowanym terminalem Linux.

   Spis treści:
   1.  Zmienne i reset
   2.  Układ bazowy i typografia
   3.  Nawigacja (header)
   4.  Przyciski i odznaki
   5.  Hero i terminal
   6.  Sekcje i karty
   7.  Umiejętności
   8.  Projekty
   9.  Kontakt / O mnie
   10. Stopka
   11. Animacje
   12. Responsywność
   13. Ograniczenie animacji (prefers-reduced-motion)
   ========================================================================== */

/* 1. Zmienne i reset
   -------------------------------------------------------------------------- */
:root {
  --bg: #0d1117;
  --bg-soft: #10161e;
  --card: #141b23;
  --border: #263140;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4cc38a;
  --accent-strong: #5fd9a0;
  --accent-soft: rgba(76, 195, 138, 0.12);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  --radius: 10px;
  --container: 1060px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: rgba(76, 195, 138, 0.3); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.6em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3.5rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 1rem; color: var(--accent); text-decoration: none; }

/* 2. Układ bazowy
   -------------------------------------------------------------------------- */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.section { padding-block: 4rem; }
.section + .section { padding-top: 0; }

.section-intro { color: var(--muted); max-width: 46rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}
.eyebrow::before { content: "$ "; color: var(--muted); }

.lead { font-size: 1.1rem; color: var(--muted); max-width: 44rem; }

.page-head { padding-block: 3.5rem 0; }
.page-head .lead { margin-bottom: 0; }

/* 3. Nawigacja
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4rem;
}

.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--mono); font-weight: 700; color: var(--text);
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-prompt {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}

.site-nav ul {
  display: flex; gap: 0.35rem;
  margin: 0; padding: 0; list-style: none;
}
.site-nav a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 2.75rem; height: 2.75rem;
  padding: 0 0.6rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
/* pierwszym dzieckiem jest .visually-hidden (etykieta), więc paski to dzieci 2-4 */
.nav-toggle-bar {
  height: 2px; width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-toggle.is-open .nav-toggle-bar:nth-of-type(2) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle-bar:nth-of-type(3) { opacity: 0; }
.nav-toggle.is-open .nav-toggle-bar:nth-of-type(4) { transform: translateY(-7px) rotate(-45deg); }

/* 4. Przyciski i odznaki
   -------------------------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease,
              color 0.2s ease, transform 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--accent); color: #0b1310; }
.btn-primary:hover { background: var(--accent-strong); color: #0b1310; }

.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-soft); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--bg-soft);
  white-space: nowrap;
}
.badge-active {
  color: var(--accent);
  border-color: rgba(76, 195, 138, 0.4);
  background: var(--accent-soft);
}

/* 5. Hero i terminal
   -------------------------------------------------------------------------- */
.hero { padding-block: 5rem 4rem; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 3rem;
  align-items: center;
}

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 0.8rem;
  margin-top: 1.6rem;
}

.terminal {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.terminal-bar {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.terminal-dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--border); }
.terminal-dot:first-child { background: var(--accent-soft); border: 1px solid rgba(76, 195, 138, 0.5); }
.terminal-title { margin-inline: auto; color: var(--muted); font-size: 0.75rem; }

.terminal-body { padding: 1rem 1.1rem 1.2rem; }
.terminal-body p { margin: 0 0 0.45rem; }
.t-prompt { color: var(--accent); }
.t-out { color: var(--muted); padding-left: 1.4rem; }
.t-cursor {
  display: inline-block;
  width: 0.55rem; height: 1.05rem;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* linie terminala pojawiają się z lekkim opóźnieniem */
.terminal-body p { opacity: 0; animation: t-line 0.4s ease forwards; }
.terminal-body p:nth-child(1) { animation-delay: 0.2s; }
.terminal-body p:nth-child(2) { animation-delay: 0.55s; }
.terminal-body p:nth-child(3) { animation-delay: 0.9s; }
.terminal-body p:nth-child(4) { animation-delay: 1.25s; }
.terminal-body p:nth-child(5) { animation-delay: 1.6s; }

@keyframes t-line {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* 6. Sekcje i karty
   -------------------------------------------------------------------------- */
.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(76, 195, 138, 0.45);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.card-link {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.card-link::after { content: " →"; }

.card-top {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 0.5rem;
}
.card-top h3 { margin: 0; }

/* 7. Umiejętności
   -------------------------------------------------------------------------- */
.skill-level {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.level-dots { display: inline-flex; gap: 0.3rem; }
.level-dots span {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
}
.level-dots span.on { background: var(--accent); }
.level-label { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

.skills-note { color: var(--muted); font-size: 0.9rem; margin-top: 1.5rem; }

/* 8. Projekty
   -------------------------------------------------------------------------- */
.project-card p { color: var(--muted); }
.tech {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  margin-top: auto;
}
.tech + .tech { margin-top: 0; }
.tech-label { font-family: var(--mono); font-size: 0.78rem; color: var(--text); }

.project-card.is-placeholder {
  border-style: dashed;
  align-items: center; justify-content: center;
  text-align: center;
  color: var(--muted);
  min-height: 12rem;
}
.project-card.is-placeholder:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

/* 9. Kontakt / O mnie
   -------------------------------------------------------------------------- */
.contact-card h2 { font-size: 1.2rem; }
.contact-card .btn { margin-top: auto; align-self: flex-start; }

.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
.about-text h2 { font-size: 1.2rem; margin-top: 1.5rem; }
.about-text h2:first-child { margin-top: 0; }

.facts {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky; top: 5.5rem;
}
.facts h2 { font-size: 1.15rem; }
.facts dl { margin: 0; display: grid; gap: 0.7rem; }
.facts dt { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.facts dd { margin: 0; font-size: 0.95rem; }

/* 10. Stopka
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 4rem;
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: 0.75rem;
}
.footer-inner p { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }

/* 11. Animacje
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* gdy JS jest wyłączony — elementy mają być po prostu widoczne */
.no-js .reveal { opacity: 1; transform: none; }

.hero-text > * { animation: rise 0.55s ease both; }
.hero-text > *:nth-child(2) { animation-delay: 0.08s; }
.hero-text > *:nth-child(3) { animation-delay: 0.16s; }
.hero-text > *:nth-child(4) { animation-delay: 0.24s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* 12. Responsywność
   -------------------------------------------------------------------------- */
@media (max-width: 880px) {
  .hero { padding-block: 3.5rem 3rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; }
  .facts { position: static; }

  /* menu mobilne */
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1.25rem;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0.25rem; }
  .site-nav a { padding: 0.8rem 1rem; font-size: 1rem; }
}

@media (max-width: 560px) {
  .section { padding-block: 3rem; }
  .page-head { padding-block: 2.5rem 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .terminal { font-size: 0.78rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* 13. Ograniczenie animacji (prefers-reduced-motion)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  .terminal-body p { opacity: 1; animation: none; }
  .t-cursor { animation: none; }
}
