/* =============================================================================
   pages.css — podstrony: Kontakt (templates/page-contact.php), O firmie (templates/page-about.php),
   spis treści długich stron (page.php + inc/page-toc.php). Ładowany na stronach poza stroną główną.
   Wszystkie wartości wizualne przez tokeny z tokens.css; kolory scen SVG przez klasy .sc-* (main.css).
   ============================================================================= */

/* ---- Nagłówek podstrony ze sceną (Kontakt, O firmie) ---------------------------------------- */
.contact-hero, .about-hero { position: relative; overflow: hidden; background: var(--page-hero-bg); }
.contact-hero__inner, .about-hero__inner {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: var(--space-6);
  padding-block: clamp(var(--space-7), 7vw, var(--space-9));
}
.about-hero__inner { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); }
.contact-hero__title, .about-hero__title { margin-bottom: var(--space-4); }
.contact-hero__lead, .about-hero__lead { font-size: var(--text-xl); color: var(--color-text-muted); max-width: 52ch; margin: 0; }
.about-hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.contact-hero__scene .scene, .about-hero__scene .scene { width: 100%; height: auto; max-height: 440px; margin-inline: auto; }

/* wejście tekstu nagłówka (raz, po załadowaniu; LCP nie jest ukrywany — animacja tylko przesuwa z widocznego stanu) */
@keyframes page-rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
.js .contact-hero__content > *, .js .about-hero__content > * { animation: page-rise 0.6s var(--motion-ease) both; }
.js .contact-hero__content > :nth-child(2), .js .about-hero__content > :nth-child(2) { animation-delay: 0.08s; }
.js .contact-hero__content > :nth-child(3), .js .about-hero__content > :nth-child(3) { animation-delay: 0.16s; }
.js .about-hero__content > :nth-child(4) { animation-delay: 0.24s; }

/* ---- Scena Kontakt: koperta, list, samolocik (lot = SMIL animateMotion w scenes/contact.php) ---------- */
.ct-trail { fill: none; stroke: var(--color-brown); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 0.018 0.022; opacity: 0.45; }
.ct-letter { transform-box: fill-box; transform-origin: 50% 100%; }
.ct-flap { transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes trail-march { to { stroke-dashoffset: -0.4; } }
@keyframes letter-peek { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
@keyframes dots-pulse { 0%, 100% { opacity: 0.35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }
.js .ct-trail { animation: trail-march 6s linear infinite; }
.js .ct-letter { animation: letter-peek 5s ease-in-out infinite; }
.js .ct-dots circle { transform-box: fill-box; transform-origin: center; animation: dots-pulse 2.4s ease-in-out infinite; }
.js .ct-dots circle:nth-child(2) { animation-delay: 0.4s; }
.js .ct-dots circle:nth-child(3) { animation-delay: 0.8s; }

/* ---- Kontakt: kafle szybkiego kontaktu (nachodzą na nagłówek) ----------------------------------- */
.quick-contact { list-style: none; margin: calc(-1 * var(--space-6)) 0 var(--space-7); padding: 0; position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.quick-card__link {
  display: flex; flex-direction: column; gap: var(--space-1); height: 100%; padding: var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  color: var(--color-text); text-decoration: none; transition: transform 0.35s var(--motion-ease), border-color var(--transition), box-shadow 0.35s var(--motion-ease);
}
.quick-card__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--space-2); border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-brown); transition: background var(--transition), color var(--transition), transform 0.4s var(--motion-ease); }
.quick-card__icon svg { width: 24px; height: 24px; }
.quick-card__label { font-family: var(--font-heading); font-weight: var(--font-weight-semibold); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--letter-spacing-caps); color: var(--color-text-muted); }
.quick-card__value { font-family: var(--font-heading); font-weight: var(--font-weight-medium); font-size: var(--text-lg); line-height: 1.3; overflow-wrap: anywhere; }
.quick-card__phones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.quick-card__phones a { font-family: var(--font-heading); font-weight: var(--font-weight-medium); font-size: var(--text-base); color: var(--color-text); text-decoration: none; }
.quick-card__phones a:hover { color: var(--color-brown); text-decoration: underline; }
.quick-card__sub { margin-top: 1px; }
.contact-row__who { display: inline; margin-left: var(--space-1); }
.quick-card__link:hover, .quick-card__link:focus-visible { transform: translateY(-4px); border-color: var(--color-kraft); box-shadow: var(--shadow); color: var(--color-brown); }
.quick-card__link:hover .quick-card__icon, .quick-card__link:focus-visible .quick-card__icon { background: var(--color-kraft); color: var(--color-on-secondary); transform: rotate(-8deg) scale(1.05); }

