/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Palette */
  --color-white:       #ffffff;
  --color-bg:          #f8f8f7;
  --color-surface:     #f0efed;
  --color-border:      #e2e0dc;
  --color-text:        #1a1a18;
  --color-text-muted:  #6b6b67;
  --color-accent:      #1d4ed8;
  --color-accent-dark: #1e3a8a;

  /* Typography */
  --font-sans:         'Inter', system-ui, -apple-system, sans-serif;
  --font-size-sm:      0.875rem;
  --font-size-base:    1rem;
  --font-size-lg:      1.125rem;
  --font-size-xl:      1.5rem;
  --font-size-2xl:     2rem;
  --font-size-3xl:     3rem;
  --font-size-hero:    clamp(2.5rem, 6vw, 5rem);

  /* Spacing */
  --space-xs:          0.5rem;
  --space-sm:          1rem;
  --space-md:          1.5rem;
  --space-lg:          2.5rem;
  --space-xl:          4rem;
  --space-2xl:         6rem;
  --space-section:     clamp(4rem, 8vw, 8rem);

  /* Layout */
  --container-max:     1200px;
  --container-pad:     clamp(1rem, 4vw, 2rem);
  --header-height:     64px;

  /* Effects */
  --radius:            8px;
  --radius-lg:         16px;
  --shadow-sm:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:         0 4px 16px rgba(0,0,0,.08);
  --transition:        200ms ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul {
  list-style: none;
}

address {
  font-style: normal;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section__lead {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-top: var(--space-sm);
  line-height: 1.65;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
  border-color: var(--color-accent);
}

.btn--primary:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: var(--color-white);
  text-decoration: none;
  transform: translateY(-1px);
}

.btn--full {
  width: 100%;
}

/* ============================================================
   HEADER
   ============================================================ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(248, 248, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--transition);
}

#site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--font-size-lg);
}

.header__logo:hover {
  text-decoration: none;
}

.logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 1.1rem;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav__link {
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition), color var(--transition);
}

.nav__link:hover,
.nav__link--active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}

.nav__link--cta {
  padding: 0.5rem 1.25rem;
  background: var(--color-accent);
  color: var(--color-white);
  border-radius: var(--radius);
  border-bottom: none;
}

.nav__link--cta:hover {
  background: var(--color-accent-dark);
  color: var(--color-white);
  border-bottom: none;
}

/* Hamburger button */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 300ms ease, opacity 300ms ease;
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger::before { top: -7px; }
.hamburger::after  { top:  7px; }

.nav__toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.nav__toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  position: relative;
  min-height: clamp(520px, 88vh, 860px);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 40%, #dbeafe 100%);
  text-align: center;
  padding-block: var(--space-xl) var(--space-2xl);
  align-content: center;
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.scroll-chevron {
  display: block;
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  transform: rotate(45deg);
  animation: chevron-bounce 1.6s ease-in-out infinite;
  opacity: 0.7;
}

@keyframes chevron-bounce {
  0%, 100% { transform: rotate(45deg) translateY(0);   opacity: 0.7; }
  50%       { transform: rotate(45deg) translateY(6px); opacity: 0.3; }
}

.hero__inner {
  max-width: 760px;
}

.hero__eyebrow {
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

#hero h1 {
  font-size: var(--font-size-hero);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.hero__sub {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  max-width: 50ch;
  margin-inline: auto;
  margin-bottom: var(--space-lg);
}

/* ============================================================
   SECTIONS — shared heading style
   ============================================================ */
section {
  padding-block: var(--space-section);
}

/* Explicit section backgrounds — no fragile nth-child */
#o-nas,
#galeria {
  background: var(--color-white);
}

#uslugi,
#kontakt {
  background: var(--color-bg);
}

section + section {
  border-top: 1px solid var(--color-border);
}

section h2 {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text);
}

/* ============================================================
   O NAS — STATS
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  padding: var(--space-lg) var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* number + unit must stay on one line */
.stat__value {
  display: flex;
  align-items: baseline;
  gap: 0.1em;
  line-height: 1;
}

.stat__number {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.stat__unit {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-accent);
}

.stat__label {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
}

/* ============================================================
   USŁUGI — SERVICE CARDS
   ============================================================ */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.service-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: var(--space-xs);
  transition: box-shadow var(--transition), transform var(--transition);
}

