/* Strona zwierzaka i plakat zaginięcia w świecie czyjto („Las o zmierzchu”).
   Personalizacja właściciela na <html>: data-layout (pelny | arkusz), data-ground (las | jasne), data-theme (rudy | szary | lesny | czarny).
   data-state="alarm" wyłącza akcent: zostaje wspólna czerwień. Brief: .impeccable/surfaces/templates-tags-page-html.md */

@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 400 800; font-stretch: 75% 100%; font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 400 800; font-stretch: 75% 100%; font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Akcent właściciela: para na ciemne tło (-d, jasny kolor z ciemnym tekstem) i na jasne (-l, ciemny kolor z białym tekstem).
   Każda para ma co najmniej 4,5:1 (sprawdzone dla obu teł i alarmu). Rudy to morela czyjto. */
:root, :root[data-theme="rudy"] {
  --acc-d: #ff9a52; --on-acc-d: #1f160f; --tone-d: rgb(255 154 82 / 0.16); --on-tone-d: #ffd6b5;
  --acc-l: #a8480f; --on-acc-l: #ffffff; --tone-l: #fbe3c7; --on-tone-l: #6b3406;
}
:root[data-theme="szary"] {
  --acc-d: #a9c4e0; --on-acc-d: #0f1d2b; --tone-d: rgb(169 196 224 / 0.16); --on-tone-d: #dbe8f5;
  --acc-l: #2f4a66; --on-acc-l: #ffffff; --tone-l: #dbe6f1; --on-tone-l: #25384d;
}
:root[data-theme="lesny"] {
  --acc-d: #b8dd7f; --on-acc-d: #15240a; --tone-d: rgb(184 221 127 / 0.16); --on-tone-d: #e2f3c8;
  --acc-l: #2e5a3b; --on-acc-l: #ffffff; --tone-l: #dfeadb; --on-tone-l: #234530;
}
:root[data-theme="czarny"] {
  --acc-d: #fff8ef; --on-acc-d: #0b2c25; --tone-d: rgb(255 248 239 / 0.12); --on-tone-d: #fff8ef;
  --acc-l: #1d1f23; --on-acc-l: #ffffff; --tone-l: #e6e7e9; --on-tone-l: #1d1f23;
}
:root[data-state="alarm"][data-theme] {
  --acc-d: #c8102e; --on-acc-d: #ffffff; --tone-d: rgb(200 16 46 / 0.3); --on-tone-d: #ffd9de;
  --acc-l: #c8102e; --on-acc-l: #ffffff; --tone-l: #ffd9de; --on-tone-l: #7a0a1d;
}

/* Tło: leśna zieleń czyjto (domyślne) albo jasne */
:root, :root[data-ground="las"] {
  --outer: #082520; --ground: #0f3d33; --surface: #0b2c25; --raise: #15503f;
  --ink: #fff8ef; --muted: #c9ddd3; --line: rgb(255 248 239 / 0.14); --line-strong: rgb(255 248 239 / 0.42);
  --pin: #9df5d0; --focus: #9df5d0; --scrim: 15 61 51;  /* cieniowanie zdjęcia przechodzi w leśne tło bez szwu */
  --acc: var(--acc-d); --on-acc: var(--on-acc-d); --tone: var(--tone-d); --on-tone: var(--on-tone-d);
  color-scheme: dark;
}
:root[data-ground="jasne"] {
  --outer: #dbe5df; --ground: #eef3ef; --surface: #ffffff; --raise: #dfe9e3;
  --ink: #0b2c25; --muted: #47605a; --line: rgb(11 44 37 / 0.14);
  --line-strong: #5f7771;  /* obrys przycisków: 4,3:1 na #eef3ef i 4,8:1 na białym pasku */
  --pin: #1f6b55; --focus: #1f6b55; --scrim: 8 37 32;  /* pod białym tekstem na zdjęciu zawsze ciemno */
  --acc: var(--acc-l); --on-acc: var(--on-acc-l); --tone: var(--tone-l); --on-tone: var(--on-tone-l);
  color-scheme: light;
}
:root {
  --alarm: #c8102e;
  --bar-h: 5.2rem;           /* wysokość paska kontaktu w układzie pełnoekranowym, bez marginesu bezpieczeństwa */
  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--outer); scrollbar-color: var(--raise) var(--outer); }
