/* =========================================================
   Szymon Wojcieszonek, portfolio
   Kolory, font i odstępy ustawiasz w :root
   ========================================================= */

:root {
  --bg: #141518;          /* tło */
  --surface: #1b1d21;     /* tło pod wideo / placeholdery */
  --line: #2c2f35;        /* cienkie linie */
  --line-strong: #474b53; /* linie wyróżnione, obramowania */
  --text: #e7e5e0;        /* tekst główny */
  --muted: #8f939b;       /* tekst drugorzędny */
  --key: #f2b441;         /* akcent: kolor zaznaczonego klucza w Blenderze */

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  --content: 1040px;      /* maks. szerokość treści */
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --rail: 0px;            /* miejsce na boczne menu (desktop) */
  --section-space: clamp(4.5rem, 10vw, 8rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (min-width: 1100px) {
  :root { --rail: 140px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, video, iframe { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

body.menu-open { overflow: hidden; }

::selection { background: var(--key); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--key);
  outline-offset: 4px;
}

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

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--text); color: var(--bg); padding: .5rem 1rem; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

/* Placeholdery: dobrze widoczne, żeby nic nie umknęło przed publikacją */
.ph { color: var(--muted); font-style: italic; }
.ph-box {
  display: grid; place-items: center; text-align: center;
  padding: 1.5rem;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted); font-style: italic; font-size: .9rem;
}

/* ---------- Górny pasek ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.5rem var(--gutter);
  border-bottom: 1px solid var(--line);
}
.topbar__name {
  text-decoration: none;
  font-weight: 500;
  font-stretch: 112%;
  letter-spacing: .01em;
}
.topbar__nav { display: flex; gap: .75rem; color: var(--muted); }
.topbar__nav a { text-decoration: none; color: var(--text); transition: color .2s; }
.topbar__nav a:hover { color: var(--key); }

/* ---------- Boczne menu: oś czasu ---------- */
.timeline {
  position: fixed;
  right: clamp(1rem, 2.5vw, 2.25rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  font-size: .875rem;
}
.timeline__frame {
  text-align: right;
  color: var(--muted);
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  margin: 0 0 1.25rem;
  padding-right: 22px;
}
.timeline__list {
  position: relative;
  display: grid;
  gap: 1.75rem;
}
/* pionowa linia osi */
.timeline__list::before {
  content: "";
  position: absolute;
  right: 5px;
  top: -1.5rem; bottom: -1.5rem;
  width: 1px;
  background: var(--line-strong);
}
.timeline__list a {
  display: flex; align-items: center; justify-content: flex-end; gap: .9rem;
  text-decoration: none;
  color: var(--muted);
  transition: color .25s;
}
.timeline__list a:hover,
.timeline__list a.is-active { color: var(--text); }

/* klucz animacji (romb) */
.key {
  position: relative;
  width: 11px; height: 11px;
  flex: none;
}
.key::before {
  content: "";
  position: absolute; inset: 1.5px;
  transform: rotate(45deg);
  border: 1px solid var(--muted);
  background: var(--bg);
  transition: background .25s, border-color .25s, transform .25s var(--ease);
}
.timeline__list a:hover .key::before { border-color: var(--text); }
.timeline__list a.is-active .key::before {
  background: var(--key);
  border-color: var(--key);
  transform: rotate(45deg) scale(1.25);
}

/* wskaźnik odtwarzania, przesuwa się razem ze scrollem */
.timeline__playhead {
  position: absolute;
  right: -2px;
  top: 0;
  width: 15px; height: 1px;
  background: var(--key);
  pointer-events: none;
  will-change: transform;
}

/* jedyna animacja wejścia: klucze pojawiają się po kolei */
@media (prefers-reduced-motion: no-preference) {
  .timeline__list li { animation: key-in .5s var(--ease) backwards; }
  .timeline__list li:nth-child(1) { animation-delay: .15s; }
  .timeline__list li:nth-child(2) { animation-delay: .25s; }
  .timeline__list li:nth-child(3) { animation-delay: .35s; }
  .timeline__list li:nth-child(4) { animation-delay: .45s; }
  .timeline__playhead { transition: transform .12s linear; }
}
@keyframes key-in {
  from { opacity: 0; transform: translateX(8px); }
}

/* przycisk menu (tylko telefon/tablet) */
.menu-toggle {
  display: none;
  position: fixed; top: .9rem; right: .9rem; z-index: 60;
  width: 46px; height: 46px;
  place-items: center;
  background: rgba(20, 21, 24, .85);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(6px);
}
.menu-toggle__bars { display: grid; gap: 5px; width: 20px; }
.menu-toggle__bars span {
  display: block; height: 1.5px; background: var(--text);
  transition: transform .3s var(--ease), opacity .2s;
}
.menu-toggle[aria-expanded="true"] .menu-toggle__bars span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bars span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 1099px) {
  .topbar__nav { display: none; }
  .topbar { padding-right: calc(46px + 1.8rem); }
  .menu-toggle { display: grid; }

  .timeline {
    inset: 0;
    transform: none;
    display: flex; flex-direction: column; justify-content: center; align-items: flex-end;
    padding: 0 calc(var(--gutter) + 6px);
    background: rgba(20, 21, 24, .97);
    font-size: 1.75rem;
    font-stretch: 112%;
    font-weight: 300;
    opacity: 0; visibility: hidden;
    transition: opacity .3s, visibility 0s .3s;
  }
  .timeline.is-open { opacity: 1; visibility: visible; transition: opacity .3s; }
  .timeline__list { gap: 2.25rem; }
  .timeline__list li { animation: none; }
  .timeline__frame { font-size: .8rem; font-stretch: 100%; font-weight: 400; }
  .key { width: 14px; height: 14px; }
  .timeline__playhead { display: none; }
}

/* ---------- Układ treści ---------- */
main {
  max-width: calc(var(--content) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
@media (min-width: 1100px) {
  /* odsunięcie, żeby treść nie wchodziła pod boczne menu */
  main {
    max-width: calc(var(--content) + (var(--gutter) + var(--rail)) * 2);
    padding-inline: calc(var(--gutter) + var(--rail));
  }
}

section { scroll-margin-top: 1.5rem; }

.section {
  padding-block: var(--section-space);
  border-top: 1px solid var(--line);
}

.section__head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.section__head h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 300;
  font-stretch: 118%;
  line-height: 1.1;
  letter-spacing: -.01em;
}

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .8rem 1.4rem;
  border: 1px solid var(--line-strong);
  text-decoration: none;
  font-size: .95rem;
  transition: border-color .2s, background .2s, color .2s;
}
.btn:hover { border-color: var(--text); }
.btn--solid { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--solid:hover { background: transparent; color: var(--text); }

/* ---------- Start ---------- */
.hero {
  padding-block: clamp(4rem, 14vh, 9rem) clamp(4rem, 10vh, 7rem);
}
.hero__role {
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.hero__name {
  font-size: clamp(2.75rem, 9vw, 7.5rem);
  font-weight: 250;
  font-stretch: 125%;
  line-height: .95;
  letter-spacing: -.025em;
}
.hero__intro {
  max-width: 34rem;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  font-size: 1.125rem;
}
.hero__actions {
  display: flex; flex-wrap: wrap; gap: .75rem;
  margin-top: 2.25rem;
}

/* ---------- Wideo (YouTube ładowany dopiero po kliknięciu) ---------- */
.video {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.video iframe,
.video video,
.video__poster,
.video__poster img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: 0; object-fit: cover;
}
.video__poster { cursor: pointer; }
.video__poster img { transition: opacity .3s; opacity: .85; }
.video__poster:hover img { opacity: 1; }
.video__play {
  position: absolute; left: 50%; top: 50%;
  width: 64px; height: 64px; margin: -32px 0 0 -32px;
  border: 1px solid rgba(231, 229, 224, .8);
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(20, 21, 24, .45);
  transition: transform .25s var(--ease), border-color .25s;
}
.video__play svg { width: 18px; height: 18px; margin-left: 3px; fill: var(--text); }
.video__poster:hover .video__play { transform: scale(1.08); border-color: var(--key); }
.video__empty {
  position: absolute; inset: 0;
  display: grid; place-items: center; text-align: center;
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  color: var(--muted); font-style: italic; font-size: .9rem;
}

/* ---------- Projekty ---------- */
.project + .project { margin-top: clamp(4rem, 9vw, 6.5rem); }

.project__toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title chev" "meta chev";
  align-items: center;
  column-gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}
.project__title {
  grid-area: title;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  font-weight: 400;
  font-stretch: 112%;
  line-height: 1.2;
}
.project__meta { grid-area: meta; font-size: .9rem; margin-top: .25rem; }
.chevron {
  grid-area: chev;
  width: 28px; height: 28px;
  fill: none; stroke: var(--text); stroke-width: 1.25;
  transition: transform .4s var(--ease), stroke .2s;
}
.project__toggle:hover .chevron { stroke: var(--key); }
.project__toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* rozwijanie: płynna animacja wysokości */
.project__details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s var(--ease);
}
.project.is-open .project__details { grid-template-rows: 1fr; }
.project__inner { min-height: 0; overflow: hidden; }
.project__inner > :first-child { margin-top: 2rem; }
.project__inner > :last-child { margin-bottom: 1rem; }

.project__desc { max-width: 42rem; }
.project__subhead {
  font-size: 1rem;
  font-weight: 500;
  font-stretch: 112%;
  margin: 2.75rem 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
}
.breakdown__media { display: grid; gap: 1rem; }
.breakdown__text { max-width: 30rem; }
.breakdown__text p + p { margin-top: 1em; }
.breakdown--system { grid-template-columns: 3fr 2fr; }
.breakdown--text-only { display: block; max-width: 42rem; }

@media (max-width: 720px) {
  .breakdown,
  .breakdown--system { grid-template-columns: 1fr; }
}

/* ---------- O mnie ---------- */
.cv-link {
  display: inline-flex; align-items: center; gap: .5rem;
  text-decoration: none;
  color: var(--text);
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .2s, color .2s;
}
.cv-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cv-link:hover { color: var(--key); border-color: var(--key); }

.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}
.about__photo { aspect-ratio: 4 / 5; }
.about__photo img { width: 100%; height: 100%; object-fit: cover; }
.about__bio { max-width: 36rem; font-size: 1.125rem; }
.about__bio p + p { margin-top: 1.1em; }

.about__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  margin-top: clamp(3.5rem, 8vw, 6rem);
}
.col-head {
  font-size: 1.25rem;
  font-weight: 400;
  font-stretch: 112%;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line-strong);
}
.col-sub {
  font-size: .9rem;
  font-weight: 400;
  color: var(--muted);
  margin: 1.75rem 0 .75rem;
}

