/* ============================================
   Opas Seite — Editorial Modern
   ============================================ */

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

:root {
    --accent: #c41e3a;
    --accent-warm: #e03a56;
    --accent-deep: #8b1428;
    --accent-glow: rgba(196, 30, 58, 0.25);
    --ink: #14141a;
    --ink-soft: #2d2d36;
    --ink-mid: #4a4a55;
    --muted: #6b6b75;
    --muted-light: #9c9ca8;
    --line: rgba(20, 20, 26, 0.08);
    --line-strong: rgba(20, 20, 26, 0.14);
    --paper: #faf9f5;
    --paper-alt: #f2f1ea;
    --cream: #fdfcf7;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
    --dur-fast: 200ms;
    --dur: 400ms;
    --dur-slow: 800ms;
}

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

body {
    font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
    font-feature-settings: 'ss01', 'cv11';
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    position: relative;
}

/* Ambient background: gentle color mist — not aggressive */
body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
    animation: float 18s ease-in-out infinite;
}

body::before {
    width: 520px;
    height: 520px;
    background: radial-gradient(circle at 30% 30%, var(--accent-warm), transparent 65%);
    top: -180px;
    right: -120px;
}

body::after {
    width: 420px;
    height: 420px;
    background: radial-gradient(circle at 70% 70%, #f4c06a, transparent 65%);
    bottom: -160px;
    left: -140px;
    animation-delay: -9s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(30px, -20px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    body::before, body::after { animation: none; }
    html { scroll-behavior: auto; }
}

/* ============================================
   Scroll progress bar
   ============================================ */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-warm));
    z-index: 200;
    width: 0%;
    box-shadow: 0 0 12px var(--accent-glow);
    transition: width 80ms linear;
}

/* ============================================
   Top bar
   ============================================ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    background: rgba(250, 249, 245, 0.72);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0.9rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Fraunces', 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--ink);
    transition: transform var(--dur) var(--ease);
}

.brand:hover {
    color: var(--ink);
    transform: translateY(-1px);
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--accent-glow); }
    50%      { box-shadow: 0 0 0 8px rgba(196, 30, 58, 0.08); }
}

.topbar-meta {
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Hero
   ============================================ */
.hero {
    position: relative;
    z-index: 1;
    max-width: 1150px;
    margin: 0 auto;
    padding: 6rem 2rem 3.5rem;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2rem;
    padding: 0.45rem 0.95rem;
    background: rgba(196, 30, 58, 0.08);
    border: 1px solid rgba(196, 30, 58, 0.18);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    animation: rise 700ms var(--ease) both;
}

