/* Napisy z kapsli i nakrętek Tymbark - v3
   Kolory z v2 (zielenie), w jaśniejszym, czytelniejszym wydaniu. */

:root {
    --light: #83c285;
    --mid: #4caf50;
    --dark: #187c1b;
    --very-dark: #125014;

    --bg: #e4f2e2;
    --card: #ffffff;
    --text: #1f2d20;
    --text-dim: #5b6b5c;
    --line: #d3e6d1;
    --mark: #ffe58a;

    --radius: 14px;
    --bar-h: 64px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--mid); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- nagłówek ---------- */

.top {
    background:
        radial-gradient(900px 400px at 85% -20%, rgba(255, 255, 255, 0.18), transparent 60%),
        linear-gradient(160deg, var(--mid), var(--dark));
    color: #fff;
    text-align: center;
    padding: 48px 20px 40px;
}

.top__inner { max-width: 760px; margin: 0 auto; }

h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4.6vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 800;
    text-wrap: balance;
}

.top__count { margin: 12px 0 0; font-size: 1.05rem; opacity: 0.92; }
.top__count strong { font-weight: 800; }

/* napis dnia */
.today {
    margin: 32px auto 0;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 22px;
    text-align: left;
    padding: 20px 24px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 18px 40px -24px rgba(0, 40, 0, 0.6);
}

/* kapsel: cień zostaje na miejscu, „uniesienie" niesie rysunek z odblaskiem,
   a sam rysunek się obraca - odblask zostaje w miejscu jak prawdziwe światło */
.cap {
    flex: none;
    width: 92px;
    height: 92px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    position: relative;
    z-index: 2; /* nad bąbelkami - wychodzą spod kapsla, z butelki */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.cap:focus { outline: none; }
.cap__shadow {
    position: absolute; left: 10%; right: 10%; bottom: -9%; height: 22%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 40, 0, 0.5), transparent);
}
.cap__lift { position: absolute; inset: 0; }
.cap__art {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: url("cap.svg") center / contain no-repeat;
    animation: cap-in 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}
.cap:focus-visible .cap__art { box-shadow: 0 0 0 3px #fff; }
.cap__shine {
    position: absolute; inset: 26%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 60%);
}
@keyframes cap-in { from { transform: rotate(-200deg) scale(0.6); opacity: 0; } }
/* bąbelki gazu przy otwieraniu (script.js) */
.today { position: relative; }
.fizz {
    position: absolute; z-index: 1; pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.35) 60%, rgba(255, 255, 255, 0.1));
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.today__body { min-width: 0; }
.today__label {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    opacity: 0.85;
}
.today__text {
    margin: 4px 0 14px;
    font-size: clamp(1.25rem, 3.4vw, 1.6rem);
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.01em;
    cursor: copy;
    transition: opacity 0.22s, transform 0.22s;
}
.today__text.is-changing { opacity: 0; transform: translateY(6px); }

.next {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}
.next svg { width: 18px; height: 18px; }
.next.is-spinning svg { animation: next-spin 0.6s cubic-bezier(0.3, 0.9, 0.3, 1); }
.next:active { transform: scale(0.97); }
.next { -webkit-tap-highlight-color: transparent; }
@keyframes next-spin { to { transform: rotate(360deg); } }

/* ---------- przyklejony pasek: szukanie + litery ---------- */

.bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--very-dark);
    box-shadow: 0 6px 20px -12px rgba(0, 0, 0, 0.5);
}

.bar__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.search {
    flex: 0 1 240px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: 42px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transition: background-color 0.2s;
}
.search:focus-within { background: rgba(255, 255, 255, 0.2); }
.search svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 16px; /* mniej i iPhone powiększa stronę przy wpisywaniu */
}
.search input::placeholder { color: rgba(255, 255, 255, 0.6); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search__clear {
    flex: none; width: 28px; height: 28px; margin-right: -6px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16);
    color: #fff; cursor: pointer;
}
.search__clear svg { width: 14px; height: 14px; }
.search__clear[hidden] { display: none; }

