@layer components;

/* ===== page layout ===== */
@layer components {
  .page-home-inner {
    padding-top: calc(var(--nav-height) + 1rem);
    padding-bottom: 3rem;
    display: block;
  }

  /* ===== header ===== */

  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--bg-alt) 85%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-subtle);
  }

  .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    gap: 0.75rem;
  }

  /* brand */

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--fg);
    text-decoration: none;
  }

  .brand-mark {
    width: 2.1rem;
    height: 2.2rem;
    border-radius: 0.9rem;
    background: radial-gradient(circle at 30% 30%, #22d3ee, #0ea5e9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f9fafb;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow-soft);
  }

  body[data-theme="dark"] .brand-mark {
    background: radial-gradient(circle at 30% 30%, #38bdf8, #0ea5e9);
  }

  .brand-text {
    display: flex;
    flex-direction: column;
  }

  .brand-name {
    font-size: 1rem;
    font-weight: 600;
  }

  .brand-tagline {
    font-size: 0.75rem;
    color: var(--fg-muted);
  }

  /* nav */

  .main-nav {
    display: flex;
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.18rem;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    padding: 0.35rem;
  }

  .nav-toggle-line {
    display: block;
    height: 2px;
    border-radius: 999px;
    background-color: var(--fg-muted);
  }

  .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    position: absolute;
    right: 1.25rem;
    top: calc(var(--nav-height) - 0.3rem);
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
    min-width: 11rem;
  }

  .nav-list li {
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  }

  .nav-list li:last-child {
    border-bottom: none;
  }

  .nav-list a {
    display: block;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    color: var(--fg);
  }

  .nav-list a:hover,
  .nav-list a:focus-visible {
    background-color: var(--accent-soft);
    text-decoration: none;
  }

  .nav-list.nav-list-open {
    display: block;
  }

  /* header actions */

  .header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .theme-toggle {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
  }

  .theme-icon {
    display: none;
  }

  body[data-theme="light"] .theme-icon-sun {
    display: inline;
  }

  body[data-theme="dark"] .theme-icon-moon {
    display: inline;
  }

  /* buttons */

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
  }

  .btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .btn-primary:hover,
  .btn-primary:focus-visible {
    text-decoration: none;
    filter: brightness(1.03);
  }

  .btn-ghost {
    background-color: transparent;
    border-color: var(--border-subtle);
    color: var(--fg);
  }

  .btn-ghost:hover,
  .btn-ghost:focus-visible {
    background-color: var(--accent-soft);
    text-decoration: none;
  }

  .btn-small {
    padding-inline: 0.85rem;
    padding-block: 0.45rem;
    font-size: 0.85rem;
  }

  .btn-full {
    width: 100%;
  }

  /* hero */

  .hero {
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
    background-color: color-mix(in srgb, var(--bg) 90%, var(--accent-soft) 10%);
    border-radius: var(--radius-lg);
  }

  .eyebrow {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent-strong);
    margin-bottom: 0.25rem;
  }

  .hero-lead {
    font-size: 0.98rem;
    max-width: 36rem;
  }

  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
  }

  .hero-bullets {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  .hero-bullets li {
    font-size: 0.8rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background-color: var(--accent-soft);
    color: var(--fg);
  }

  /* sections */

  .section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .section-header {
    margin-bottom: 1.1rem;
  }

  .section-header p {
    max-width: 34rem;
  }

  /* cards / grids */

  .card {
    background-color: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow-soft);
  }

  .card-tagline {
    font-size: 0.9rem;
    color: var(--fg-muted);
    margin-bottom: 0.75rem;
  }

  .card-footer-text {
    font-size: 0.85rem;
    color: var(--fg-muted);
    margin-top: 0.8rem;
  }

  .service-card ul {
    font-size: 0.9rem;
  }

  .cards-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .cards-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  /* steps */

  .steps-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .step-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: flex-start;
  }

  .step-number {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 999px;
    background-color: var(--accent-soft);
    color: var(--accent-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
  }

  /* faq */

  .faq-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
  }

  .faq-item {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
  }

  .faq-item summary {
    cursor: pointer;
    padding: 0.7rem 0.9rem;
    list-style: none;
    font-weight: 500;
  }

  .faq-item[open] summary {
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  }

  .faq-item summary::-webkit-details-marker {
    display: none;
  }

  .faq-item summary::after {
    content: "+";
    float: right;
    font-weight: 400;
  }

  .faq-item[open] summary::after {
    content: "–";
  }

  .faq-item p {
    padding: 0.55rem 0.9rem 0.75rem;
    margin-bottom: 0;
  }

  /* side column */

  .side-column {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .contact-card .contact-list {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
  }

  .bullet-list {
    list-style: disc;
    padding-left: 1rem;
    font-size: 0.9rem;
  }

  /* footer */

  .site-footer {
    border-top: 1px solid var(--border-subtle);
    background-color: var(--bg-alt);
  }

  .footer-inner {
    padding-block: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.85rem;
  }

  .footer-copy {
    margin: 0;
    color: var(--fg-muted);
  }

  .footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
  }

  .footer-nav a {
    font-size: 0.85rem;
  }