body { margin: 0; color: var(--ink); font: 400 1.0625rem/1.45 var(--display); font-optical-sizing: auto; accent-color: var(--acc); caret-color: var(--acc); }
::selection { background: var(--acc); color: var(--on-acc); }
a { color: inherit; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Na komputerze strona to kolumna telefonu; po bokach to samo zdjęcie, rozmyte i przyciemnione, żeby zwierzę zajmowało cały ekran */
.shell { position: relative; max-width: 30rem; min-height: 100vh; min-height: 100svh; margin-inline: auto; background: var(--ground); }
@media (min-width: 40rem) {
  body::before {
    content: ""; position: fixed; inset: -3rem; z-index: -1; pointer-events: none;
    background: var(--backdrop, none) center / cover no-repeat; filter: blur(32px) brightness(0.42) saturate(0.85);
  }
  :root[data-ground="jasne"] body::before { filter: blur(32px) brightness(1.1) saturate(0.6) opacity(0.55); }
  .shell { box-shadow: 0 0 3rem rgb(0 0 0 / 0.35); }
}

/* ---------- Zdjęcia: przesuwane z zatrzaskiem, bez skryptów ---------- */
.stage { position: relative; }
.hero { position: relative; height: clamp(11rem, 36vh, 26rem); overflow: hidden; background: var(--raise); }
.hero.no-photo { height: 9rem; }
.slides { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: no-preference) { .slides { scroll-behavior: smooth; } }
.slides:focus-visible { outline: 3px solid #ffffff; outline-offset: -3px; border-radius: 0; }
.hero:has(.slides:focus-visible)::before { content: ""; position: absolute; inset: 0; z-index: 3; outline: 3px solid #0b2c25; outline-offset: -6px; pointer-events: none; }
.slide { position: relative; flex: 0 0 100%; margin: 0; scroll-snap-align: center; }
/* Kadr właściciela (pets/crop.py): punkt (--fx, --fy) zdjęcia leży w tym samym punkcie ramki, a przybliżenie --z rośnie wokół niego.
   Ten sam kadr działa w niskim pasku arkusza i na całym ekranie; w powiększeniu (lightbox.js) zdjęcie jest zawsze całe. */
.zoom { display: block; width: 100%; height: 100%; overflow: hidden; cursor: zoom-in; }
.slide img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 35%); transform: scale(var(--z, 1)); transform-origin: var(--fx, 50%) var(--fy, 35%);
}
/* Bez zdjęcia: inicjał jako wielki napis wypełniający pas, przycięty przez krawędź arkusza */
.slide.empty { display: grid; place-items: end end; height: 100%; padding: 0 1.25rem; overflow: hidden; color: var(--acc); font: 800 11rem/0.72 var(--display); font-stretch: 75%; letter-spacing: -0.04em; }

/* Podpis i licznik zdjęć */
.bar { position: absolute; left: 0.85rem; right: 0.85rem; bottom: 2.4rem; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 0.5rem; pointer-events: none; }
.cap, .count { padding: 0.3rem 0.75rem; border-radius: 999px; background: rgb(255 255 255 / 0.95); color: #10241e; font-size: 0.8125rem; font-weight: 800; line-height: 1.25; }
.cap { min-width: 0; max-width: calc(100% - 7.5rem); border-radius: 14px; overflow-wrap: anywhere; }
.count { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }

/* Strzałki dla myszy i klawiatury; na ekranie dotykowym wystarczy przesunięcie palcem */
.nav { display: none; position: absolute; top: 50%; z-index: 2; translate: 0 -50%; width: 3rem; height: 3rem; place-items: center; border-radius: 999px; background: rgb(255 255 255 / 0.95); color: #10241e; }
.nav svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.nav.prev { left: 0.75rem; }
.nav.next { right: 0.75rem; }
.nav:hover { box-shadow: 0 0.3rem 0.8rem rgb(0 0 0 / 0.3); }
.nav:focus-visible { outline: 3px solid #0b2c25; outline-offset: 0; box-shadow: 0 0 0 6px #ffffff; }
@media (hover: hover) and (pointer: fine) { .nav { display: grid; } }

/* Pigułki na zdjęciu: logo czyjto i stan tagu */
.pills { position: absolute; left: 0.85rem; top: max(0.85rem, env(safe-area-inset-top)); z-index: 2; display: flex; gap: 0.45rem; pointer-events: none; }
.pill { display: inline-flex; align-items: center; padding: 0.4rem 0.85rem; border-radius: 999px; background: rgb(255 255 255 / 0.95); color: #10241e; font-size: 0.875rem; font-weight: 800; letter-spacing: -0.01em; }
.pill.brand span { display: inline-flex; align-items: baseline; letter-spacing: -0.04em; }
.pill.brand svg { width: 0.62em; height: 0.82em; margin-left: 0.03em; align-self: center; fill: #1f6b55; }
.pill.state { background: var(--acc); color: var(--on-acc); }
/* Tylko dla zalogowanego właściciela: droga z podglądu z powrotem do panelu (znalazca tego nie widzi) */
.pill.back {
  position: absolute; right: 0.85rem; top: max(0.85rem, env(safe-area-inset-top)); z-index: 3; gap: 0.3rem; padding-left: 0.6rem;
  background: #0b2c25; color: #fff8ef; text-decoration: none; box-shadow: 0 0.25rem 0.8rem rgb(0 0 0 / 0.3);
}
.pill.back svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.pill.back::after { content: ""; position: absolute; inset: -0.5rem; }  /* cel dotykowy co najmniej 48 px */
@media (hover: hover) and (pointer: fine) { .pill.back:hover { background: #15503f; } }
:root[data-ground="jasne"] .pill.state, :root[data-state="alarm"] .pill.state { box-shadow: 0 0 0 2px rgb(255 255 255 / 0.95); }

/* ---------- Imię, pastylki, alarm ---------- */
.intro { position: relative; padding: 1.35rem 1.25rem 0; }
.intro .tab { display: none; }
h1 { margin: 0; font: 800 clamp(2.6rem, 12vw, 3.1rem)/0.95 var(--display); letter-spacing: -0.04em; overflow-wrap: anywhere; text-wrap: balance; }
/* Długie imię najpierw się zwęża (oś szerokości Bricolage), a dopiero potem maleje */
h1.long { font-size: clamp(1.9rem, 8.6vw, 2.3rem); font-stretch: 75%; line-height: 1; letter-spacing: -0.03em; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0 0; padding: 0; list-style: none; }
.chips li { padding: 0.3rem 0.8rem; border-radius: 999px; background: var(--tone); color: var(--on-tone); font-size: 0.875rem; font-weight: 700; }
.alarm { margin: 0 0 0.8rem; padding: 0.6rem 0.9rem; border-radius: 14px; background: var(--alarm); color: #ffffff; font-size: 0.98rem; font-weight: 800; line-height: 1.25; text-wrap: balance; }
.nocontact { margin: 0 0 0.8rem; padding: 0.85rem 1rem; border-radius: 16px; background: var(--tone); color: var(--on-tone); font-weight: 700; }

/* ---------- Kontakt ---------- */
.acts { display: grid; gap: 0.7rem; padding: 1.15rem 1.25rem 0; }
.act {
  display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 3.9rem; padding: 0.5rem 1.2rem;
  border: 3px solid var(--acc); border-radius: 999px; font-size: 1.125rem; font-weight: 800; line-height: 1.15; text-align: center; text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.act small { max-width: 100%; margin-top: 0.1rem; font-size: 0.95rem; font-weight: 600; overflow-wrap: anywhere; }
.act-call { background: var(--acc); color: var(--on-acc); }
.act-alt { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.act .short { display: none; }
@media (hover: hover) and (pointer: fine) { .act:hover { transform: translateY(-2px); box-shadow: 0 0.5rem 1.2rem rgb(0 0 0 / 0.28); } }
.act:active { transform: translateY(1px); box-shadow: none; }
.act-more { margin-bottom: 1.2rem; }

/* ---------- Szczegóły ---------- */
.details { padding: 1.3rem 1.25rem 2.5rem; }
/* „Jak podejść”: wskazówka bezpieczeństwa na ciemniejszej powierzchni, etykieta w odcieniu akcentu (w alarmie różowa) */
.approach { margin: 0 0 1.2rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.approach b { display: block; color: var(--on-tone); font-weight: 800; }
:root[data-ground="jasne"] .approach b { color: var(--acc); }
.approach p { margin: 0.2rem 0 0; font-size: 1.0625rem; font-weight: 500; }
.about { max-width: 65ch; margin: 0 0 1.2rem; font-size: 1.125rem; }
.facts + .about { margin-top: 1.2rem; }
.facts { margin: 0; padding: 0; }
.fact { display: grid; grid-template-columns: 8rem 1fr; gap: 0.2rem 0.9rem; align-items: center; padding-block: 0.7rem; border-top: 1px solid var(--line); }
dt { color: var(--muted); font-size: 0.95rem; font-weight: 600; }
dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
/* Adres i odnośniki to jeden cel dotykowy (co najmniej 48 px) */
.tap { display: flex; flex-direction: column; justify-content: center; min-height: 3rem; text-decoration: none; }
.tap .val { text-decoration: underline; text-underline-offset: 0.2em; }
.hint { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.foot { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.logo { display: inline-flex; align-items: baseline; margin-right: 0.3rem; color: var(--ink); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.04em; }
.logo svg { width: 0.62em; height: 0.82em; margin-left: 0.03em; align-self: center; fill: var(--pin); }
@media (max-width: 22.5rem) { .fact { grid-template-columns: 1fr; } }

/* ---------- Układ „arkusz”: zdjęcie u góry, pod nim zaokrąglony arkusz z pinezką ---------- */
:root[data-layout="arkusz"] .intro { margin-top: -1.75rem; border-radius: 28px 28px 0 0; background: var(--ground); }
:root[data-layout="arkusz"] .intro .tab { display: block; position: absolute; top: -0.95rem; left: 50%; width: 1.35rem; height: 1.8rem; translate: -50% 0; fill: var(--pin); filter: drop-shadow(0 0.15rem 0.25rem rgb(0 0 0 / 0.35)); }
@media (prefers-reduced-motion: no-preference) {
  :root[data-layout="arkusz"] .intro { animation: rise 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both; }
}
@keyframes rise { from { transform: translateY(1rem); } }

/* ---------- Układ „pełny ekran”: zdjęcie na cały ekran, kontakt przyklejony do dołu ---------- */
:root[data-layout="pelny"] .hero { height: 100vh; height: 100svh; min-height: 30rem; }
/* Ciemne cieniowanie tylko tam, gdzie leży tekst; przy alarmie i długim imieniu sięga wyżej */
:root[data-layout="pelny"] .hero::after {
  content: ""; position: absolute; inset: auto 0 0; z-index: 1; height: calc(var(--bar-h) + 16rem + env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(to bottom, rgb(var(--scrim) / 0), rgb(var(--scrim) / 0.86) 42%, rgb(var(--scrim) / 0.96));  /* od 42% białe pastylki mają 4,5:1 także na białym zdjęciu */
}
:root[data-layout="pelny"] .stage:has(.alarm, .nocontact, .note, h1.long) .hero::after { height: calc(var(--bar-h) + 21rem + env(safe-area-inset-bottom)); }
:root[data-layout="pelny"] .intro {
  position: absolute; left: 0; right: 0; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); z-index: 2;
  padding: 0 1.25rem 1.1rem; color: #fff8ef; text-shadow: 0 1px 0.75rem rgb(0 0 0 / 0.35); pointer-events: none;
}
:root[data-layout="pelny"] main:not(:has(> .acts)) .intro { bottom: env(safe-area-inset-bottom); }
:root[data-layout="pelny"] .intro .chips li { background: rgb(255 248 239 / 0.18); color: #fff8ef; text-shadow: none; }
:root[data-layout="pelny"] .intro .alarm, :root[data-layout="pelny"] .intro .nocontact { text-shadow: none; }
:root[data-layout="pelny"] .intro .nocontact { background: rgb(var(--scrim) / 0.85); color: #fff8ef; }
:root[data-layout="pelny"] .bar { top: calc(max(0.85rem, env(safe-area-inset-top)) + 2.75rem); bottom: auto; align-items: flex-start; }
:root[data-layout="pelny"] .acts {
  position: fixed; bottom: 0; left: 50%; z-index: 5; width: min(100%, 30rem); translate: -50% 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.55rem;
  padding: 0.7rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
:root[data-layout="pelny"] .acts .act { min-height: 3.7rem; padding-inline: 0.6rem; font-size: 1.05rem; }
:root[data-layout="pelny"] .acts .act .short { display: inline; }
:root[data-layout="pelny"] .acts .act .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:root[data-layout="pelny"] .acts .nocontact { margin: 0; font-size: 0.95rem; }
:root[data-layout="pelny"] .details { padding-bottom: calc(var(--bar-h) + 2.5rem + env(safe-area-inset-bottom)); }

/* ---------- Zdjęcie na cały ekran po dotknięciu (static/js/lightbox.js): całe zdjęcie na ciemnym tle ---------- */
.lb-open, .lb-open body { overflow: hidden; }
.lb {
  position: fixed; inset: 0; z-index: 100; background: rgb(5 20 17 / var(--lb-fade, 1));
  touch-action: none; overscroll-behavior: contain; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.lb-stage { position: absolute; inset: 0; overflow: hidden; }
.lb-img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; will-change: transform; pointer-events: none; }
.lb-anim .lb-img { transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.lb.loading .lb-stage { background: radial-gradient(circle, rgb(255 255 255 / 0.12) 0 1.25rem, transparent 1.3rem) center / 100% 100% no-repeat; }
.lb-btn {
  position: absolute; display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; border-radius: 999px;
  background: rgb(255 255 255 / 0.95); color: #10241e; cursor: pointer;
}
.lb-btn svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lb-btn:focus-visible { outline: 3px solid #9df5d0; outline-offset: 3px; }
.lb-close { top: max(0.75rem, env(safe-area-inset-top)); right: max(0.75rem, env(safe-area-inset-right)); }
.lb-prev, .lb-next { display: none; top: 50%; translate: 0 -50%; }
.lb-prev { left: max(0.75rem, env(safe-area-inset-left)); }
.lb-next { right: max(0.75rem, env(safe-area-inset-right)); }
@media (hover: hover) and (pointer: fine) {
  .lb-prev, .lb-next { display: grid; }
  .lb-prev[hidden], .lb-next[hidden] { display: none; }
}
.lb-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 0.5rem;
  padding: 0.9rem max(0.9rem, env(safe-area-inset-right)) max(0.9rem, env(safe-area-inset-bottom)) max(0.9rem, env(safe-area-inset-left));
  pointer-events: none; opacity: var(--lb-fade, 1);
}
.lb-cap, .lb-count { padding: 0.3rem 0.75rem; border-radius: 999px; background: rgb(255 255 255 / 0.95); color: #10241e; font-size: 0.875rem; font-weight: 800; }
.lb-cap { min-width: 0; border-radius: 14px; overflow-wrap: anywhere; line-height: 1.25; }
.lb-count { margin-left: auto; flex: none; font-variant-numeric: tabular-nums; }
.lb-cap[hidden], .lb-count[hidden] { display: none; }