/* ---- Kontakt: formularz + karta danych ------------------------------------------------------- */
.contact-page__intro { margin-bottom: var(--space-6); }
.contact-grid { display: grid; grid-template-columns: var(--contact-form-width) var(--contact-info-width); gap: var(--space-6); align-items: start; margin-bottom: var(--space-7); }
.contact-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-6); }
.contact-form__head { margin-bottom: var(--space-5); }
.contact-form__title, .contact-info__title { font-size: var(--text-2xl); margin-bottom: var(--space-2); }
.contact-form__hint { margin: 0; color: var(--color-text-muted); }
.contact-info { position: relative; background: var(--contact-info-bg); border-radius: var(--radius-lg); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.contact-info__deco { position: absolute; right: var(--space-5); top: var(--space-5); width: 96px; opacity: 0.75; pointer-events: none; transform: rotate(6deg); }
.contact-info__title { position: relative; max-width: calc(100% - 96px); }
.contact-info__maplink { align-self: flex-start; margin-top: var(--space-2); }
.contact-row { display: flex; gap: var(--space-3); align-items: flex-start; position: relative; }
.contact-row__icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius); background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-brown); }
.contact-row__icon svg { width: 22px; height: 22px; }
.contact-row__body { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.contact-row__label { font-family: var(--font-heading); font-weight: var(--font-weight-semibold); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--letter-spacing-caps); color: var(--color-text-muted); }
.contact-row__value { font-size: var(--text-base); line-height: 1.5; }
.contact-row__value a { text-decoration: none; font-weight: var(--font-weight-medium); }
.contact-row__value a:hover { text-decoration: underline; }

/* ---- Kontakt: mapa (iframe leniwie) z kartą adresu --------------------------------------------- */
.contact-map { margin-bottom: var(--space-7); }
.contact-map__frame { position: relative; height: var(--map-height); border-radius: var(--radius-lg); overflow: hidden; background: var(--map-placeholder-bg); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.contact-map__iframe { display: block; width: 100%; height: 100%; border: 0; filter: saturate(0.85); }
.contact-map__card {
  position: absolute; left: var(--space-5); bottom: var(--space-5); display: flex; gap: var(--space-3); align-items: center; max-width: min(360px, calc(100% - 2 * var(--space-5)));
  padding: var(--space-4) var(--space-5); background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--color-border);
}
.contact-map__pin { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius-pill); background: var(--color-brown); color: var(--color-on-primary); }
.contact-map__pin svg { width: 22px; height: 22px; }
.contact-map__name { display: block; font-family: var(--font-heading); font-weight: var(--font-weight-semibold); font-size: var(--text-sm); }
.contact-map__address { display: block; font-size: var(--text-sm); color: var(--color-text-muted); }

/* ---- O firmie: scena z paletą i pieczęć ------------------------------------------------------- */
.about-scene { position: relative; }
.about-scene__badge { position: absolute; left: -3%; bottom: 8%; width: var(--badge-size); height: var(--badge-size); filter: drop-shadow(0 8px 20px rgba(43, 42, 39, 0.14)); }
.badge-spin { width: 100%; height: 100%; overflow: visible; }
.badge-spin__text { transform-box: view-box; transform-origin: 100px 100px; }
@keyframes badge-spin { to { transform: rotate(360deg); } }
.js .badge-spin__text { animation: badge-spin var(--badge-spin-duration) linear infinite; }
.ab-layer { transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes ab-rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ab-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.js .ab-layer--1 { animation: ab-rise 0.9s var(--motion-ease) 0.15s both, ab-float 7s ease-in-out 1.3s infinite; }
.js .ab-layer--2 { animation: ab-rise 0.9s var(--motion-ease) 0.40s both, ab-float 6s ease-in-out 1.6s infinite; }
.js .ab-layer--3 { animation: ab-rise 0.9s var(--motion-ease) 0.65s both, ab-float 5s ease-in-out 1.9s infinite; }
.js .ab-pallet { animation: ab-rise 0.7s var(--motion-ease) both; }
.bx-label { pointer-events: none; }

/* ---- O firmie: liczby (licznik w pages.js) -------------------------------------------------- */
.about-stats { background: var(--color-surface); border-block: 1px solid var(--color-border); }
.stats { list-style: none; margin: 0; padding: var(--space-6) 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { text-align: center; padding-inline: var(--space-4); border-left: 1px solid var(--color-border); }
.stat:first-child { border-left: 0; }
.stat__value { display: block; font-family: var(--font-heading); font-weight: var(--font-weight-heading); font-size: var(--stat-value-size); line-height: 1; letter-spacing: -0.02em; color: var(--stat-color); font-variant-numeric: tabular-nums; }
.stat__label { display: block; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); text-wrap: balance; }

/* ---- O firmie: historia ------------------------------------------------------------------------ */
.about-story__inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(var(--space-6), 6vw, var(--space-9)); align-items: center; }
.about-story__media { margin: 0; position: relative; }
.about-story__media::before { content: ""; position: absolute; inset: var(--space-4) auto auto var(--space-4); right: calc(-1 * var(--space-4)); bottom: calc(-1 * var(--space-4)); border: 2px solid var(--color-kraft-light); border-radius: var(--radius-lg); opacity: 0.6; pointer-events: none; }
.about-story__img, .about-story__placeholder { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 560px; object-fit: cover; border-radius: var(--radius-lg); }
.about-story__placeholder { height: auto; }
.about-story__body h2 { margin-bottom: var(--space-5); }
.about-story__text { font-size: var(--text-lg); }
.about-story__text p { margin-bottom: var(--space-4); }

