/* HABICO. Jedna kaskada, zmienne na górze, potem układ, komponenty, sekcje, media queries. */

:root {
  --cream: #F6F1E4;
  --cream-soft: #EFE8D6;
  --ink: #1A1813;
  --muted-ink: #4A4435;
  --dark: #14130F;
  --dark-surface: #201E17;
  --cream-text: #F6F1E4;
  --muted-cream: #C9C2AE;
  --accent: #B8894A;
  --accent-strong: #8A6328;
  --accent-on-photo: #E0B574;
  --border-light: rgba(26, 24, 19, 0.12);
  --border-dark: rgba(246, 241, 228, 0.14);
  --focus: var(--accent-strong);

  --font-display: 'Syne', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-accent: 'Fraunces', 'Times New Roman', serif;

  --container: 1240px;
  --pad-inline: clamp(20px, 5vw, 64px);
  --section-pad: clamp(72px, 10vw, 128px);
  --radius-pill: 999px;
  --radius-card: 20px;
}

/* Reset minimalny */

*, *::before, *::after { box-sizing: border-box; }
/* Bez scroll-behavior: smooth. Płynne przejścia do sekcji robi app.js, bo globalne
   płynne przewijanie psuło pomiary pinu hero przy odświeżeniu układu. */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
}
html, body { max-width: 100%; }
main section, .project-card { scroll-margin-top: 112px; }
/* Sekcje dostają fokus tylko programowo, po przejściu z menu (punkt startu dla Tab). */
main section:focus { outline: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ol, ul { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  color: var(--cream);
  padding: 12px 20px;
  border-radius: 10px;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 16px;
}

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

.hero :focus-visible,
.tech-section :focus-visible,
.site-footer :focus-visible {
  --focus: var(--accent);
}

/* Typografia wspólna */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.accent-word {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
}
.projects .accent-word,
.contact .accent-word {
  color: var(--accent-strong);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
  margin-bottom: 14px;
}
.tech-section .eyebrow { color: var(--accent); }

.lead {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--muted-ink);
  max-width: 46ch;
}
.tech-section .lead,
.hero .lead { color: var(--muted-cream); }
.hero .lead { max-width: 52ch; }

/* Layout helpers */

.site-container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--pad-inline);
}

/* Zdjęcia z sekcji pod hero. W pierwszym układzie strony, zanim skrypt doda odstęp
   pinu, leżą tuż pod ekranem, więc przeglądarka pobierała je od razu mimo
   loading="lazy" i zabierały łącze filmowi. Element bez pudełka nie jest pobierany.
   Klasę layout-ready dodaje app.js po utworzeniu pinu (awaryjnie boot.js po load). */
html.js:not(.reduced):not(.layout-ready) .gallery-track img,
html.js:not(.reduced):not(.layout-ready) .tech-image {
  display: none;
}

.reveal-up {
  opacity: 0;
  transform: translateY(28px);
}
html:not(.js) .reveal-up,
html.reduced .reveal-up,
html.no-gsap .reveal-up {
  opacity: 1;
  transform: none;
}