.kicker::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.article-title {
    font-family: 'Fraunces', 'Playfair Display', Georgia, serif;
    font-variation-settings: 'opsz' 144, 'SOFT' 100;
    font-size: clamp(2.6rem, 8.5vw, 6.5rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.035em;
    color: var(--ink);
    margin-bottom: 1.75rem;
    max-width: 14ch;
    animation: rise 900ms 80ms var(--ease) both;
}

.article-title em {
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
    font-variation-settings: 'opsz' 144, 'SOFT' 100;
}

.article-lead {
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'opsz' 14, 'SOFT' 50;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.45;
    color: var(--ink-soft);
    font-weight: 400;
    max-width: 640px;
    margin-bottom: 2.5rem;
    animation: rise 900ms 180ms var(--ease) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Byline card */
.byline {
    display: inline-flex;
    align-items: center;
    gap: 0.95rem;
    padding: 0.65rem 1.1rem 0.65rem 0.65rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(20, 20, 26, 0.04), 0 8px 24px rgba(20, 20, 26, 0.04);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
    animation: rise 900ms 260ms var(--ease) both;
}

.byline:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 2px rgba(20, 20, 26, 0.04), 0 14px 32px rgba(20, 20, 26, 0.08);
}

.byline-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.byline-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.byline-author {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
}

.byline-date {
    font-size: 0.78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Article body
   ============================================ */
.article-body {
    position: relative;
    z-index: 1;
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
    font-family: 'Fraunces', Georgia, serif;
    font-variation-settings: 'opsz' 12, 'SOFT' 50;
    font-size: 1.18rem;
    line-height: 1.7;
    color: var(--ink-soft);
}

.article-body p {
    margin-bottom: 1.4rem;
}

/* Drop cap */
.article-body > p:first-of-type::first-letter {
    font-family: 'Fraunces', 'Playfair Display', serif;
    font-variation-settings: 'opsz' 144, 'SOFT' 0;
    font-weight: 900;
    font-size: 5rem;
    line-height: 0.85;
    float: left;
    padding: 0.35rem 0.85rem 0 0;
    color: var(--accent);
    background: linear-gradient(135deg, var(--accent), var(--accent-warm));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.article-body h3 {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'opsz' 48, 'SOFT' 50;
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--ink);
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.article-body ul {
    list-style: none;
    margin: 0 0 1.5rem 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.article-body ul li {
    position: relative;
    padding: 0.75rem 0 0.75rem 2rem;
    border-bottom: 1px solid var(--line);
    transition: padding var(--dur) var(--ease);
}

.article-body ul li:last-child {
    border-bottom: none;
}

.article-body ul li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0.8em;
    color: var(--accent);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1;
    transition: transform var(--dur) var(--ease);
}

.article-body ul li:hover {
    padding-left: 2.35rem;
}

.article-body ul li:hover::before {
    transform: translateX(4px);
}

.article-body strong {
    color: var(--ink);
    font-weight: 600;
    background: linear-gradient(transparent 62%, rgba(196, 30, 58, 0.12) 62%);
    padding: 0 2px;
}

.article-body a {
    color: var(--accent);
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    transition: background-size var(--dur) var(--ease), color var(--dur) var(--ease);
    padding-bottom: 1px;
}

.article-body a:hover {
    background-size: 100% 1px;
    color: var(--accent-deep);
}

.article-body hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
    margin: 3rem 0;
}

.article-body blockquote {
    margin: 1.5rem 0 1.5rem 1rem;
    padding: 1rem 1.25rem 1rem 1.5rem;
    border-left: 3px solid var(--accent);
    background: var(--paper-alt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.96rem;
    line-height: 1.65;
    color: var(--ink-soft);
    font-style: normal;
}

.article-body blockquote + blockquote {
    margin-top: -0.5rem;
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 800ms var(--ease), transform 800ms var(--ease);
}

.reveal.in {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Author page
   ============================================ */
.author-hero {
    text-align: center;
    padding-top: 5rem;
}

.author-hero .article-title,
.author-hero .article-lead {
    margin-left: auto;
    margin-right: auto;
}

.author-avatar-large {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-warm), var(--accent));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 4.2rem;
    margin: 0 auto 1.75rem;
    box-shadow: 0 20px 60px var(--accent-glow), 0 0 0 6px rgba(255, 255, 255, 0.7);
    animation: rise 900ms var(--ease) both, bobble 6s ease-in-out 1s infinite;
    color: white;
}

@keyframes bobble {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

.no-dropcap > p:first-of-type::first-letter {
    all: unset;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    position: relative;
    z-index: 1;
    background: var(--ink);
    color: var(--muted-light);
    padding: 4rem 1.5rem 2rem;
    margin-top: 3rem;
    overflow: hidden;
    isolation: isolate;
}

.footer::before {
    content: "";
    position: absolute;
    top: -140px;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, var(--accent-glow), transparent 65%);
    filter: blur(60px);
    z-index: -1;
    pointer-events: none;
}

.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr auto;
    gap: 3rem;
    align-items: start;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand h4 {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.footer-brand p {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--muted-light);
    max-width: 380px;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 160px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-light);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.4rem 0;
    transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.footer-links a::after {
    content: "→";
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    color: var(--accent-warm);
}

.footer-links a:hover {
    color: #fff;
    transform: translateX(4px);
}

.footer-links a:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.footer-bottom {
    max-width: 1200px;
    margin: 1.75rem auto 0;
    font-size: 0.8rem;
    color: #6f6f78;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ============================================
   Layout wrapper (article + TOC)
   ============================================ */
.layout {
    position: relative;
    z-index: 1;
}

/* ============================================
   Table of contents (sticky sidebar)
   ============================================ */
.toc {
    position: fixed;
    top: 88px;
    left: max(1.5rem, calc((100vw - 1500px) / 2 + 1rem));
    width: 260px;
    max-height: calc(100vh - 120px);
    z-index: 50;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 500ms var(--ease), transform 500ms var(--ease), visibility 0s 0s;
    pointer-events: auto;
    visibility: visible;
}

.toc.toc-hidden {
    opacity: 0;
    transform: translateX(-12px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 300ms var(--ease), transform 300ms var(--ease), visibility 0s 300ms;
}

.toc-inner {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 0.5rem 1.1rem 1rem;
    box-shadow: 0 1px 2px rgba(20,20,26,0.03), 0 12px 40px rgba(20,20,26,0.06);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.toc-heading {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 0.6rem 0.35rem;
    padding: 0;
    flex-shrink: 0;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0 0.5rem 0 0;
    counter-reset: toc;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
}

.toc-list::-webkit-scrollbar {
    width: 6px;
}
.toc-list::-webkit-scrollbar-track { background: transparent; }
.toc-list::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 999px;
}

.toc-list li {
    counter-increment: toc;
    position: relative;
    margin: 0;
}

.toc-list a {
    display: block;
    position: relative;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--muted);
    text-decoration: none;
    padding: 0.45rem 0.6rem 0.45rem 2.1rem;
    border-radius: var(--radius-sm);
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), padding var(--dur-fast) var(--ease);
}

.toc-list a::before {
    content: counter(toc, decimal-leading-zero);
    position: absolute;
    left: 0.5rem;
    top: 0.45rem;
    font-size: 0.68rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted-light);
    letter-spacing: 0.05em;
    transition: color var(--dur-fast) var(--ease);
}

.toc-list a:hover {
    color: var(--ink);
    background: rgba(196, 30, 58, 0.05);
}

.toc-list a:hover::before {
    color: var(--accent);
}

.toc-list a.active {
    color: var(--ink);
    font-weight: 600;
    background: rgba(196, 30, 58, 0.08);
}

.toc-list a.active::before {
    color: var(--accent);
}

.toc-list a.active::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background: var(--accent);
    border-radius: 2px;
}

