/* ═══════════════════════════════════════════════════
   SHARED — used on every page via base.html
   ═══════════════════════════════════════════════════ */

@font-face {
    font-family: 'Nunito Sans';
    src: url("../nunito-sans-v19-latin-regular.bf4fb9047908.woff2") format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito Sans';
    src: url("../nunito-sans-v19-latin-600.74243e9a5da8.woff2") format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #fafafa;
    --surface: #fafafa;
    --grey: #616161;
    --black: #272727;
    --text-color: #272727;
    --primary-color: #147E80;
    --secondary-color: #DB008F;
    --link-color: #147E80;
    --nav-header-bg: #dedede;
    --border-radius: .7rem;
    --border-radius-ex: 1.3rem;
    --standard-distance: 1rem;
    --error-color: #c0392b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111;
        --text-color: #dedede;
        --grey: #8f8f8f;
        --nav-header-bg: #272727;
        --link-color: #7adbdd;
        --error-color: #d8958e;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    font-family: 'Nunito Sans', system-ui, sans-serif;
    font-size: 1.125rem;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--text-color);
    text-underline-position: under;
    text-decoration: underline var(--link-color) .12rem;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

.slide:hover {
    opacity: 1;
}

img {
    width: 100%;
    height: auto;
    display: block;
    margin: auto;
    border-radius: var(--border-radius-ex);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    font-weight: 600;
    text-align: center;
}

/* ── Header ───────────────────────────────────────────── */

.top-nav {
    background-color: var(--nav-header-bg);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--standard-distance);
    position: relative;
}

.top-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1.2;
    font-size: var(--standard-distance);
    color: var(--text-color);
}

.logo-img {
    width: auto;
    height: 2.2rem;
    border-radius: 0;
    display: block;
    margin: 0;
    flex-shrink: 0;
}

.top-logo strong {
    font-size: 1.2rem;
    color: var(--text-color);
    display: block;
}

.top-nav nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.top-nav nav a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0;
    transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}

.top-nav nav a:hover,
.top-nav nav a.active {
    color: var(--link-color);
    opacity: 1;
}

.nav-newsletter,
.top-nav nav a.nav-newsletter {
    background-color: var(--primary-color);
    color: var(--surface);
    padding: 0.3rem 0.8rem;
    border-radius: var(--border-radius);
}

.top-nav nav a.nav-newsletter:hover {
    opacity: 0.85;
    color: var(--surface);
}

/* Hamburger button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--border-radius);
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* translateY = span height (2px) + gap (5px) = 7px */
.hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 600px) {

    .hamburger {
        display: flex;
    }

    .top-nav {
        padding: 0.75rem var(--standard-distance);
    }

    .top-nav nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--nav-header-bg);
        flex-direction: column;
        align-items: flex-start;
        padding: var(--standard-distance) 1.5rem 1.5rem;
        gap: 0.75rem;
        z-index: 100;
        border-top: 1px solid rgba(0,0,0,0.08);
    }

    .top-nav nav.open {
        display: flex;
    }

    .top-nav nav a {
        font-size: 1.125rem;
        width: 100%;
    }

    .top-nav nav a.nav-newsletter {
        width: auto;
    }
}

/* ── Main content ─────────────────────────────────────── */

.main {
    flex: 1;
    width: min(calc(100% - 2rem), 43rem);
    max-width: 43rem;
    margin: 0 auto;
    padding: 1.5rem var(--standard-distance) 2rem;
    overflow-wrap: break-word;
}

/* ── Social strip ─────────────────────────────────────── */

.social-strip {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: var(--standard-distance);
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-strip a {
    color: var(--surface);
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}

.social-strip a:hover {
    opacity: .85;
}

.social-strip svg {
    width: 1.6rem;
    height: 1.6rem;
}

.social-strip .icon-codeberg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ── Footer ───────────────────────────────────────────── */

.footer {
    background-color: var(--nav-header-bg);
    padding: 1.5rem var(--standard-distance);
    text-align: center;
}

.footer-nav {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.footer-nav a {
    color: var(--text-color);
    padding: 0 .75rem;
    text-decoration: none;
}

.footer-nav a:hover {
    opacity: .85;
}

/* ── Box / card ───────────────────────────────────────── */

.box {
    background-color: var(--nav-header-bg);
    border-radius: var(--border-radius-ex);
    padding: var(--standard-distance);
    margin-bottom: var(--standard-distance);
}

.box img {
    border-radius: var(--border-radius);
}

.card-img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    /* width: 100% and border-radius inherited from global img rule */
}

/* ── CTA box ──────────────────────────────────────────── */

.cta-box {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--border-radius-ex);
    padding: var(--standard-distance);
    margin-bottom: var(--standard-distance);
    text-align: center;
}

.cta-box h2,
.cta-box p {
    color: var(--surface);
}

