/* ==========================================================================
   Dobra Gramatyka – v7 – Pure Utility Design
   Mobile-first (85% mobile). Maximum readability. More breathing room.
   ========================================================================== */

/* --- Variables --- */
:root {
    --bg: #F7F5F1;
    --bg-card: #FFFFFF;
    --bg-warm: #F0EDE7;
    --bg-example: #F5F9F6;
    --bg-highlight: #FEF3C7;
    --bg-rule: #FFFBEB;
    --bg-conj-hl: #FEF9EE;

    --text: #28251F;
    --text-mid: #5C5650;
    --text-light: #8A847C;
    --text-pl: #7A756E;

    --green: #1A3C2A;
    --green-mid: #2B6E4A;
    --green-light: #E6F2EB;

    --amber: #A85A1B;
    --amber-soft: #F4DFB8;
    --amber-bg: #FEF7EC;

    --border: #E5DFD6;
    --border-light: #EDEBE6;

    --radius: 0.75rem;
    --radius-lg: 1rem;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

::selection {
    background: var(--amber-soft);
    color: var(--text);
}

/* --- Base Typography --- */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    padding: 0;
}

/* --- Headings --- */
h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--green);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green);
    margin: 3rem 0 1rem;
    padding: 0.75rem 0;
    border-bottom: 2px solid var(--green-light);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

h2 .section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--green);
    color: #fff;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 0.75rem;
}

/* --- Links --- */
a {
    color: var(--green-mid);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

/* --- Layout --- */
.page { min-height: 100vh; display: flex; flex-direction: column; }

/* --- Header --- */
.hdr {
    background: var(--green);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.hdr > a:first-child {
    color: rgba(255,255,255,0.92);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.hdr a:hover { color: #fff; text-decoration: none; }

/* Hamburger icon — pure CSS */
.hdr-menu {
    display: block;
    width: 20px;
    padding: 0;
    line-height: 0;
    font-size: 0;
}
.hdr-menu span {
    display: block;
    width: 20px;
    height: 2px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.85);
}
.hdr-menu span:last-child {
    margin-bottom: 0;
}
.hdr-menu:hover span {
    background: #fff;
}

/* --- Main Content --- */
.main {
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 0.75rem;
}

/* --- Intro text under h1 --- */
.intro {
    color: var(--text);
    font-size: inherit;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

/* --- Table of Contents --- */
.toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    margin: 1.5rem 0 2.25rem;
}

.toc-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.6rem;
}

.toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc;
}

.toc li {
    counter-increment: toc;
    margin: 0;
}

.toc li a {
    display: block;
    padding: 0.55rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--green-mid);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-light);
}

.toc li:last-child a {
    border-bottom: none;
}

.toc li a::before {
    content: counter(toc);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1.3rem;
    height: 1.3rem;
    background: var(--green-light);
    color: var(--green-mid);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Grammar Highlight (replaces <i>) --- */
.hl {
    color: var(--amber);
    font-weight: 700;
    font-style: normal;
}

/* --- Lists --- */
ul, ol {
    padding-left: 1.4rem;
    margin: 0.75rem 0;
}
li { margin-bottom: 0.4rem; }

/* --- Example sentences (large EN + small PL below) --- */
.ex {
    margin: 0.85rem 0;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ex-en {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.6;
}

.ex-pl {
    font-size: 0.88rem;
    color: var(--text-pl);
    margin-top: 0.15rem;
    line-height: 1.5;
}

/* Inline example (shorter, within text flow) */
.ex-inline {
    display: block;
    margin: 0.5rem 0;
    padding: 0.55rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    line-height: 1.55;
}

/* --- Rule / tip callout --- */
.rule {
    background: #FFF8EE;
    border: 1.5px solid #E8C97A;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin: 1.25rem 0;
    font-size: 0.95rem;
    line-height: 1.7;
}

/* --- Pattern / Formula box --- */
.pattern {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.pattern-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.6rem;
}

.pattern-formula {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.pattern-part {
    background: var(--green-light);
    color: var(--green);
    padding: 0.3rem 0.65rem;
    border-radius: 0.4rem;
    font-weight: 600;
    font-size: 0.92rem;
}

.pattern-part.accent {
    background: var(--amber-bg);
    color: var(--amber);
}

.pattern-plus {
    color: var(--text-light);
    font-weight: 300;
    font-size: 1.2rem;
}

/* --- Conjugation Grid (replaces table) --- */
.conj {
    margin: 1.25rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.conj-header {
    background: var(--green);
    color: #fff;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.88rem;
}

.conj-item {
    display: flex;
    align-items: baseline;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border-light);
    gap: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.conj-item:last-child { border-bottom: none; }

.conj-item.accent {
    background: var(--bg-conj-hl);
}

.conj-person {
    font-weight: 600;
    min-width: 3rem;
    color: var(--text);
    flex-shrink: 0;
}

.conj-verb {
    font-weight: 500;
    color: var(--text);
}

.conj-rest {
    color: var(--text-mid);
}

.conj-transl {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-left: auto;
    text-align: right;
}

/* On mobile: stack translation below */
@media (max-width: 600px) {
    .conj-item {
        flex-wrap: wrap;
    }
    .conj-transl {
        flex-basis: 100%;
        margin-left: 3.5rem;
        margin-top: -0.1rem;
        text-align: left;
    }
}

.conj-note {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    color: var(--text-light);
    background: var(--bg-warm);
    border-top: 1px solid var(--border-light);
}

/* --- Time Expressions Grid --- */
.time-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    margin: 1.25rem 0;
}

.time-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
}

.time-word {
    font-weight: 700;
    color: var(--green-mid);
    font-size: 1.05rem;
}

.time-meaning {
    font-size: 0.82rem;
    color: var(--text-light);
    margin-bottom: 0.35rem;
}

.time-ex {
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.55;
}

.time-ex-pl {
    font-size: 0.85rem;
    color: var(--text-pl);
}

@media (min-width: 520px) {
    .time-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* --- Word Badges (question words, etc.) --- */
.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.badge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.badge strong {
    color: var(--green-mid);
    font-weight: 700;
    margin-right: 0.3rem;
}

/* --- Example Blocks (large EN + PL below) for pairs --- */
.examples {
    margin: 1.25rem 0;
}

.ex-block {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}
.ex-block:last-child { border-bottom: none; }

.ex-block .en {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.55;
}

.ex-block .pl {
    font-size: 0.88rem;
    color: var(--text-pl);
    margin-top: 0.1rem;
    line-height: 1.5;
}

/* --- Promo block --- */

/* --- Navigation Tiles --- */
.nav-tiles {
    margin-top: 2rem;
}

.nav-tiles-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--green-light);
}

.nav-category {
    margin-bottom: 1.75rem;
}

.nav-category-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    padding-left: 0.15rem;
}

.tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.tile {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--green-mid);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.35;
}

.tile:hover {
    background: var(--green-light);
    border-color: var(--green-mid);
    text-decoration: none;
}

.tile.current {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    font-weight: 700;
}

@media (max-width: 400px) {
    .tiles {
        grid-template-columns: 1fr;
    }
}

/* --- Farewell message (outside .main, between content and footer) --- */
.farewell {
    text-align: center;
    color: var(--text-light);
    font-size: 1.05rem;
    font-style: italic;
    margin: 0;
    padding: 2.5rem 1.25rem 3.2rem;
}

/* --- Footer --- */
.ftr {
    background: var(--green);
    padding: 1.75rem 1.25rem;
    margin-top: auto;
}

.ftr-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.ftr-trust {
    font-size: 0.85rem;
    line-height: 1.7;
    color: rgba(255,255,255,0.75);
}

.ftr-trust strong {
    color: rgba(255,255,255,0.95);
    font-weight: 600;
}

.ftr-copy {
    margin-top: 0.75rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
}

/* --- Paragraph spacing refinements --- */
.main p {
    margin: 0.85rem 0;
}

.main > p:first-of-type {
    margin-top: 0;
}

/* --- Responsive Desktop Enhancement --- */
@media (min-width: 768px) {
    body { font-size: 18px; }

    .main {
        max-width: 860px;
        padding: 3.5rem 4rem 1rem;
        margin-top: 0;
        margin-bottom: 0;
    }

    .farewell {
        font-size: 1.15rem;
        padding: 4rem 1.25rem 4.7rem;
    }

    .hdr { padding: 1.4rem 2.5rem; }

    h1 { font-size: 2.3rem; margin-bottom: 1.2rem; }
    h2 { font-size: 1.45rem; margin-top: 4rem; margin-bottom: 1.25rem; padding: 0.85rem 0; }
    h3 { margin-top: 2.5rem; margin-bottom: 0.85rem; }

    .toc { padding: 1.5rem 1.75rem; margin: 2rem 0 3rem; }
    .toc-title { margin-bottom: 0.75rem; }
    .toc li a { padding: 0.65rem 0; padding-left: 1.75rem; }

    .ex { padding: 1rem 1.25rem; margin: 1rem 0; }
    .ex-en { font-size: 1.15rem; }

    .rule { padding: 1.1rem 1.35rem; margin: 1.5rem 0; }

    .pattern { padding: 1.35rem 1.65rem; margin: 1.75rem 0; }

    .conj { margin: 1.5rem 0; }
    .conj-item { padding: 0.7rem 1.25rem; }
    .conj-header { padding: 0.75rem 1.25rem; }
    .conj-note { padding: 0.65rem 1.25rem; }

    .time-grid { margin: 1.5rem 0; gap: 0.75rem; }
    .time-card { padding: 1.1rem 1.25rem; }

    .badges { margin: 1.25rem 0; }

    .examples { margin: 1.5rem 0; }
    .ex-block { padding: 1rem 0; }
    .ex-block .en { font-size: 1.15rem; }

    .nav-tiles { margin-top: 4rem; margin-bottom: 0; }
    .nav-tiles-title { margin-bottom: 1.5rem; }
    .nav-category:last-child { margin-bottom: 0; }
    .tile { padding: 0.85rem 1.1rem; }
    .tiles { gap: 0.6rem; }
    .nav-category { margin-bottom: 2rem; }

    .main p { margin: 1rem 0; }
    ul, ol { margin: 0.85rem 0; }
    li { margin-bottom: 0.45rem; }

    .ftr { padding: 2.25rem 2.5rem; }
}
