/* APHR Sp. z o.o. — wersja premium, motywy jasny/ciemny, WCAG 2.1 AA */
:root,
[data-theme="light"] {
  --bg: #f3eee4;
  --bg-elev: #fffcf6;
  --bg-mute: #eae3d6;
  --ink: #1c1915;
  --muted: #4a453e;
  --gold: #6a4c14;
  --gold-soft: #f0e4cc;
  --line: #d9d0c1;
  --navy: #1a2744;
  --nav-bg: rgba(243, 238, 228, 0.88);
  --shadow: 0 16px 40px rgba(28, 25, 21, 0.07);
  --focus: #6a4c14;
  --chip: #efe6d4;
  --chip-on: #1a2744;
  --chip-on-ink: #fffcf6;
  --ref-bg: #e7f0ee;
  --ref-ink: #134e49;
  --hero-ink: #f6f1e8;
  --hero-muted: #e4dccf;
  --hero-gold: #e8d4a0;
  --overlay: linear-gradient(180deg, rgba(10, 12, 18, 0.62) 0%, rgba(10, 12, 18, 0.78) 55%, rgba(10, 12, 18, 0.88) 100%);
  --max: 1180px;
  --header: 4.6rem;
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Manrope", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-elev: #141820;
  --bg-mute: #1b2029;
  --ink: #f3eee4;
  --muted: #c8c0b4;
  --gold: #e4c57a;
  --gold-soft: #2a2418;
  --line: #2c3340;
  --navy: #e4c57a;
  --nav-bg: rgba(11, 13, 18, 0.86);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --focus: #e4c57a;
  --chip: #1f2430;
  --chip-on: #e4c57a;
  --chip-on-ink: #0b0d12;
  --ref-bg: #16302e;
  --ref-ink: #b7e0da;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .hero-video { display: none !important; }
  .hero-poster { opacity: 1 !important; }
  .marquee-track { transform: none !important; animation: none !important; }
  .grain { animation: none !important; }
}
html, body { background: var(--bg); color: var(--ink); overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  min-height: 100%;
}
img, video { max-width: 100%; height: auto; }
a { color: var(--gold); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.skip {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 200;
  background: var(--navy);
  color: var(--chip-on-ink);
  padding: 0.7rem 1rem;
  border-radius: 4px;
}
[data-theme="dark"] .skip { color: #0b0d12; }
.skip:focus { top: 1rem; }

.wrap {
  width: min(calc(100% - 2.5rem), var(--max));
  margin-inline: auto;
}

/* Grain */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 4;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.65'/%3E%3C/svg%3E");
  animation: grain 8s steps(6) infinite;
}
[data-theme="dark"] .grain { mix-blend-mode: overlay; opacity: 0.08; }
@keyframes grain {
  0%, 100% { transform: translate(0,0); }
  33% { transform: translate(-1%, 1%); }
  66% { transform: translate(1%, -1%); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header);
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
}
.logo img { width: 40px; height: 40px; border-radius: 9px; display: block; }
.logo span {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: 1.5rem;
}
.header-tools { display: flex; align-items: center; gap: 0.6rem; }
.theme-toggle, .nav-toggle, .media-toggle {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.nav-toggle { display: none; }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: flex-end;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  padding: 0.15rem 0;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { border-bottom-color: var(--gold); color: var(--ink); }

/* Hero */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header));
  display: grid;
  align-items: end;
  color: var(--hero-ink);
  overflow: hidden;
  isolation: isolate;
}
.hero-media, .hero-video, .hero-poster, .hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-media { z-index: 0; background: #0c0e13; }
.hero-video, .hero-poster {
  object-fit: cover;
  object-position: center;
}
.hero-poster { opacity: 1; }
.hero-overlay {
  z-index: 1;
  background: var(--overlay);
}
.hero-inner {
  position: relative;
  z-index: 2;
  padding: 5.5rem 0 4.8rem;
}
.eyebrow {
  margin: 0 0 1.1rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hero-gold);
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.15rem, 5vw, 4.05rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  max-width: 18ch;
  color: var(--hero-ink);
  text-shadow: 0 1px 18px rgba(0,0,0,0.28);
}
.hero .lead {
  font-size: 1.08rem;
  max-width: 38rem;
  color: var(--hero-muted);
  margin: 0 0 1.35rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--hero-gold); color: #1a150c; }