.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.service-card__icon {
  width: 52px;
  height: 52px;
  background: rgba(29, 78, 216, 0.08);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-sm);
  color: var(--color-accent);
  flex-shrink: 0;
}

.service-card__icon svg {
  width: 26px;
  height: 26px;
}

.service-card__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
}

.service-card__desc {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.service-card__price {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
}

.price__from {
  font-size: var(--font-size-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-right: 0.25rem;
}

/* ============================================================
   GALERIA
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.gallery-item {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.gallery-item__btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  overflow: hidden;
}

.gallery-item__btn img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 400ms ease;
}

.gallery-item__btn:hover img {
  transform: scale(1.05);
}

.gallery-item figcaption {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--space-md);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__img {
  max-width: min(90vw, 1200px);
  max-height: 82vh;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

.lightbox__caption {
  position: absolute;
  bottom: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.8);
  font-size: var(--font-size-sm);
  text-align: center;
  white-space: normal;
  max-width: 80vw;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.5rem;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--transition);
  line-height: 1;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(255,255,255,0.3);
}

.lightbox__close { top: 1.25rem; right: 1.25rem; }
.lightbox__prev  { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox__next  { right: 1.25rem; top: 50%; transform: translateY(-50%); }

/* ============================================================
   KONTAKT
   ============================================================ */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--space-2xl);
  align-items: start;
}

.contact__info h2 {
  margin-bottom: var(--space-sm);
}

.contact__list {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.contact__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-base);
}

.contact__item a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition);
}

.contact__item a:hover {
  color: var(--color-accent-dark);
  text-decoration: underline;
}

.contact__icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.contact__form {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: var(--space-md);
}

.form-group label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.required {
  color: #dc2626;
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

/* Custom dropdown arrow for select */
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.75rem;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
  border-color: #dc2626;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form__status {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  text-align: center;
}

.form__status--success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.form__status--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.field-error {
  font-size: var(--font-size-sm);
  color: #dc2626;
  display: none;
}

.field-error:not(:empty) {
  display: block;
}

.form-group.has-error input,
.form-group.has-error textarea {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ============================================================
   FOOTER
   ============================================================ */
#site-footer {
  background: var(--color-text);
  color: rgba(255,255,255,0.7);
  padding-block: var(--space-lg);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.footer__brand {
  font-weight: 800;
  font-size: var(--font-size-lg);
  color: var(--color-white);
}

.footer__copy {
  font-size: var(--font-size-sm);
}

.footer__nav {
  display: flex;
  gap: var(--space-md);
}

.footer__nav a {
  color: rgba(255,255,255,0.7);
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: color var(--transition);
}

.footer__nav a:hover {
  color: var(--color-white);
  text-decoration: none;
}

/* ============================================================
   FOCUS STYLES (keyboard navigation)
   ============================================================ */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* Remove default outline only when our custom one applies */
:focus:not(:focus-visible) {
  outline: none;
}

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

.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ============================================================
   FORM SENDING STATE
   ============================================================ */
.contact__form.is-sending {
  opacity: 0.65;
  pointer-events: none;
}

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  color: var(--color-white);
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  z-index: 90;
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:hover {
  background: var(--color-accent-dark);
  transform: translateY(-3px);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .contact__grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
}

@media (max-width: 767px) {
  .nav__toggle {
    display: flex;
  }

  #main-nav {
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: var(--color-white);
    transform: translateX(100%);
    transition: transform 300ms ease;
    overflow-y: auto;
    border-top: 1px solid var(--color-border);
  }

  #main-nav.is-open {
    transform: translateX(0);
  }

  .nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: var(--space-lg);
  }

  .nav__list li {
    width: 100%;
    border-bottom: 1px solid var(--color-border);
  }

  .nav__list li:first-child {
    border-top: 1px solid var(--color-border);
  }

  .nav__link {
    display: block;
    padding: var(--space-sm) 0;
    font-size: var(--font-size-lg);
    border-bottom: none;
  }

  .nav__link--cta {
    margin-top: var(--space-md);
    display: inline-flex;
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .stats {
    grid-template-columns: 1fr;
  }

  /* Reposition lightbox nav buttons below image on small screens */
  .lightbox__prev,
  .lightbox__next {
    top: auto;
    bottom: 4.5rem;
    transform: none;
  }

  .lightbox__prev { left: 30%; }
  .lightbox__next { right: 30%; }

  .contact__form {
    padding: var(--space-md);
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .footer__nav {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }

  .hero__scroll {
    display: none;
  }
}