.tag-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag-list li {
  padding: .35rem .8rem;
  border: 1px solid var(--line-strong);
  font-size: .95rem;
}

.cv-list { display: grid; gap: 1.1rem; }
.cv-list li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 1rem;
}
.cv-list__time { color: var(--muted); font-size: .95rem; font-variant-numeric: tabular-nums; }
.cv-list__what { display: grid; }
.cv-list__what strong { font-weight: 500; }
.cv-list__what span { color: var(--muted); }

.about__extra {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  max-width: 42rem;
}

@media (max-width: 720px) {
  .about,
  .about__cols { grid-template-columns: 1fr; }
  .about__photo { max-width: 420px; }
}

/* ---------- Kontakt ---------- */
.contact__lead { max-width: 36rem; margin-bottom: 2.5rem; font-size: 1.125rem; }

.contacts {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr)); /* mail dostaje więcej miejsca */
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.contacts__item { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.contacts__item a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
  min-height: 11rem;
  padding: 1.5rem 1rem;
  text-decoration: none;
  text-align: center;
  transition: background .25s, color .25s;
}
.contacts__item svg {
  width: 44px; height: 44px;
  fill: none; stroke: var(--text); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round;
  transition: stroke .25s;
}
.contacts__item span { font-size: .95rem; overflow-wrap: anywhere; }
.contacts__item a:hover { background: var(--surface); color: var(--key); }
.contacts__item a:hover svg { stroke: var(--key); }

.contact__cv { margin-top: 2.5rem; }

@media (max-width: 860px) {
  .contacts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .contacts__item--mail { grid-column: 1 / -1; }
  .contacts__item a { min-height: 8rem; padding-inline: .5rem; }
  .contacts__item span { font-size: .875rem; }
}

/* ---------- Stopka ---------- */
.footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  padding: 2rem var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Ograniczony ruch ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; }
}