/* Przyciski */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.btn .arrow { transition: transform 0.2s ease; }
.btn:hover .arrow,
.btn:focus-visible .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  border: 1px solid rgba(246, 241, 228, 0.18);
  box-shadow: 0 10px 24px -14px rgba(20, 19, 15, 0.6);
}
.btn-primary:hover { background: #262319; }

.btn-secondary {
  padding: 14px 4px;
  color: inherit;
  border-bottom: 1px solid transparent;
}
.btn-secondary .arrow { color: var(--accent-strong); }
.hero .btn-secondary .arrow { color: var(--accent-on-photo); }
.tech-section .btn-secondary .arrow { color: var(--accent); }
.btn-secondary:hover,
.btn-secondary:focus-visible { border-bottom-color: currentColor; }

.btn-small { padding: 10px 20px; font-size: 0.85rem; }
.btn-large { padding: 18px 34px; font-size: 1.05rem; margin-top: 8px; }

/* Nav pływający */

.site-header {
  position: fixed;
  top: clamp(12px, 2.4vw, 24px);
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-inline: var(--pad-inline);
}

.nav-pill {
  width: 100%;
  max-width: calc(var(--container) - 2 * var(--pad-inline) + 40px);
  background: var(--cream);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  box-shadow: 0 14px 34px -18px rgba(20, 19, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 10px 10px 22px;
}

.wordmark {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}
a.wordmark::after {
  content: "";
  position: absolute;
  inset: -8px 0;
}
.wordmark-icon {
  /* Niebieski gradient to świadomy, tymczasowy wyjątek od reszty palety
     (reużywa istniejącego znaku marki), celowo nie wchodzi do --accent/--ink. */
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2954C7, #1F3F99);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  flex: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
  font-weight: 500;
  font-size: 0.92rem;
}
.site-nav a { padding: 6px 2px; border-bottom: 1px solid transparent; }
.site-nav a:hover,
.site-nav a:focus-visible { border-bottom-color: var(--accent-strong); }

/* Prawa strona paska: przełącznik języka, przycisk i menu. */
.nav-end {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Przełącznik języka: bieżąca wersja podkreślona, druga jest linkiem do swojego adresu. */
.lang-switch {
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}
.lang-switch > * {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 44px;
}
.lang-switch > * + *::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  margin-top: -7px;
  background: var(--border-light);
}
.lang-current {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-strong);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.lang-switch a { min-width: 44px; color: var(--muted-ink); }
.lang-switch a:hover,
.lang-switch a:focus-visible { color: var(--ink); }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.nav-toggle-bars { position: relative; }
.nav-toggle-bars::before,
.nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }

.mobile-nav {
  margin-top: 10px;
  width: 100%;
  max-width: calc(var(--container) - 2 * var(--pad-inline) + 40px);
  background: var(--cream);
  border-radius: 24px;
  box-shadow: 0 14px 34px -18px rgba(20, 19, 15, 0.45);
  padding: 18px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-nav[hidden] {
  display: none;
}
.mobile-nav a {
  padding: 12px 4px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}
.mobile-nav .btn { margin-top: 14px; justify-content: center; }

/* Hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--dark);
}

.hero-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.hero-media picture { display: contents; }
.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transform-origin: 50% 35%;
  will-change: transform;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.hero-video.is-ready { opacity: 1; }
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(20, 19, 15, 0.92) 0%, rgba(20, 19, 15, 0.55) 38%, rgba(20, 19, 15, 0.18) 68%, rgba(20, 19, 15, 0.32) 100%),
    linear-gradient(100deg, rgba(20, 19, 15, 0.5) 0%, rgba(20, 19, 15, 0) 55%);
}

.hero-content {
  position: relative;
  z-index: 2;
  color: var(--cream-text);
  padding: calc(var(--section-pad) * 0.6) var(--pad-inline) max(calc(var(--section-pad) * 0.55), 88px);
  max-width: 820px;
}
.hero .accent-word { color: var(--accent-on-photo); }
.hero .btn-primary { border-color: rgba(246, 241, 228, 0.45); }

.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.4rem);
  line-height: 1.05;
  margin-bottom: 22px;
}

.hero .cta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 30px;
}

/* Sterowanie przelotem: wskazówka, pasek postępu ujęć i wyjście. Pojawia się dopiero,
   gdy film jest pobrany i hero przypięte (klasa is-armed z app.js). */
.hero-hud {
  position: absolute;
  left: var(--pad-inline);
  bottom: 30px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hero.is-armed .hero-hud { opacity: 1; }
.hero-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--cream-text);
}
.hero-cue-arrow {
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: hero-cue-nudge 1.6s ease-in-out infinite;
}
@keyframes hero-cue-nudge {
  0%, 100% { transform: translateY(0) rotate(45deg); }
  50% { transform: translateY(5px) rotate(45deg); }
}
.hero-progress {
  display: flex;
  gap: 6px;
  width: min(200px, 44vw);
}
.hero-progress span {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(246, 241, 228, 0.3);
  overflow: hidden;
}
.hero-progress i {
  display: block;
  height: 100%;
  background: var(--cream-text);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.hero-skip {
  position: absolute;
  right: var(--pad-inline);
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--cream-text);
  background: rgba(20, 19, 15, 0.55);
  border: 1px solid rgba(246, 241, 228, 0.32);
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
}
.hero-skip:hover { background: rgba(20, 19, 15, 0.78); }

/* Filary */

.projects, .contact {
  padding: var(--section-pad) 0;
}
.projects { background: var(--cream); }

.section-head { max-width: 640px; margin-bottom: clamp(36px, 5vw, 56px); }
.section-head h2, .contact h2 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.1;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}

