/* Rama strony: nagłówek, menu na telefonie, stopka, pasek szybkiego kontaktu,
   pytanie o zgodę i okienko formularza. */

/* ---------- nagłówek ---------- */
.masthead {
    position: sticky; top: 0; z-index: 40;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
/* Linia postępu czytania (js/progress.js) kreśli się po dolnej krawędzi nagłówka. */
.masthead__progress {
    position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
    background: var(--ink-strong); transform: scaleX(0); transform-origin: left center;
}
.masthead__inner {
    display: flex; align-items: center; gap: 12px;
    min-height: var(--masthead-h);
}
.masthead__home { display: inline-flex; padding-block: 8px; margin-right: auto; color: var(--ink); }
.mark { display: flex; flex-direction: column; gap: 6px; }
.mark__svg { width: 70px; height: auto; }
.mark__image { width: auto; height: 32px; }
/* Litery podpisu rozłożone od lewej do prawej krawędzi znaku — podpis ma szerokość słowa INNI (logo.html). */
.mark__sub { display: flex; justify-content: space-between; font-size: 7px; font-weight: 400; line-height: 1; color: var(--muted); }
/* Po najechaniu obie litery N obracają się wokół własnej osi i zamieniają rolami (N ↔ И) — gra z nazwą „inni”.
   Co jakiś czas robią to same (js/logo.js → klasa is-flipped). */
.mark__n { transform-box: fill-box; transform-origin: center; transition: transform 0.7s cubic-bezier(0.65, 0, 0.35, 1); }
.mark__n--mirrored { transition-delay: 0.08s; }
.masthead__home:focus-visible .mark__n,
.masthead__home.is-flipped .mark__n { transform: scaleX(-1); }
@media (hover: hover) and (pointer: fine) {
    .masthead__home:hover .mark__n { transform: scaleX(-1); }
}

.masthead__nav { display: none; }
.masthead__cta {
    display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
    font-size: 13px; color: var(--ink-strong);
}
.masthead__cta i { font-style: normal; font-size: 16px; }
/* Telefon: zamiast „Kontakt” przełącznik języka (kontakt jest w pasku u dołu i w menu). */
@media (max-width: 899px) {
    .masthead__cta { display: none; }
}
/* Przełącznik języka PL / EN (partials/languages.html) — bieżący podkreślony. */
.languages { display: flex; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; }
.languages__link {
    display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 40px;
    color: var(--muted); position: relative;
}
.languages__link + .languages__link::before {
    content: ""; position: absolute; left: 0; top: 50%; width: 1px; height: 12px; background: var(--line-strong);
    transform: translateY(-50%);
}
.languages__link[aria-current="true"] { color: var(--ink-strong); text-decoration: underline; text-underline-offset: 5px; }
@media (hover: hover) and (pointer: fine) {
    .languages__link:hover { color: var(--ink-strong); }
}

.masthead__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-right: -10px;
}
.burger, .burger::before, .burger::after {
    display: block; width: 20px; height: 1px; background: var(--ink-strong);
    transition: transform 0.24s var(--ease-out), opacity 0.2s;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { transform: translateY(-6px); }
.burger::after { transform: translateY(6px); }
[aria-expanded="true"] .burger { background: transparent; }
[aria-expanded="true"] .burger::before { transform: rotate(45deg); }
[aria-expanded="true"] .burger::after { transform: rotate(-45deg); }

/* Menu na telefonie — arkusz pod nagłówkiem, duże pozycje jak w aplikacji. */
.menu-sheet {
    position: fixed; inset: var(--masthead-h) 0 0 0; z-index: 39;
    background: var(--paper); overflow-y: auto; overscroll-behavior: contain;
    padding: 28px var(--gutter) calc(32px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 32px;
    opacity: 0; transform: translateY(-8px);
    transition: opacity 0.22s ease-out, transform 0.26s var(--ease-out);
}
.menu-sheet[hidden] { display: none; }
.menu-sheet.is-open { opacity: 1; transform: none; }
.menu-sheet__list { list-style: none; display: grid; gap: 4px; }
.menu-sheet__list a {
    display: flex; justify-content: space-between; align-items: baseline;
    padding-block: 12px; border-bottom: 1px solid var(--line);
    font-family: var(--serif); font-size: 32px; line-height: 1.1; color: var(--ink-strong);
}
.menu-sheet__list a[aria-current="page"] { font-family: var(--serif-italic); font-style: italic; }
.menu-sheet__contact { display: grid; gap: 10px; font-size: 14px; color: var(--muted); }
.menu-sheet__reveals { display: flex; flex-wrap: wrap; gap: 8px 28px; }
body.has-menu { overflow: hidden; }

@media (min-width: 900px) {
    .masthead__inner { gap: clamp(18px, 3vw, 44px); }
    .mark__svg { width: 84px; }
    .mark__sub { font-size: 8px; }
    .masthead__nav { display: block; }
    .nav-list { list-style: none; display: flex; gap: clamp(16px, 2.2vw, 32px); font-size: 13px; }
    .nav-link { display: inline-block; padding-block: 6px; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
    .nav-link[aria-current="page"] { border-bottom-color: var(--ink-strong); color: var(--ink-strong); }
    .masthead__toggle, .menu-sheet { display: none; }
}
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
    .nav-link:hover { border-bottom-color: var(--line-strong); }
}
/* Motyw klasyczny: podkreślenie pozycji menu dorysowuje się od lewej i zjeżdża w prawo (zamiast skoku koloru
   ramki); bieżąca strona ma je narysowane. „Kontakt ↗”: strzałka wyjeżdża w swoim kierunku. */
.theme-classic .nav-link { position: relative; border-bottom: 0; padding-bottom: 7px; }
.theme-classic .nav-link::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink-strong);
    transform: scaleX(0); transform-origin: right center; transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}