/* ---- O firmie: oś czasu (linia rysuje się po wjechaniu w widok) ------------------------------- */
.timeline { --tl-dot: 18px; list-style: none; margin: 0 auto; padding: var(--space-4) 0; position: relative; max-width: 960px; }
.timeline::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--timeline-line); opacity: 0.5; transform: scaleY(0); transform-origin: top; transition: transform 1.6s var(--motion-ease) 0.2s; }
.js .timeline:not(.is-inview)::before { transform: scaleY(0); }
.timeline.is-inview::before, html:not(.js) .timeline::before { transform: scaleY(1); }
.timeline__item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) var(--space-8) minmax(0, 1fr); align-items: start; margin-bottom: var(--space-5); }
.timeline__dot { grid-column: 2; justify-self: center; width: var(--tl-dot); height: var(--tl-dot); margin-top: var(--space-5); border-radius: var(--radius-pill); background: var(--timeline-dot); box-shadow: 0 0 0 5px var(--color-bg), 0 0 0 7px var(--timeline-line); }
.timeline__card { grid-column: 3; padding: var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); position: relative; }
.timeline__card::before { content: ""; position: absolute; top: calc(var(--space-5) + 2px); width: 12px; height: 12px; background: inherit; border: inherit; transform: rotate(45deg); left: -7px; border-right: 0; border-top: 0; }
.timeline__item:nth-child(odd) .timeline__card { grid-column: 1; grid-row: 1; text-align: right; }
.timeline__item:nth-child(odd) .timeline__card::before { left: auto; right: -7px; border: 1px solid var(--color-border); border-left: 0; border-bottom: 0; }
.timeline__year { display: inline-block; margin-bottom: var(--space-2); padding: 2px 10px; border-radius: var(--radius-pill); background: var(--color-paper); color: var(--color-brown); font-family: var(--font-heading); font-weight: var(--font-weight-semibold); font-size: var(--text-xs); letter-spacing: var(--letter-spacing-caps); text-transform: uppercase; }
.timeline__title { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.timeline__text { margin: 0; color: var(--color-text-muted); }

/* ---- O firmie: trzy filary ------------------------------------------------------------------- */
.pillars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.pillars--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pillar { position: relative; overflow: hidden; padding: var(--space-6); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); transition: transform 0.35s var(--motion-ease), border-color var(--transition), box-shadow 0.35s var(--motion-ease); }
.pillar:hover { transform: translateY(-4px); border-color: var(--color-kraft); box-shadow: var(--shadow-sm); }
.pillar__num { position: absolute; right: var(--space-4); top: var(--space-2); font-family: var(--font-heading); font-weight: var(--font-weight-heading); font-size: var(--text-4xl); line-height: 1; color: var(--color-kraft); opacity: 0.22; pointer-events: none; }
.pillar__icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: var(--space-4); border-radius: var(--radius); background: var(--color-paper); color: var(--color-brown); transition: background var(--transition), color var(--transition), transform 0.4s var(--motion-ease); }
.pillar__icon svg { width: 28px; height: 28px; }
.pillar:hover .pillar__icon { background: var(--color-kraft); color: var(--color-on-secondary); transform: rotate(-6deg); }
.pillar__title { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.pillar__text { margin: 0; color: var(--color-text-muted); }

/* ---- O firmie: pasek zachęty --------------------------------------------------------------------- */
.cta-band { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 7fr) auto; align-items: center; gap: var(--space-5) var(--space-7); padding: clamp(var(--space-6), 5vw, var(--space-8)); background: var(--cta-band-bg); color: var(--cta-band-text); border-radius: var(--radius-lg); }
.cta-band__title { color: inherit; margin-bottom: var(--space-3); font-size: var(--text-3xl); }
.cta-band__text { margin: 0; font-size: var(--text-lg); opacity: 0.88; max-width: 56ch; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); position: relative; z-index: 1; }
.cta-band__deco { position: absolute; right: -40px; bottom: -60px; width: 340px; opacity: 0.9; pointer-events: none; }

