/* The Commit Line — typografia i kolory zbliżone do domyślnej czytelni Substacka (Inter + Spectral, biel, pomarańczowy CTA) */

:root {
    --bg: #ffffff;
    --bg-subtle: #f6f6f4;
    --bg-panel: #ffffff;
    --bg-placeholder: #eceae6;
    --ink: #292929;
    --ink-muted: #757575;
    --border: #dddddd;
    --accent: #ff6719;
    --accent-hover: #e85d16;
    --accent-soft: rgba(255, 103, 25, 0.12);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 4px;
    --radius-card: 8px;
    --font-display: "Spectral", Georgia, "Times New Roman", serif;
    --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --max: 720px;
    --max-wide: 1080px;
}

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

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

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

/* Widoczny fokus klawiatury (WCAG 2.4.7) */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0.75rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.skip-link:focus {
    left: 0.75rem;
}

.skip-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.wrap {
    max-width: var(--max);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.wrap--wide {
    max-width: var(--max-wide);
}

.site-header {
    padding: 2.75rem 0 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.site-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 2.75rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.tagline {
    margin: 0.85rem auto 0;
    max-width: 34em;
    color: var(--ink-muted);
    font-size: 1.05rem;
}

.byline {
    margin: 1rem 0 0;
    font-size: 0.95rem;
    color: var(--ink-muted);
}

.byline a,
.zapis-legal a,
.site-footer a,
.empty-feed a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.byline a:hover,
.zapis-legal a:hover,
.site-footer a:hover,
.empty-feed a:hover {
    color: var(--accent-hover);
}

.main-grid {
    padding: 2rem 0 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.35rem 1.65rem;
}

.panel h1,
.panel h2 {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 600;
}

/* ——— Nawigacja (wzorzec zbliżony do stron typu Pragmatic Engineer) ——— */

.top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.top-nav-inner {
    max-width: var(--max-wide);
    margin: 0 auto;
    padding: 0.65rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-brand {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.25rem 0.4rem;
    margin: -0.25rem -0.4rem;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
    border-radius: 6px;
}

.nav-brand:hover {
    color: var(--accent);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0.55rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-muted);
    text-decoration: none;
    border-radius: 6px;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-links a.is-active {
    color: var(--accent);
    font-weight: 600;
}

.hero-actions {
    margin: 1.35rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.6rem 1.35rem;
    font-size: 0.98rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-primary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ——— Newsletter: pełna wysokość, iframe Substacka ——— */

body.page-newsletter {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.newsletter-chrome {
    flex-shrink: 0;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.newsletter-chrome-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.newsletter-chrome-text {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.newsletter-chrome-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.35rem 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border-radius: 6px;
}

.newsletter-chrome-link:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.substack-frame-root {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}

.substack-frame {
    flex: 1;
    width: 100%;
    border: 0;
    min-height: 0;
}

/* ——— Newsletter: tryb „czytelnia” na thecommitline.pl (RSS + linki do Substacka) ——— */

body.page-newsletter-reader {
    min-height: 100vh;
}

.newsletter-archive {
    margin-top: 0.25rem;
}

.newsletter-reader {
    padding: 1.75rem 0 2.5rem;
    max-width: 1080px;
}

.newsletter-reader-intro {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.reader-title {
    margin: 0.25rem 0 0.5rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.65rem, 4vw, 2.1rem);
}

.reader-lead {
    margin: 0 auto;
    max-width: 36em;
    color: var(--ink-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.reader-actions {
    margin: 1.25rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.zapis-after {
    margin: 1.75rem 0 0;
    text-align: center;
}

.panel-lead {
    margin: 0 0 1rem;
    color: var(--ink-muted);
    font-size: 0.98rem;
}

/* ——— Strona Zapis (spójnie z newsletterem: bez „karty w karcie”, bez podwójnych ramek) ——— */

body.page-zapis {
    background: var(--bg);
}

.zapis-page {
    padding: 1.5rem 0 3rem;
    max-width: var(--max-wide);
}

.zapis-header {
    text-align: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.zapis-header h1 {
    margin: 0.35rem 0 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.65rem, 4vw, 2rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.zapis-lead {
    margin: 0.85rem auto 0;
    max-width: 34em;
    color: var(--ink-muted);
    font-size: 1rem;
    line-height: 1.55;
}

.zapis-bonus {
    position: relative;
    margin: 0 0 1.25rem;
    padding: 1.4rem 1.55rem 1.45rem;
    text-align: left;
    border-radius: 12px;
    border: 1px solid rgba(255, 103, 25, 0.28);
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(255, 103, 25, 0.14) 0%, transparent 55%),
        linear-gradient(180deg, #fffefb 0%, #fff 100%);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.85) inset,
        0 12px 32px rgba(41, 41, 41, 0.08);
    overflow: hidden;
}

.zapis-bonus-badge {
    display: inline-block;
    margin: 0 0 0.65rem;
    padding: 0.28rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-ui);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, var(--accent) 0%, #ff8534 100%);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(255, 103, 25, 0.35);
}

.zapis-bonus-title {
    margin: 0 0 0.55rem;
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3.5vw, 1.35rem);
    font-weight: 700;
    line-height: 1.28;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.zapis-bonus-lead {
    margin: 0 0 0.85rem;
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--ink-muted);
}

.zapis-bonus-points {
    margin: 0 0 1rem;
    padding: 0 0 0 1.15rem;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ink);
}

.zapis-bonus-points li {
    margin: 0.35rem 0;
    padding-left: 0.15rem;
}

.zapis-bonus-points li::marker {
    color: var(--accent);
    font-size: 1.1em;
}

.zapis-bonus-reward {
    margin: 0;
    padding: 0.85rem 0 0;
    border-top: 1px dashed rgba(255, 103, 25, 0.35);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--ink);
}

.zapis-form-bridge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-ui);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
}

.zapis-form-bridge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    font-size: 1rem;
    line-height: 1;
    color: #fff;
    background: var(--accent);
    border-radius: 50%;
    animation: zapis-nudge 1.8s ease-in-out infinite;
}

@keyframes zapis-nudge {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(3px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .zapis-form-bridge-icon {
        animation: none;
    }
}

.zapis-form-bridge-text {
    max-width: 26rem;
    text-align: center;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink);
}

.zapis-embed {
    margin: 0;
    padding: 0.5rem 0 0;
    background: transparent;
}

.zapis-embed iframe.subscribe-embed-frame {
    display: block;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    border: 0;
    background: var(--bg);
}

.zapis-inline-success {
    max-width: 720px;
    margin: 1rem auto 0;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--ink);
    background: var(--accent-soft);
    border: 1px solid rgba(255, 103, 25, 0.28);
    border-radius: var(--radius-card);
}

.zapis-inline-success:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.zapis-inline-success p {
    margin: 0;
}

.zapis-legal {
    margin: 1.5rem auto 0;
    max-width: 34em;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    line-height: 1.5;
}

.posts-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.cache-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    border: 1px solid var(--border);
    padding: 0.2rem 0.45rem;
    border-radius: 4px;
}

.feed-notice {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    background: var(--accent-soft);
    border: 1px solid rgba(255, 103, 25, 0.28);
    border-radius: var(--radius-card);
    color: var(--ink);
}

.empty-feed {
    margin: 0.5rem 0 0;
    color: var(--ink-muted);
}

/* ——— Siatka wpisów (okładki z RSS) ——— */

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 1.25rem 1.15rem;
    margin: 0.85rem 0 0;
    padding: 0;
    list-style: none;
}

.post-grid > li {
    display: flex;
    min-width: 0;
}

.post-grid > li > .post-card--tile {
    flex: 1;
    width: 100%;
    min-width: 0;
}

.post-card--tile {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    padding: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-card);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.post-card--tile:hover {
    border-color: #cfcfcf;
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.post-card--tile:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.post-card-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--bg-placeholder);
    overflow: hidden;
}

.post-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-media-fallback {
    width: 100%;
    height: 100%;
    min-height: 8rem;
    background: linear-gradient(140deg, var(--bg-placeholder) 0%, #ddd9d3 100%);
}

.post-card-body {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-date {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 0.25rem;
}

.post-title {
    margin: 0;
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1rem, 2.6vw, 1.14rem);
    line-height: 1.3;
    color: var(--ink);
}

.post-card--tile .post-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-excerpt {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.875rem;
    color: var(--ink-muted);
    line-height: 1.45;
}

.post-card--tile .post-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-cta {
    display: block;
    margin-top: auto;
    padding-top: 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-ui);
    color: var(--accent);
}

.post-card--tile:hover .post-cta {
    color: var(--accent-hover);
}

.panel-footer {
    margin: 1.35rem 0 0;
    text-align: center;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1.15rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-secondary:hover {
    border-color: #c4c4c4;
    background: var(--bg-subtle);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.site-footer {
    padding: 1.5rem 0 2.5rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--ink-muted);
    border-top: 1px solid var(--border);
}

.site-footer p {
    margin: 0;
}

@media (min-width: 640px) {
    .panel {
        padding: 1.65rem 1.6rem 1.85rem;
    }
}
