:root {
  /* Jasna paleta: krem + ziemiste akcenty */
  --bg: #F7F4ED;        /* kremowe tło */
  --bg-alt: #F2EFE8;    /* jaśniejszy krem (sekcje) */
  --text: #1F2328;      /* ciemny grafit */
  --muted: #6B6F76;     /* ciepła szarość */
  --teal: #6B8F71;      /* szałwiowo-zielony akcent */
  --teal-weak: #B9C9BD; /* jaśniejszy akcent */
  --line: #E6E1D8;      /* delikatny beżowy separator */
  --tile-bg: #EAE7DF;   /* tło placeholder dla obrazów */
  --maxw: 1280px;
  --pad: 24px;
}

:root[data-theme="dark"] {
  --bg: #0B0F12;
  --bg-alt: #0E1418;
  --text: #E6E8EA;
  --muted: #A7B0B6;
  --teal: #6B8F71;
  --teal-weak: #B9C9BD;
  --line: #1A232C;
  --tile-bg: #111;
}

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
/* Prevent layout shift when scrollbar appears/disappears */
html { scrollbar-gutter: stable both-edges; }
@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

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

/* Górna belka */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
  border-bottom: none;
  box-shadow: inset 0 -1px 0 0 var(--line);
}

.logo { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; line-height: 1; text-align: center; }
.logo-serif { font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -0.01em; display: inline-flex; flex-direction: column; color: var(--text); }
.logo-serif > span { display: block; }
.logo-script { font-family: "Sacramento", ui-script, "Segoe UI", system-ui, sans-serif; color: var(--text); opacity: 0.92; }
/* Compact sizing for header */
.logo-serif { font-size: 16px; }
.logo-script { font-size: 16px; margin-top: 2px; }

.nav a {
  margin-left: 20px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.02em;
  position: relative;
}

.nav a:hover, .nav a:focus-visible {
  color: var(--teal);
}

.nav .theme-btn {
  margin-left: 20px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  padding: 6px;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav .theme-btn:hover, .nav .theme-btn:focus-visible { color: var(--teal); }
.nav .theme-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; }
/* Icon micro‑animation on toggle */
.nav .theme-btn svg { transition: transform .3s ease; }
.nav .theme-btn.animate svg { transform: rotate(180deg) scale(1.06); }
@media (prefers-reduced-motion: reduce) {
  .nav .theme-btn svg { transition: none; }
}

/* Subtle global color transition on theme change */
:root.theme-transition, :root.theme-transition * {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
/* Avoid perceived lag on logo text during theme switch */
:root.theme-transition .logo, :root.theme-transition .logo * { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  :root.theme-transition, :root.theme-transition * { transition: none; }
}

/* Animated underline for nav */
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 2px;
  width: 100%;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
  opacity: 0.9;
}
.nav a:hover::after, .nav a:focus-visible::after, .nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* no underline animation for icon button */

@media (prefers-reduced-motion: reduce) {
  .nav a::after { transition: none; }
}

/* Dropdown (Portfolio) */
.nav { position: relative; display: flex; align-items: center; }
.dropdown { position: relative; }
.dropdown > a { display: inline-block; padding: 4px 0; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 8px 12px;
  min-width: 180px;
  display: none;
}
.dropdown:hover .dropdown-menu, .dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-menu a { display: block; margin: 8px 0; color: var(--text); }
.dropdown-menu a:hover, .dropdown-menu a:focus-visible { color: var(--teal); }

/* Galeria */

.photos { max-width: var(--maxw); margin: 40px auto; padding: 0 var(--pad); }

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid a { display: block; overflow: hidden; aspect-ratio: 1 / 1; }
.tile { position: relative; width: 100%; height: 100%; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; background: var(--tile-bg); opacity: 0; transition: opacity .4s ease, transform .35s ease, filter .35s ease; }
.grid img.is-loaded { opacity: 1; }
.tile:hover img, .tile img:hover { transform: scale(1.02); filter: brightness(1.05); }

/* Sekcje tekstowe */