.project-card {
  background: var(--cream-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.project-media {
  aspect-ratio: 3 / 2;
  overflow: hidden;
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.project-body { padding: 24px 26px 30px; }

/* Galeria zdjęć na karcie projektu, przełączana jak karuzela na Instagramie */
.project-gallery {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}
.gallery-track {
  display: flex;
  height: 100%;
  touch-action: pan-y;
  transition: transform 0.35s ease;
}
.gallery-track img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  display: flex;
  justify-content: center;
}
/* Kropka wygląda na 8 px, ale pole dotyku ma 24 px. */
.gallery-dot {
  position: relative;
  width: 24px;
  height: 24px;
  border: none;
  padding: 0;
  cursor: pointer;
}
.gallery-dot::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(20, 19, 15, 0.18);
}
.gallery-dot.is-active::before { background: #fff; }
.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(20, 19, 15, 0.62);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.gallery-arrow:hover { background: rgba(20, 19, 15, 0.82); }
.gallery-arrow[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.gallery-arrow[aria-disabled="true"]:hover { background: rgba(20, 19, 15, 0.62); }
.gallery-arrow-prev { left: 12px; }
.gallery-arrow-next { right: 12px; }
.project-status {
  font-family: var(--font-display);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.project-card h3 { font-size: 1.25rem; margin-bottom: 6px; }
.project-card p:last-child { color: var(--muted-ink); line-height: 1.65; }

@media (min-width: 900px) {
  .project-card {
    display: grid;
    grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  }
  .project-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 3.4vw, 48px);
  }
  .project-card h3 { font-size: clamp(1.5rem, 2.2vw, 2rem); margin-bottom: 12px; }
  .project-card p:last-child { font-size: 1.05rem; }
}

/* Technologia / AI */

.tech-section {
  background: var(--dark);
  color: var(--cream-text);
  padding: var(--section-pad) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
.tech-section > * { padding-inline: var(--pad-inline); }
.tech-media { order: 2; }
.tech-content { order: 1; padding-left: max(var(--pad-inline), calc((100vw - var(--container)) / 2 + var(--pad-inline))); }
.tech-media { padding-right: max(var(--pad-inline), calc((100vw - var(--container)) / 2 + var(--pad-inline))); }

.tech-image {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 28px;
  border: 1px solid var(--border-dark);
}

.tech-content h2 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.12; margin-bottom: 18px; }

.projects .lead { max-width: 60ch; margin-top: 18px; }

/* Kontakt */

.contact { background: var(--cream-soft); }
.contact-inner {
  max-width: 640px;
  margin-inline: auto;
  padding-inline: var(--pad-inline);
  text-align: center;
}
.contact h2 { margin-bottom: 16px; }
.contact .lead { margin-inline: auto; margin-bottom: 30px; }
.contact-email {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 1.05rem;
}
.contact-email a { position: relative; border-bottom: 1px solid var(--border-light); }
.contact-email a::after {
  content: "";
  position: absolute;
  inset: -9px 0;
}
.contact-email a:hover,
.contact-email a:focus-visible { border-bottom-color: var(--accent-strong); }
.copy-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  min-height: 44px;
  padding: 6px 16px;
}
.copy-btn:hover { background: rgba(26, 24, 19, 0.06); }
.copy-status { min-height: 1.4em; font-size: 0.85rem; color: var(--accent-strong); margin-top: 10px; }

/* Stopka */

.site-footer {
  background: var(--dark);
  color: var(--muted-cream);
}
.footer-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: 56px var(--pad-inline) 44px;
  text-align: center;
}
.footer-wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--cream-text);
  margin-bottom: 10px;
}
.footer-note { font-size: 0.85rem; }
.footer-legal {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted-cream);
  opacity: 0.75;
  margin-top: 8px;
}