a.cta-btn {
    display: inline-block;
    background-color: var(--surface);
    color: var(--black);
    font-weight: 600;
    padding: 0.5rem var(--standard-distance);
    border-radius: var(--border-radius);
    text-decoration: none;
    transition: opacity 0.2s;
}

.cta-btn:hover {
    opacity: 0.85;
}

/* ── Buttons ──────────────────────────────────────────── */

.button {
    display: block;
    margin: 0 auto;
    background-color: var(--primary-color);
    color: var(--surface);
    font-weight: 600;
    padding: 0.5rem var(--standard-distance);
    border-radius: var(--border-radius);
    cursor: pointer;
    text-align: center;
    width: max-content;
    text-decoration: none;
    transition: opacity 0.2s;
}

.button:hover {
    opacity: 0.85;
}

/* ── Categories ───────────────────────────────────────── */

.cat-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.625rem;
    padding-bottom: var(--standard-distance);
}


.cat-btn {
    background-color: var(--secondary-color);
    color: var(--surface)!important;
    padding: 0.5rem var(--standard-distance);
    display: inline-block;
    border-radius: var(--border-radius);
    font-size: 1.125rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

a.cat-btn:hover {
    opacity: 0.85;
}

.date .cat-btn,
.post-meta-card .cat-btn {
    margin-right: 1rem;
}

.cat-btn.active {
    opacity: 0.65;
}

.post-meta-card {
    display: flex;
    align-items: center;
    gap: var(--standard-distance);
    margin: var(--standard-distance) 0 1rem;
}

.post-author {
    color: var(--grey);
    font-size: 1.125rem;
}

/* ── Misc ─────────────────────────────────────────────── */

.date {
    color: var(--grey);
    font-size: 1.125rem;
}

.meta-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    color: var(--grey);
}

.form-error {
    color: var(--error-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.copyright {
    color: var(--grey);
    font-size: 1.125rem;
    margin: 0.25rem 0 0;
}

.separator {
    color: var(--grey);
}

.style {
    color: inherit;
    text-decoration: none;
    display: block;
}

.style * {
    text-decoration: none;
    color: inherit;
}

.style .meta-line {
    color: var(--grey);
}

.style h2 {
    margin-top: 0.5rem;
}

/* ═══════════════════════════════════════════════════
   PAGE-SPECIFIC — used on one or few pages only
   ═══════════════════════════════════════════════════ */

/* ── Share section ────────────────────────────────────── */

.share-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: var(--standard-distance);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    background-color: var(--nav-header-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.share-btn:hover {
    opacity: 0.75;
}

.share-btn svg {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    background-color: var(--nav-header-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
}

.post-meta .date {
    margin-top: 0.75rem;
}

/* ── Related posts grid ───────────────────────────────── */

.related-posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: var(--standard-distance);
    padding: var(--standard-distance);
}

.related-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.related-item h3 {
    font-size: 1.125rem;
    margin: 0;
    text-align: left;
}

.related-img {
    border-radius: var(--border-radius);
    width: 100%;
    height: 8rem;
    object-fit: cover;
    margin: 0;
}

input[type="submit"]:hover {
    opacity: .85;
    cursor: pointer;
}

/* ── TL;DR callout box ────────────────────────────────── */

.tldr-box {
    background-color: var(--nav-header-bg);
    border-radius: var(--border-radius-ex);
    padding: var(--standard-distance);
    margin-top: 1rem;
    margin-bottom: var(--standard-distance);
    border-left: 4px solid var(--link-color);
}

.tldr-title {
    margin-top: 0;
    font-size: 1.125rem;
    text-align: left;
    color: var(--link-color);
}

.tldr-list {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

.tldr-list li {
    margin-bottom: 0.25rem;
}

/* ── Code blocks ──────────────────────────────────────── */

pre.codehilite {
    background-color: #000;
    color: #fff;
    border: var(--grey) .1rem solid;
    border-radius: var(--border-radius-ex);
    padding: var(--standard-distance);
    overflow-x: auto;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1rem;
}

pre.codehilite code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* ── Slider ───────────────────────────────────────────── */

.slider {
    position: relative;
    overflow: hidden;
    background: #000;
    height: 56.25vw; /* 16:9 */
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .slider { height: 100vw; /* 1:1 */ }
}

.slider-track {
    position: absolute;
    inset: 0;
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
    flex: 0 0 100%;
    position: relative;
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    height: 100%;
}

.slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    display: block;
    margin: 0;
    transition: transform 0.4s ease;
}

.slide:hover .slide-img {
    transform: scale(1.03);
}

.slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1.5rem var(--standard-distance);
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
    color: var(--surface);
}

.slide-caption .cat-btn {
    font-size: 1.125rem;
    padding: 0.5rem var(--standard-distance);
    margin-bottom: 0.4rem;
    opacity: 0.85;
}

.slide-caption h2 {
    margin: 0.3rem 0 0;
    font-size: clamp(1.125rem, 3vw, 1.6rem);
    color: var(--surface);
    text-align: left;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Arrow buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.35);
    border: none;
    color: var(--surface);
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    padding: 0;
}

.slider-btn:hover { background: rgba(0,0,0,0.65); }

.slider-btn svg { width: 1.2rem; height: 1.2rem; }

.slider-btn--prev { left: 0.75rem; }
.slider-btn--next { right: 0.75rem; }

/* Dot indicators */
.slider-dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4rem;
    z-index: 10;
}