.theme-classic .nav-link[aria-current="page"]::after { transform: none; }
.theme-classic .masthead__cta i { transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
@media (hover: hover) and (pointer: fine) {
    .theme-classic .nav-link:hover::after { transform: none; transform-origin: left center; }
    .theme-classic .masthead__cta:hover i { transform: translate(3px, -3px); }
}

/* ---------- stopka ---------- */
.foot { background: var(--ink-strong); color: #a7adb0; }
/* Grupy (partials/footer.html): na telefonie jedna pod drugą z cienką linią między, na komputerze rząd. */
.foot__inner {
    display: grid; padding-block: 8px calc(20px + env(safe-area-inset-bottom, 0px));
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
}
.foot__brand, .foot__contact, .foot__legal, .foot__credits {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; padding-block: 16px;
}
.foot__brand + *, .foot__contact + *, .foot__legal + * { border-top: 1px solid rgba(255, 255, 255, 0.12); }
/* Dolna linijka: SMN · polityka prywatności · rok. */
.foot__credits { justify-content: space-between; }
.foot .wm { --wm-ls: 0.16em; color: #fff; font-weight: 400; font-family: var(--sans); }
.foot a, .foot button { min-height: 32px; display: inline-flex; align-items: center; }
/* „Pokaż e-mail”: przerywana linia pod samym napisem, nie na dole pola pod palec. */
.foot .reveal { color: #fff; border-bottom: 0; text-transform: none; letter-spacing: 0.04em; }
.foot .reveal__label { border-bottom: 1px dashed rgba(255, 255, 255, 0.35); padding-bottom: 2px; }
.foot__built { display: inline-flex; align-items: center; gap: 10px; }
/* Strona i Instagram z ikoną (globus, logo Instagrama) przed napisem. */
.foot__link { gap: 8px; }
.foot__link .icon { width: 15px; height: 15px; }
/* Telefon: e-mail jest pod kopertą w pasku u dołu ekranu (formularz z adresem do odsłonięcia). */
@media (max-width: 899px) {
    .foot__contact .reveal[data-reveal-kind="mail"] { display: none; }
}
/* Znak SMN Technology w wersji kontra (księga znaku) — bez zmian kolorów i proporcji, tylko skala. */
.foot__built img { display: block; width: 56px; height: auto; }
@media (min-width: 900px) {
    .foot__built img { width: 72px; }
}
.foot form { display: inline; }
@media (hover: hover) and (pointer: fine) {
    .foot a:hover, .foot button:hover { color: #fff; }
}
@media (min-width: 900px) {
    /* Dwa rzędy: pracownia z adresem | kontakt, a pod linią ustawienia statystyk | dolna linijka. */
    /* Odstęp kolumn jako wcięcie prawej kolumny — linia nad drugim rzędem idzie wtedy bez przerwy. */
    .foot__inner { grid-template-columns: 1fr auto; align-items: center; padding-block: 6px; }
    .foot__contact, .foot__credits { padding-left: clamp(28px, 4vw, 64px); }
    .foot__contact { justify-content: flex-end; border-top: 0; }
    .foot__credits { justify-content: flex-end; gap: 22px; }
    /* Bez ustawień statystyk dolna linijka sama zajmuje cały rząd. */
    :not(.foot__legal) + .foot__credits { grid-column: 1 / -1; }
}

/* ---------- pasek szybkiego kontaktu (telefon) ---------- */
.quickbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    display: flex; gap: 8px;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--line);
    transform: translateY(110%); transition: transform 0.3s var(--ease-out);
}
.quickbar.is-shown { transform: none; }
.quickbar .btn { flex: 1 1 0; min-height: 46px; padding-inline: 12px; }
/* Słuchawka i koperta obok „Poproś o wycenę” — kwadraty pod palec (ikony Phosphor, partials/icon.html). */
.quickbar__icon {
    flex: 0 0 46px; height: 46px; display: grid; place-items: center;
    border: 1px solid var(--ink-strong); background: #fff; color: var(--ink-strong);
}
.quickbar__icon .icon { width: 22px; height: 22px; }
body.has-quickbar { --toast-offset: 72px; padding-bottom: 72px; }
body.has-menu .quickbar, body.has-sheet .quickbar { transform: translateY(110%); }

/* ---------- „Do góry” (partials/to_top.html, js/to-top.js) ---------- */
/* Ukryty, dopóki skrypt nie doda is-shown; na telefonie nad paskiem szybkiego kontaktu. */
.to-top {
    position: fixed; right: var(--gutter); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 34;
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
    color: var(--ink-strong); background: var(--paper); border: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.33, 1, 0.68, 1), visibility 0s linear 0.3s;
}
.to-top.is-shown { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.to-top .icon { width: 20px; height: 20px; transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1); }
body.has-menu .to-top, body.has-sheet .to-top, body:has(.consent) .to-top { opacity: 0; visibility: hidden; }
@media (hover: hover) and (pointer: fine) {
    .to-top:hover { border-color: var(--ink-strong); }
    .to-top:hover .icon { transform: translateY(-3px); }
}
@media (min-width: 900px) {
    .quickbar { display: none; }
    .to-top { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
    body.has-quickbar { --toast-offset: 0px; padding-bottom: 0; }
}

/* ---------- pytanie o zgodę ---------- */
.consent {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.consent__box {
    max-width: 640px; margin-inline: auto; padding: 18px;
    background: var(--ink-strong); color: #dfe2e3;
    display: grid; gap: 14px; font-size: 13px; line-height: 1.6;
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);
}
.consent__title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #fff; }
.consent__more { color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.4); }
.consent__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent__actions .btn { flex: 1 1 140px; border-color: rgba(255, 255, 255, 0.5); color: #fff; }
.consent__actions .btn--solid { background: #fff; color: var(--ink-strong); border-color: #fff; }

/* ---------- okienko z formularzem: arkusz od dołu na telefonie, okno na komputerze ---------- */
.form-sheet {
    width: 100%; max-width: 100%; max-height: 100%; height: 100%;
    margin: 0; padding: 0; border: 0; background: transparent; color: inherit;
}
.form-sheet::backdrop { background: rgba(28, 31, 34, 0.48); }
.form-sheet[open] { display: flex; align-items: flex-end; }
.form-sheet__panel {
    --sheet-pad: var(--gutter);
    position: relative; width: 100%; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--paper); padding: 18px var(--sheet-pad) 0;
    animation: sheet-up 0.32s var(--ease-out);
}
/* W okienku nagłówek formularza jest niski, a przycisk wysyłki przypięty do dołu — widać go od razu,
   bez przewijania całego formularza. */
.form-sheet .form__head .title { font-size: 30px; }
.form-sheet .form__intro { font-size: 13px; line-height: 1.6; color: var(--muted); }
.form-sheet .form__actions {
    position: sticky; bottom: 0; z-index: 2;
    margin-inline: calc(var(--sheet-pad) * -1); padding: 12px var(--sheet-pad) calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--line);
}
.form-sheet .thanks { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
.form-sheet__grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 14px; }
.form-sheet__close {
    position: absolute; top: 10px; right: 10px; width: 44px; height: 44px;
    font-size: 26px; line-height: 1; color: var(--ink-strong);
}
.form-sheet__body[aria-busy="true"] { min-height: 40vh; opacity: 0.5; }
body.has-sheet { overflow: hidden; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 900px) {
    .form-sheet[open] { align-items: center; justify-content: center; }
    .form-sheet__panel { --sheet-pad: 44px; width: min(720px, 92vw); max-height: 88vh; padding-top: 40px; animation-name: sheet-in; }
    .form-sheet .form__head .title { font-size: 40px; }
    .form-sheet__grip { display: none; }
    @keyframes sheet-in { from { transform: translateY(16px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
    .mark__n { transition: none; }
    .form-sheet__panel { animation: none; }
    .quickbar, .menu-sheet { transition: none; }
    .to-top { transform: none; }
}