.letters {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
}
.letters a {
    min-width: 29px;
    height: 32px;
    padding: 0 5px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    transition: background-color 0.2s, color 0.2s, opacity 0.2s;
}
.letters a.is-active { background: var(--mid); }
.letters a.is-empty { opacity: 0.3; cursor: default; }
.letters a.is-dimmed { opacity: 0.35; }

/* ---------- lista napisów ---------- */

.list {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 56px;
    display: grid;
    gap: 20px;
}
.list__loading { text-align: center; color: var(--text-dim); padding: 40px 0; }

.letter {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    padding: 22px 24px 18px;
    scroll-margin-top: calc(var(--bar-h) + 14px);
    box-shadow: 0 10px 30px -24px rgba(18, 80, 20, 0.5);
}

.letter__head {
    margin: 0 0 12px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--line);
}
.letter__char { font-size: 2rem; line-height: 1; font-weight: 800; color: var(--dark); }
.letter__count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--dark);
    background: #e6f4e5;
    border-radius: 999px;
    padding: 2px 10px;
}

.letter__list {
    list-style: none;
    margin: 0;
    padding: 0;
    columns: 3 240px;
    column-gap: 28px;
}
.letter__list li { break-inside: avoid; }

.item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 8px;
    margin: 0 -8px;
    border: 0;
    border-radius: 8px;
    background: none;
    font-size: 0.98rem;
    line-height: 1.35;
    cursor: copy;
    transition: background-color 0.15s;
}
.item mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

.no-results {
    max-width: 1100px;
    margin: 0 auto 64px;
    padding: 0 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 1.05rem;
}

/* ---------- drobiazgi ---------- */

.to-top {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 20;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--dark);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.to-top svg { width: 22px; height: 22px; }
.to-top[hidden] { display: none; }

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 30;
    max-width: calc(100% - 32px);
    transform: translate(-50%, 20px);
    padding: 10px 18px;
    border-radius: 999px;
    background: #1d2a1e;
    color: #fff;
    font-size: 0.92rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.25s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.footer {
    background: var(--very-dark);
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    font-size: 0.92rem;
}
.footer p { margin: 4px 0; }
.footer a { color: #fff; }
.footer__note { margin-top: 12px !important; font-size: 0.8rem; opacity: 0.7; }

/* najechanie tylko przy myszy - na dotyku przykleja się po stuknięciu */
@media (hover: hover) and (pointer: fine) {
    .next:hover { background: #fff; border-color: #fff; color: var(--very-dark); }
    .cap:hover .cap__lift { transform: translateY(-2px); }
    .cap__lift { transition: transform 0.2s; }
    .letters a:not(.is-empty):hover { background: rgba(255, 255, 255, 0.22); }
    .item:hover { background: #eef7ed; }
    .to-top:hover { background: var(--very-dark); }
    .footer a:hover { text-decoration: none; }
}

/* ---------- telefon ---------- */

@media (max-width: 760px) {
    .top { padding: 36px 16px 28px; }
    .today { flex-direction: column; text-align: center; gap: 12px; padding: 20px 18px; }
    .cap { width: 76px; height: 76px; }
    .bar__inner { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px 8px; }
    .search { flex: none; }
    /* litery w jednym rzędzie, przewijane w bok - dawniej na telefonie były ukryte */
    .letters {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
        -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
        mask-image: linear-gradient(90deg, #000 85%, transparent);
    }
    .letters::-webkit-scrollbar { display: none; }
    .letters a { flex: none; }
    .list { padding: 20px 12px 40px; gap: 14px; }
    .letter { padding: 18px 16px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cap__art { animation: none; }
    .next.is-spinning svg { animation: none; }
}

/* ---------- polityka prywatności ---------- */

.top--small { padding: 28px 20px 32px; }
.back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.9;
}
.back svg { width: 18px; height: 18px; }
.doc {
    max-width: 760px;
    margin: 32px auto 56px;
    padding: 28px 32px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.doc h2 { margin: 28px 0 8px; font-size: 1.15rem; color: var(--very-dark); }
.doc h2:first-child { margin-top: 0; }
.doc p { margin: 0 0 10px; color: #344535; }
.doc a { color: var(--dark); font-weight: 600; }
.doc code { background: #eef7ed; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
@media (max-width: 760px) { .doc { margin: 16px 12px 40px; padding: 22px 18px; } }