.slider-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.45);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}

.slider-dot.active {
    background: var(--surface);
    transform: scale(1.25);
}

.hide {
    display: none;
}

/* ── Quote Slider ─────────────────────────────────────────────────────────── */

.quote-slider {
    overflow: hidden;
    margin-bottom: var(--standard-distance);
}

.quote-track {
    display: flex;
    width: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.quote-slide {
    flex: 0 0 100%;
    min-width: 0;
    text-align: center;
    padding: 0.5rem 0;
}

.quote-text {
    font-size: 1.125rem;
    font-style: italic;
    margin: 0 0 0.5rem;
}

.quote-source {
    color: var(--grey);
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.quote-label {
    font-size: 0.9rem;
    color: var(--link-color);
    font-weight: 600;
    margin: 0;
}

/* ── AI Consumption Stats ────────────────────────────── */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--standard-distance);
    margin-top: var(--standard-distance);
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--link-color);
    line-height: 1.3;
}

.stat-label {
    font-size: 1.125rem;
    color: var(--text-color);
    line-height: 1.5;
}

/* ── Pagination ───────────────────────────────────────── */

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-top: 2rem;
}

.pagination > *:first-child {
    justify-self: start;
}

.pagination > *:last-child {
    justify-self: end;
}

.pagination a {
    font-weight: 600;
    min-height: 2.75rem;   /* 44px touch target */
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--link-color);
}

.pagination a:hover {
    opacity: 0.8;
}

.pagination-info {
    color: var(--grey);
    font-size: 1.125rem;
    text-align: center;
}

/* ── Form rows ────────────────────────────────────────── */

.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--standard-distance);
}

.form-row input[type="email"],
.form-row input[type="text"],
.form-row textarea {
    flex: 1 1 250px;
    width: 100%;
    max-width: 100%;
    min-height: 50px;
    padding: var(--standard-distance);
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1.125rem;
    box-sizing: border-box;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.form-row input[type="submit"] {
    flex: 0 0 auto;
    min-height: 50px;
    padding: 0 var(--standard-distance);
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--primary-color);
    color: var(--surface);
    font-weight: 600;
    font-size: 1.125rem;
    font-family: inherit;
    line-height: 1.5;
    cursor: pointer;
    display: flex;
    align-items: center;
    height: auto;
    transition: opacity 0.2s;
}

.form-row input[type="email"]:focus,
.form-row input[type="text"]:focus,
.form-row textarea:focus {
    outline: .15rem solid var(--primary-color);
    outline-offset: -.15rem;
}

@media (max-width: 550px) {
    .form-row input[type="email"],
    .form-row input[type="text"],
    .form-row input[type="submit"] {
        width: 100%;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.5em;
    }

    .meta-line {
        font-size: 0.9rem;
    }

    .cat-btn {
        font-size: 0.9rem;
    }

    .slide-caption .cat-btn {
        font-size: 0.9rem;
    }
}

/* ── Word cloud (homepage) ───────────────────────────────── */

.wordcloud {
    margin: var(--standard-distance) 0;
    text-align: center;
}

.wordcloud-terms {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    padding: var(--standard-distance) 0;
}

.wc-term {
    display: inline-block;
    line-height: 1;
    text-decoration: none;
    color: var(--link-color);
    transition: opacity 0.2s;
}

a.wc-term:hover {
    opacity: 0.65;
}

@media (max-width: 600px) {
    .wordcloud-terms {
        gap: 0.4rem 0.75rem;
    }

    /* Note: individual word sizes come from the inline style set by the
       wordcloud_home template tag (frequency-scaled, 14-48px) and take
       precedence over any class rule here by CSS specificity — only the
       layout gap is tuned for mobile. */
}

/* ── Word frequency table (Modelle & Fakten) ─────────────── */

.wordfreq {
    margin: var(--standard-distance) 0;
}

.wordfreq-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.wordfreq-table th,
.wordfreq-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--grey);
}

.wordfreq-table th:first-child,
.wordfreq-table td:first-child {
    border-right: 1px solid var(--grey);
}

.wordfreq-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 600px) {
    .wordfreq-table th,
    .wordfreq-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.9rem;
    }
}
