/* ================================================================
   PolskiPisarz Design System v4 — Full Rebuild
   CSS Custom Properties + Component Classes
   ================================================================ */

:root {
    /* ---- Colors ---- */
    --bg-app: #F8FAFC;
    --bg-alt: #EEF2FF;
    --bg-surface: #FFFFFF;
    --bg-inset: #F1F5F9;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --text-1: #0F172A;
    --text-2: #475569;
    --text-3: #64748B;
    --text-4: #94A3B8;
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-soft: #EEF2FF;
    --accent-border: #C7D2FE;
    --accent-strong: #818CF8;
    --green: #059669;
    --green-soft: #ECFDF5;
    --green-border: #A7F3D0;

    /* ---- Radii ---- */
    --r-card: 20px;
    --r-btn: 14px;
    --r-badge: 9999px;
    --r-icon: 14px;
    --r-input: 12px;

    /* ---- Shadows ---- */
    --sh-card: 0 1px 2px rgba(15,23,42,0.04), 0 6px 20px rgba(15,23,42,0.06);
    --sh-card-hover: 0 4px 8px rgba(15,23,42,0.06), 0 16px 40px rgba(15,23,42,0.10);
    --sh-btn: 0 2px 8px rgba(79,70,229,0.30);
    --sh-elevated: 0 8px 30px rgba(15,23,42,0.12);
    --sh-mock: 0 4px 12px rgba(15,23,42,0.06), 0 20px 50px rgba(15,23,42,0.10);
}

/* ---- Base ---- */
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--bg-app); color: var(--text-1); margin: 0; }

/* ================================================================
   TYPOGRAPHY — 6 sharply distinct levels
   ================================================================ */
.t-hero   { font-size: clamp(2.75rem, 6vw, 4.5rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.04em; color: var(--text-1); }
.t-section{ font-size: clamp(1.875rem, 4vw, 2.75rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; color: var(--text-1); }
.t-page   { font-size: 2.125rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; color: var(--text-1); }
.t-sub    { font-size: 1.375rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.015em; color: var(--text-1); }
.t-card   { font-size: 1.125rem; font-weight: 700; line-height: 1.3; color: var(--text-1); }
.t-body   { font-size: 1.0625rem; font-weight: 400; line-height: 1.7; color: var(--text-2); }
.t-desc   { font-size: 0.9375rem; font-weight: 400; line-height: 1.55; color: var(--text-3); }
.t-meta   { font-size: 0.8125rem; font-weight: 400; line-height: 1.4; color: var(--text-4); }

.gradient-text {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

/* ================================================================
   BUTTONS — 48-52px tall, properly weighted
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; font-size: 15px; line-height: 1;
    border-radius: var(--r-btn); cursor: pointer; text-decoration: none;
    transition: all 0.18s ease; white-space: nowrap; border: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff; padding: 14px 24px; /* ~48px height */
    box-shadow: var(--sh-btn);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79,70,229,0.40); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 6px rgba(79,70,229,0.25); }

.btn-secondary {
    background: var(--bg-surface); color: var(--text-1);
    padding: 14px 24px; border: 1.5px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-secondary:hover { border-color: var(--accent-strong); color: var(--accent); background: var(--accent-soft); }

.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: 16px; } /* ~52px */
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ================================================================
   CARDS — white on #F8FAFC with VISIBLE shadow
   ================================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--sh-card);
}

/* ================================================================
   GENERATOR CARDS — interactive, clickable, deep
   ================================================================ */
.gcard {
    display: flex; flex-direction: column; gap: 14px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-card);
    padding: 24px;
    box-shadow: var(--sh-card);
    cursor: pointer; text-decoration: none;
    transition: transform 0.22s cubic-bezier(0.22,1,0.36,1), box-shadow 0.22s ease, border-color 0.18s ease;
    position: relative;
}
.gcard:hover {
    transform: translateY(-5px);
    box-shadow: var(--sh-card-hover);
    border-color: var(--accent-strong);
}
.gcard:active { transform: translateY(-1px); }

.gcard-icon {
    width: 48px; height: 48px; border-radius: var(--r-icon);
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent-soft), #E0E7FF);
    border: 1.5px solid var(--accent-border);
    flex-shrink: 0;
    transition: all 0.18s ease;
}
.gcard:hover .gcard-icon {
    background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.10);
}

.gcard-title { font-size: 1.0625rem; font-weight: 700; color: var(--text-1); line-height: 1.25; }
.gcard-desc  { font-size: 0.875rem; font-weight: 400; color: var(--text-3); line-height: 1.5; margin-top: 2px; }

.gcard-arrow {
    margin-top: auto; padding-top: 4px;
    font-size: 13px; font-weight: 600; color: var(--accent);
    opacity: 0; transform: translateX(-6px);
    transition: all 0.18s ease;
}
.gcard:hover .gcard-arrow { opacity: 1; transform: translateX(0); }

/* ================================================================
   USAGE CARD — white surface, clearly separate
   ================================================================ */