.btn-primary:hover { filter: brightness(1.05); color: #1a150c; }
.btn-ghost { background: transparent; color: var(--hero-ink); border-color: var(--hero-ink); }
.btn-ghost:hover { background: rgba(246,241,232,0.12); color: var(--hero-ink); }
.media-toggle.hero-toggle {
  position: absolute;
  top: 1rem;
  right: 1.15rem;
  z-index: 3;
  border-color: rgba(246,241,232,0.45);
  background: rgba(12,14,20,0.55);
  color: var(--hero-ink);
}

/* Sections */
section { padding: 5rem 0; }
.section-head { max-width: 40rem; margin-bottom: 2.4rem; }
.section-head h2,
.page-hero h1,
.legal h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.8rem;
  color: var(--ink);
}
.section-head p, .lede { color: var(--muted); margin: 0; }
.note {
  margin: 1.3rem 0 0;
  padding: 0.95rem 1.1rem;
  background: var(--gold-soft);
  border-left: 3px solid var(--gold);
  color: var(--ink);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: -3.2rem;
  position: relative;
  z-index: 3;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.2rem 1.25rem;
  box-shadow: var(--shadow);
  text-align: left;
}
.stat b {
  display: block;
  font-family: var(--sans);
  font-size: clamp(2.1rem, 3.5vw, 2.85rem);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat span { display: block; margin-top: 0.45rem; color: var(--muted); font-size: 0.92rem; font-weight: 600; }

/* About / offer / work */
#o-nas { background: var(--bg-elev); border-block: 1px solid var(--line); }
.about-grid, .contact-grid { display: grid; grid-template-columns: 1.25fr 0.85fr; gap: 2.2rem; }
.about-copy p { margin: 0 0 1rem; }
.facts {
  background: var(--navy);
  color: #f6f1e8;
  border-radius: 20px;
  padding: 1.6rem 1.5rem;
}
[data-theme="dark"] .facts { background: #10141c; color: var(--ink); border: 1px solid var(--line); }
.facts h3 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hero-gold);
}
[data-theme="light"] .facts h3 { color: #e8d4a0; }
.facts dl { margin: 0; }
.facts div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.95rem;
}
.facts dt { margin: 0; color: rgba(246,241,232,0.7); }
.facts dd { margin: 0; }
.offer-grid, .work-grid, .projects-grid { display: grid; gap: 1.1rem; }
.offer-grid, .work-grid { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.5rem 1.4rem 1.55rem;
  box-shadow: var(--shadow);
  transition: transform 0.35s ease, border-color 0.35s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold); }
.card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
}
.card p { margin: 0; color: var(--muted); }
.card-icon, .step-num {
  font-family: var(--serif);
  color: var(--gold);
  margin: 0 0 0.55rem;
  font-size: 1.15rem;
  font-weight: 600;
}
.step-num { font-size: 1.8rem; line-height: 1; }