/* ---- Spis treści na długich stronach (page.php + inc/page-toc.php) ------------------------------ */
.page-header__lead { max-width: var(--container-narrow); margin: 0; }
.page-header__meta { margin: var(--space-3) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
.page-layout { display: grid; grid-template-columns: var(--toc-width) minmax(0, 1fr); gap: var(--space-7); align-items: start; }
.toc { position: sticky; top: calc(var(--header-height) + var(--space-4)); max-height: calc(100vh - var(--header-height) - var(--space-6)); overflow: auto; padding: var(--space-4) var(--space-5); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); font-size: var(--text-sm); }
.toc__details summary::-webkit-details-marker { display: none; }
.toc__title { list-style: none; cursor: pointer; font-family: var(--font-heading); font-weight: var(--font-weight-semibold); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--letter-spacing-caps); color: var(--color-text-muted); display: flex; align-items: center; justify-content: space-between; }
.toc__title::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform var(--transition); }
.toc__details[open] .toc__title::after { transform: rotate(-135deg); }
.toc__list { list-style: none; margin: var(--space-3) 0 0; padding-left: 0; display: flex; flex-direction: column; gap: var(--space-2); color: var(--color-text-muted); }
.toc__list a { color: var(--color-text); text-decoration: none; }
.toc__list a:hover { color: var(--color-brown); text-decoration: underline; }
.has-toc .entry-content h2 { scroll-margin-top: calc(var(--header-height) + var(--space-4)); }
.has-toc .entry-content h2:first-child { margin-top: 0; }
.has-toc .entry-content ol li, .has-toc .entry-content ul li { margin-bottom: var(--space-2); }

/* ---- Responsywność ----------------------------------------------------------------------------- */
@media (max-width: 899px) {
  .contact-hero__inner, .about-hero__inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .contact-hero__scene, .about-hero__scene { order: -1; }
  .contact-hero__scene .scene, .about-hero__scene .scene { max-height: 38vh; max-width: 480px; }
  .about-scene__badge { left: 0; bottom: 0; }
  .quick-contact { grid-template-columns: minmax(0, 1fr); margin-top: var(--space-5); }
  .contact-grid { grid-template-columns: minmax(0, 1fr); }
  .contact-info { order: -1; }
  .contact-map__card { position: static; max-width: none; border-radius: 0 0 var(--radius-lg) var(--radius-lg); border-width: 1px 0 0; }
  .contact-map__frame { height: auto; display: flex; flex-direction: column; }
  .contact-map__iframe { height: var(--map-height); }
  .stats, .stats--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5) var(--space-4); }
  .stat:nth-child(odd) { border-left: 0; }
  .about-story__inner { grid-template-columns: minmax(0, 1fr); }
  .about-story__media { max-width: 420px; }
  .timeline::before { left: calc(var(--tl-dot) / 2); }
  .timeline__item { grid-template-columns: var(--tl-dot) minmax(0, 1fr); column-gap: var(--space-4); }
  .timeline__dot { grid-column: 1; }
  .timeline__card, .timeline__item:nth-child(odd) .timeline__card { grid-column: 2; grid-row: auto; text-align: left; }
  .timeline__item:nth-child(odd) .timeline__card::before { left: -7px; right: auto; border: 1px solid var(--color-border); border-right: 0; border-top: 0; }
  .pillars, .pillars--2 { grid-template-columns: minmax(0, 1fr); }
  .cta-band { grid-template-columns: minmax(0, 1fr); }
  .cta-band__deco { width: 220px; right: -60px; bottom: -70px; opacity: 0.5; }
  .page-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .toc { position: static; max-height: none; }
}
@media (max-width: 599px) {
  .stats, .stats--3, .stats--2 { grid-template-columns: minmax(0, 1fr); }
  .stat { border-left: 0; }
}

/* ---- Redukcja ruchu -------------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .js .contact-hero__content > *, .js .about-hero__content > *, .js .ct-trail, .js .ct-letter, .js .ct-dots circle,
  .js .badge-spin__text, .js .ab-layer, .js .ab-pallet { animation: none !important; }
  .timeline::before { transform: none !important; transition: none; }
}