.text-block { max-width: 680px; margin: 80px auto; padding: 0 var(--pad); }

.text-block h2 { margin-bottom: 16px; font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 32px; line-height: 1.2; letter-spacing: -0.01em; }

.text-block p { color: var(--muted); }

/* Hero */
.hero { position: relative; }
.hero .container { padding-top: 80px; padding-bottom: 80px; }
.hero h1 { font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 56px; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 12px; }
.hero p { color: var(--muted); max-width: 720px; }
.hero-visual { margin-top: 32px; }
.hero-visual img { width: 100%; height: clamp(280px, 60vh, 640px); object-fit: cover; background: #111; }

/* Footer */
footer { border-top: none; box-shadow: none; margin-top: 80px; }
footer .container { display: flex; justify-content: space-between; align-items: center; padding: 20px var(--pad); box-shadow: inset 0 1px 0 0 var(--line); }
footer .muted { color: var(--muted); font-size: 14px; }

/* Focus a11y */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 36px; }
  .nav a { margin-left: 16px; }
  .dropdown-menu { position: static; border: none; padding: 8px 0; }
}

/* Small screens: wrap header neatly */
@media (max-width: 380px) {
  .top-bar { flex-wrap: wrap; gap: 8px; }
  .nav { width: 100%; padding-top: 2px; justify-content: center; }
  .logo-serif { font-size: 15px; }
  .logo-script { font-size: 15px; }
}

/* More deliberate grid scaling across sizes */
@media (max-width: 480px) {
  .photos { padding: 0 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .logo-main { font-size: 16px; }
  .logo-sub { font-size: 14px; }
  .nav a { font-size: 12px; margin-left: 12px; }
}

@media (min-width: 600px) and (max-width: 767px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
}

@media (min-width: 768px) and (max-width: 1279px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
}

@media (min-width: 1280px) and (max-width: 1599px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
}

@media (min-width: 1600px) {
  .grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
}

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: grid; place-items: center; z-index: 1000; }
.lightbox[hidden] { display: none; }
.lb-stage { max-width: 92vw; max-height: 92vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lb-img { max-width: 100%; max-height: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.35); opacity: 0; transition: opacity .35s ease; }
.lb-img.is-loaded { opacity: 1; }
.lb-close, .lb-prev, .lb-next {
  position: absolute; background: transparent; border: none; color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
}
.lb-close { top: 16px; right: 20px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(0,0,0,0.35); padding: 6px 10px; border-radius: 6px; backdrop-filter: blur(6px); }

/* Forms (light theme) */
.contact-form { max-width: 520px; }
.contact-form label { display: grid; gap: 8px; color: var(--text); font-size: 15px; font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: 0.01em; }
.form-control { width: 100%; padding: 12px 14px; background: var(--bg-alt); border: 1px solid var(--line); color: var(--text); border-radius: 6px; font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 500; letter-spacing: 0.01em; }
.form-control::placeholder { color: var(--muted); }
.form-control:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 35%, transparent); }
.btn { display: inline-block; padding: 10px 18px; background: var(--teal); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: 0.02em; }
.btn:hover { filter: brightness(0.98); }

/* Load more */
.load-more { display: flex; justify-content: center; padding: 8px var(--pad) 0; margin-bottom: 24px; }
.infinite-sentinel { width: 1px; height: 1px; }

@media (prefers-reduced-motion: reduce) {
  .grid img { transition: opacity .01s linear; }
}

/* Very large screens: widen max container */
@media (min-width: 1536px) {
  :root { --maxw: 1440px; }
  .logo-serif { font-size: 17px; }
  .logo-script { font-size: 17px; }
}
@media (min-width: 1920px) {
  :root { --maxw: 1600px; }
  .logo-serif { font-size: 18px; }
  .logo-script { font-size: 18px; }
}

/* QR card */
.qr-inline { margin: 0 16px; display: flex; align-items: center; justify-content: center; }
.qr-inline img { width: 72px; height: 72px; border-radius: 8px; background: var(--tile-bg); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