/* Marquee */
.institutions { padding-top: 0; }
.marquee-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.2rem;
}
.marquee-head h2 { margin: 0; font-family: var(--serif); font-size: 1.6rem; }
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  height: 4.4rem;
  position: relative;
}
.marquee-track {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  align-items: center;
  gap: 2.4rem;
  width: max-content;
  animation: march 80s linear infinite;
}
.marquee.is-paused .marquee-track { animation-play-state: paused; }
.marquee-track span {
  white-space: nowrap;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.marquee-track span::after {
  content: "·";
  margin-left: 2.4rem;
  color: var(--gold);
}
@keyframes march {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Projects */
#doswiadczenie { background: var(--bg-mute); }
.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.8rem 1rem;
  margin-bottom: 1.5rem;
  align-items: end;
}
.filters label { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.filters select, .filters button {
  font: inherit;
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  padding: 0.55rem 0.9rem;
}
.filters button { cursor: pointer; font-weight: 700; width: auto; }
.results-meta { margin: 0 0 1rem; color: var(--muted); font-size: 0.95rem; }
.projects-grid { grid-template-columns: repeat(2, 1fr); align-items: stretch; }
.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.3rem 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.project-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: flex-start; }
.project-year { margin: 0; font-weight: 700; color: var(--gold); }
.project-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  text-decoration: none;
  border: 0;
  font-family: inherit;
  cursor: default;
  background: var(--chip);
  color: var(--ink);
}
.badge-ref {
  background: var(--ref-bg);
  color: var(--ref-ink);
  cursor: pointer;
}
.badge-ref:hover { filter: brightness(0.97); }
.project-card h3 { margin: 0.15rem 0 0; font-size: 1.15rem; line-height: 1.3; }
.project-title { margin: 0; font-weight: 650; }
.project-desc, .project-meta { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.95rem; }
.project-meta span { display: block; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.project-thumb {
  margin-top: 0.7rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 0;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.project-thumb img { width: 100%; height: 160px; object-fit: cover; display: block; }
.projects-empty { color: var(--muted); }

/* Lightbox */
.lightbox[hidden] { display: none !important; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(8, 10, 14, 0.92);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.lightbox-inner { width: min(960px, 100%); text-align: center; }
.lightbox img { max-height: min(80vh, 900px); width: auto; max-width: 100%; border-radius: 8px; }
.lightbox p { color: #f3eee4; margin: 0.8rem 0 0; }
.lightbox-close, .lightbox-nav {
  font: inherit;
  cursor: pointer;
  border: 1px solid rgba(246,241,232,0.35);
  background: transparent;
  color: #f6f1e8;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  margin: 0 0.2rem 1rem;
}

/* Kontakt / footer */
#wspolpraca { background: var(--bg-elev); border-block: 1px solid var(--line); }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.contact-list strong { display: block; font-size: 0.75rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.contact-list a { color: var(--ink); text-decoration: none; font-weight: 700; }
.contact-list a:hover { color: var(--gold); }
.legal-ids { font-size: 0.95rem; color: var(--muted); }
.site-footer {
  background: #10131a;
  color: #e8e2d8;
  padding: 2.2rem 0 1.7rem;
  font-size: 0.92rem;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.site-footer a { color: #e8d4a0; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.page-hero { padding: 3rem 0 1.5rem; background: var(--bg-mute); }
.legal { background: var(--bg-elev); padding: 2.4rem 0 4.4rem; }
.legal .wrap { max-width: 46rem; }
.legal h2 { font-size: 1.4rem; margin-top: 2rem; }
.legal ul { padding-left: 1.2rem; }

.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s ease; }
html.js .reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .stats, .about-grid, .offer-grid, .work-grid, .projects-grid, .contact-grid, .filters {
    grid-template-columns: 1fr;
  }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: var(--header);
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 0.8rem 1.2rem 1.1rem;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0.7rem; }
  .hero { min-height: calc(100svh - var(--header)); }
  .hero-inner { padding: 5.2rem 0 4.2rem; }
  .media-toggle.hero-toggle { top: 0.75rem; right: 0.75rem; }
  .facts div { grid-template-columns: 1fr; gap: 0.15rem; }
  .stat { text-align: left; }
}

.site-nav { margin-left: auto; }
.header-tools { flex-shrink: 0; }
.theme-toggle[aria-pressed="true"] { border-color: var(--gold); }
.page-hero .eyebrow { color: var(--gold); }
.legal a { font-weight: 650; }
.site-footer .footer-links { display: flex; flex-wrap: wrap; gap: 0.85rem 1.25rem; }
@media (max-width: 900px) {
  .site-nav { margin-left: 0; }
  .header-tools { margin-left: auto; }
}
@media (max-width: 540px) {
  .theme-toggle { padding: 0.45rem 0.65rem; font-size: 0.8rem; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.stats-section { padding: 0 0 3rem; }