/* Telefon */

@media (max-width: 900px) {
  .tech-section { grid-template-columns: 1fr; }
  .tech-media, .tech-content { order: initial; padding-left: var(--pad-inline); padding-right: var(--pad-inline); }
  .tech-image { aspect-ratio: 16 / 10; }
}

@media (max-width: 759px) {
  .site-nav, .nav-cta { display: none; }
  .nav-toggle { display: flex; }
  .nav-end { gap: 4px; }
  .hero-content { max-width: 100%; }
  .hero h1 { font-size: clamp(2.1rem, 9vw, 2.8rem); }
  /* Na wąskim ekranie akapit leży na jaśniejszych partiach kadru, więc dostaje kolor nagłówka. */
  .hero .lead { color: var(--cream-text); }
}

/* Wąski telefon: logo, przełącznik języka i przycisk menu muszą zmieścić się w jednym pasku. */
@media (max-width: 389px) {
  .nav-pill { gap: 10px; padding-left: 18px; }
  .lang-switch > * { min-width: 32px; }
  .lang-switch a { min-width: 40px; }
}
/* Bardzo wąski ekran: zostaje sam link do drugiej wersji językowej.
   a.wordmark to logo w pasku; logo w stopce ma tę samą klasę na <p> i zostaje w swoim rozmiarze. */
@media (max-width: 359px) {
  a.wordmark { font-size: 1rem; }
  .lang-current { display: none; }
  .lang-switch > * + *::before { display: none; }
}
@media (max-width: 319px) {
  .nav-pill { gap: 6px; padding-left: 12px; }
  a.wordmark { font-size: 0.85rem; gap: 6px; }
  .nav-end { gap: 2px; }
}

/* Tablet pionowo: pełne menu, przełącznik i przycisk mieszczą się w pasku po zacieśnieniu odstępów. */
@media (min-width: 760px) and (max-width: 839px) {
  .nav-pill { gap: 12px; }
  .site-nav { gap: 14px; }
  .nav-end { gap: 8px; }
  .lang-switch > * { min-width: 32px; }
  .lang-switch a { min-width: 38px; }
  .nav-cta { padding-inline: 14px; }
}

@media (min-width: 760px) {
  .mobile-nav { display: none !important; }
}

/* Niski ekran (telefon trzymany poziomo): treść hero ledwo mieści się pod paskiem nawigacji,
   więc pasek sterowania zostaje bez napisu i nie zabiera jej miejsca. */
@media (max-height: 560px) {
  .hero h1 { font-size: clamp(1.8rem, 9vh, 2.6rem); margin-bottom: 14px; }
  .hero-content { padding-bottom: max(calc(var(--section-pad) * 0.55), 44px); }
  .hero-cue { display: none; }
  .hero-hud { bottom: 18px; }
}

/* Reduced motion: układ statyczny, bez translacji ani pinningu */

@media (prefers-reduced-motion: reduce) {
  .hero-image { transform: none !important; }
  .hero-video { display: none !important; }
  .skip-link { transition: none; }
  .gallery-track { transition: none; }
  .hero-cue-arrow { animation: none; }
}