/* Smooth scroll target offset for sticky topbar */
h3[id] {
    scroll-margin-top: 80px;
}

/* TOC toggle button (mobile) */
.toc-toggle {
    display: none;
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 60;
    padding: 0.7rem 1.1rem;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(20,20,26,0.22);
    align-items: center;
    gap: 0.55rem;
    transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.toc-toggle:hover {
    background: var(--accent-deep);
    transform: translateY(-2px);
}

.toc-toggle.toc-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}

.toc-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ============================================
   Responsive — TOC behavior
   ============================================ */
@media (max-width: 1280px) {
    .toc {
        left: 1.25rem;
        width: 230px;
    }
}

@media (max-width: 1100px) {
    .toc {
        left: 0;
        top: 0;
        width: min(320px, 88vw);
        max-height: 100vh;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 320ms var(--ease);
        animation: none;
        opacity: 1;
    }
    .toc.open {
        transform: translateX(0);
    }
    .toc-inner {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border-left: none;
        border-top: none;
        border-bottom: none;
        padding-top: 3.5rem;
        box-shadow: 0 14px 48px rgba(20,20,26,0.18);
    }
    .toc-toggle {
        display: inline-flex;
    }
    .toc.open ~ .toc-toggle,
    .toc.open + * .toc-toggle {
        /* Keep toggle visible to allow closing */
    }
}

/* ============================================
   Text selection
   ============================================ */
::selection {
    background: var(--accent);
    color: white;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
    .hero {
        padding: 3.5rem 1.25rem 2rem;
    }

    .article-body {
        padding: 1.5rem 1.25rem 5rem;
        font-size: 1.1rem;
    }

    .topbar-inner {
        padding: 0.8rem 1rem;
    }

    .article-body > p:first-of-type::first-letter {
        font-size: 3.8rem;
    }

    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .topbar-meta {
        display: none;
    }
}

@media print {
    .topbar, .footer, .progress, body::before, body::after { display: none; }
    body { background: white; }
}