.usage-card {
    background: var(--bg-surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-card);
    padding: 24px 28px;
    box-shadow: var(--sh-card);
}
.usage-num { font-size: 2.25rem; font-weight: 800; color: var(--accent); line-height: 1; letter-spacing: -0.02em; }
.usage-bar-track { height: 10px; border-radius: 5px; background: var(--bg-inset); overflow: hidden; margin-top: 10px; }
.usage-bar-fill  { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #6366F1, var(--accent)); transition: width 0.5s ease; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 600; padding: 4px 12px;
    border-radius: var(--r-badge); white-space: nowrap;
}
.badge-primary { background: var(--accent-soft); color: #3730A3; border: 1px solid var(--accent-border); }
.badge-green   { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-border); }

/* ================================================================
   HERO PILL
   ================================================================ */
.hero-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--accent);
    background: var(--bg-surface); border: 1.5px solid var(--accent-border);
    border-radius: var(--r-badge); padding: 8px 18px;
    box-shadow: 0 2px 8px rgba(79,70,229,0.08);
}

/* ================================================================
   HERO MOCK — product preview card
   ================================================================ */
.hero-mock {
    background: var(--bg-surface); border: 1.5px solid var(--border);
    border-radius: var(--r-card); padding: 28px;
    box-shadow: var(--sh-mock); max-width: 420px; width: 100%;
}
.mock-line { border-radius: 4px; margin-bottom: 8px; }

/* ================================================================
   INPUTS
   ================================================================ */
.input {
    width: 100%; padding: 12px 16px;
    border: 1.5px solid var(--border); border-radius: var(--r-input);
    font-size: 15px; line-height: 1.5; color: var(--text-1);
    background: var(--bg-surface); outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-4); }
.input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 4px rgba(99,102,241,0.12); }
.input-label { display: block; font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }

/* ================================================================
   NAV
   ================================================================ */
.nav-link {
    font-size: 15px; font-weight: 500; color: var(--text-3);
    padding: 8px 14px; border-radius: 10px;
    transition: all 0.15s; text-decoration: none;
}
.nav-link:hover { color: var(--accent); background: var(--accent-soft); }
.nav-link-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ================================================================
   DOCUMENT PREVIEW — paper look
   ================================================================ */
.doc-wrap {
    background: var(--bg-inset); border: 1px solid var(--border);
    border-radius: var(--r-card); padding: 24px;
}
@media (min-width: 640px) { .doc-wrap { padding: 40px; } }

.doc-paper {
    background: var(--bg-surface); border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 8px 30px rgba(0,0,0,0.05);
    padding: 40px 28px; max-width: 100%; min-width: 0;
}
@media (min-width: 640px) { .doc-paper { padding: 48px 48px; } }
@media (min-width: 768px) { .doc-paper { padding: 56px 56px; } }

/* ---- Result text: OVERFLOW FIX + typography ---- */
.rtxt { max-width: 100%; min-width: 0; overflow-wrap: anywhere; word-break: break-word; line-height: 1.8; color: #334155; font-size: 15px; }
.rtxt * { max-width: 100%; min-width: 0; }
.rtxt h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-1); margin: 1.75rem 0 0.625rem; letter-spacing: -0.015em; line-height: 1.25; }
.rtxt h1:first-child { margin-top: 0; }
.rtxt h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-1); margin: 1.5rem 0 0.5rem; }
.rtxt h3 { font-size: 1.0625rem; font-weight: 600; color: #334155; margin: 1.25rem 0 0.375rem; }
.rtxt h4 { font-size: 0.875rem; font-weight: 700; color: var(--accent); margin: 1.25rem 0 0.375rem; text-transform: uppercase; letter-spacing: 0.06em; }
.rtxt p { margin-bottom: 0.875rem; line-height: 1.8; }
.rtxt ul, .rtxt ol { padding-left: 1.5rem; margin-bottom: 0.875rem; }
.rtxt li { margin-bottom: 0.375rem; line-height: 1.7; }
.rtxt strong { font-weight: 600; color: var(--text-1); }
.rtxt em { font-style: italic; color: var(--text-3); }
.rtxt hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.rtxt pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; background: var(--bg-app); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 13px; line-height: 1.65; overflow-x: auto; }
.rtxt code { font-size: 13px; background: var(--bg-inset); padding: 2px 6px; border-radius: 4px; }
.rtxt blockquote { border-left: 3px solid var(--accent-strong); padding-left: 16px; margin: 16px 0; color: var(--text-3); font-style: italic; }
.rtxt a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ================================================================
   MISC
   ================================================================ */
.cookie-banner { background: var(--bg-surface); border: 1.5px solid var(--border); border-radius: 16px; box-shadow: var(--sh-elevated); }
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--text-1); color: #fff; padding: 12px 24px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 100; transition: transform 0.3s cubic-bezier(0.16,1,0.3,1); box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.toast.show { transform: translateX(-50%) translateY(0); }

.prose h2 { margin-top: 2rem; margin-bottom: 0.75rem; font-size: 1.25rem; font-weight: 700; color: var(--text-1); }
.prose h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; font-size: 1.1rem; font-weight: 600; color: var(--text-1); }
.prose p  { margin-bottom: 0.75rem; line-height: 1.75; color: var(--text-2); }
.prose ul, .prose ol { margin-bottom: 0.75rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.25rem; color: var(--text-2); }

details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 4px rgba(99,102,241,0.12); }

@media print { nav, footer, #cookie-banner, button, .no-print { display: none !important; } .doc-paper { box-shadow: none; border: 1px solid #ccc; } body { background: #fff; } }