/* cookie bar */

.cookie-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 80;
  padding: 0.6rem 0;
  background: color-mix(in srgb, var(--bg-alt) 96%, var(--fg) 4%);
  border-top: 1px solid var(--border-subtle);
}

.cookie-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  font-size: 0.85rem;
}

.cookie-bar-text {
  flex: 1 1 14rem;
  min-width: 0;
}

.cookie-bar-title {
  margin: 0 0 0.15rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg);
}

.cookie-bar-body {
  margin: 0;
  color: var(--fg-muted);
}

.cookie-bar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.4rem;
}

/* mobile – przyciski jeden pod drugim */

@media (max-width: 640px) {
  .cookie-bar-inner {
    align-items: stretch;
  }

  .cookie-bar-actions {
    width: 100%;
    flex-direction: column;
  }

  .cookie-bar-actions .btn {
    width: 100%;
    justify-content: center;
  }
}


  /* responsive */

  @media (min-width: 640px) {
    h1 {
      font-size: 2.1rem;
    }
    .hero {
      padding-top: 2.25rem;
    }
  }

  @media (min-width: 768px) {
    .cards-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .cards-grid-2 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .steps-list {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .faq-list {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-list {
      position: static;
      display: flex;
      border-radius: 999px;
      box-shadow: none;
      border: none;
      background-color: transparent;
      gap: 0.25rem;
      min-width: auto;
    }

    .nav-list li {
      border-bottom: none;
    }

    .nav-list a {
      padding: 0.3rem 0.7rem;
      font-size: 0.86rem;
      border-radius: 999px;
    }

    .nav-list a:hover,
    .nav-list a:focus-visible {
      background-color: var(--accent-soft);
    }

    .nav-toggle {
      display: none;
    }
  }

  @media (min-width: 1024px) {
    .page-home-inner {
      display: grid;
      grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
      gap: 2rem;
    }

    .side-column {
      margin-top: 4.5rem;
      position: sticky;
      top: calc(var(--nav-height) + 1rem);
    }
  }

  @media (min-width: 1280px) {
    .container {
      padding-inline: 1.75rem;
    }
    .page-home-inner {
      gap: 2.5rem;
    }
  }
}

/* === MODAL / LIGHTBOX (Screening) === */
@layer components {
  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: color-mix(in srgb, #020617 65%, transparent);
    backdrop-filter: blur(4px);
    overflow-y: auto;
  }

  .modal-backdrop[hidden] {
    display: none;
  }

  .modal-dialog {
    position: relative;
    max-width: 36rem;
    width: 100%;
    /* max-height: min(100vh - 3rem, 40rem); */
    overflow: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
    box-shadow: var(--shadow-elevated);
    padding: 1.5rem 1.6rem 1.35rem;
  }

  .modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .modal-intro {
    font-size: 0.9rem;
    color: var(--fg-muted);
    margin-bottom: 0.75rem;
  }

  .audit-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.25rem;
  }

  .form-field,
  .form-field-checkbox {
    display: flex;
    flex-direction: column;
  }

  .form-label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
  }

  .form-required {
    color: var(--danger);
  }

  .form-control {
    font: inherit;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-elevated);
    color: var(--fg);
    line-height: 1.4;
  }

  .form-control::placeholder {
    color: var(--fg-muted);
    opacity: 0.85;
  }

  body[data-theme="dark"] .form-control {
    background-color: color-mix(in srgb, var(--bg-elevated) 94%, #000 6%);
    color: var(--fg);
  }

  body[data-theme="dark"] .form-control::placeholder {
    color: var(--fg-muted);
  }

  .form-hint {
    font-size: 0.78rem;
    color: var(--fg-muted);
    margin-top: 0.2rem;
  }

  .form-error {
    min-height: 1rem;           /* rezerwuje miejsce na błąd, bez skakania layoutu */
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.2rem;
  }

  /* wspieramy oba warianty klas błędu, żeby JS nie musiał być idealnie zsynchronizowany */
  .form-field--invalid .form-control,
  .form-field-invalid .form-control,
  .form-field--invalid .form-checkbox,
  .form-field-invalid .form-checkbox {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.3);
  }

  .form-field-checkbox {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.5rem 0.6rem;
    align-items: flex-start;
    font-size: 0.85rem;
    margin-top: 0.2rem;
  }

  .form-checkbox {
    width: 1rem;
    height: 1rem;
    margin-top: 0.2rem;
  }

  .form-error-checkbox {
    margin-top: -0.25rem;
    padding-left: 1.7rem;
  }

  .form-actions {
    margin-top: 0.35rem;
  }

  .form-meta {
    font-size: 0.8rem;
    color: var(--fg-muted);
    margin-top: 0.4rem;
  }
}
