/* ============================================================
   App Shell — Refined Editorial Tech
   ============================================================ */

/* ===== Skip Link ===== */
.skip-link {
    position: absolute;
    top: -100px; left: 16px;
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    font-size: 13px;
    text-decoration: none;
    z-index: 1000;
    transition: top 160ms;
}
.skip-link:focus { top: 12px; }

/* ============================================================
   AppBar
   ============================================================ */
.appbar {
    position: sticky; top: 0; z-index: 100;
    height: 60px;
    border-bottom: 1px solid var(--border-subtle);
    background: color-mix(in oklab, var(--bg-base) 78%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.appbar-nav {
    display: flex; align-items: center; gap: 4px;
    height: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}

.appbar-brand {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 19px;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-decoration: none;
    padding: 6px 4px;
    margin-right: 8px;
    font-feature-settings: "ss01", "ss02";
}
.appbar-brand:hover { color: var(--brand-primary); }

.appbar-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.005em;
    transition: color 160ms, background-color 160ms;
}
.appbar-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.appbar-link-brand {
    color: var(--text-primary);
    position: relative;
    padding-left: 20px;
}
.appbar-link-brand::before {
    content: "";
    position: absolute;
    left: 8px; top: 50%;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--brand-primary);
    transform: translateY(-50%);
    box-shadow: 0 0 8px var(--brand-primary-glow);
}

/* ===== Desktop primary nav + actions groups ===== */
.appbar-primary,
.appbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.appbar-primary { margin-left: 12px; }
.appbar-actions { gap: 8px; }

/* ============================================================
   Hamburger button (visible on mobile only — see mobile.css)
   ============================================================ */
.appbar-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    transition: background-color 160ms, border-color 160ms, transform 100ms;
}
.appbar-menu-btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.appbar-menu-btn:active { transform: scale(0.96); }

.hamburger-icon {
    position: relative;
    width: 18px;
    height: 12px;
    display: inline-block;
}
.hamburger-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
                opacity 200ms ease,
                top 280ms cubic-bezier(0.16, 1, 0.3, 1);
}
.hamburger-icon span:nth-child(1) { top: 0; }
.hamburger-icon span:nth-child(2) { top: 5px; }
.hamburger-icon span:nth-child(3) { top: 10px; }

.hamburger-icon.is-open span:nth-child(1) {
    top: 5px;
    transform: rotate(45deg);
}
.hamburger-icon.is-open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger-icon.is-open span:nth-child(3) {
    top: 5px;
    transform: rotate(-45deg);
}

/* ============================================================
   Mobile Sheet — full-screen slide-in menu
   ============================================================ */
.mobile-sheet {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(26, 24, 21, 0.34);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: msheet-fade-in 220ms ease;
    display: flex;
    justify-content: flex-end;
}
.mobile-sheet[hidden] { display: none !important; }
@keyframes msheet-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mobile-sheet__panel {
    width: min(420px, 92vw);
    height: 100%;
    background: var(--bg-base);
    border-left: 1px solid var(--border-default);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: msheet-slide-in 320ms cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}
@keyframes msheet-slide-in {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.mobile-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    flex: 0 0 auto;
}
.mobile-sheet__brand {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.mobile-sheet__close {
    width: 36px; height: 36px;
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 160ms, color 160ms, border-color 160ms;
}
.mobile-sheet__close:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.mobile-sheet__nav {
    display: flex;
    flex-direction: column;
    padding: 12px 14px 24px;
    flex: 1 1 auto;
}

/* Editorial mobile menu item with stagger animation */
.msheet-link {
    display: flex;
    align-items: baseline;
    gap: 18px;
    padding: 16px 14px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 10px;
    transition: background-color 200ms, color 200ms;
    opacity: 0;
    animation: msheet-item-in 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.msheet-link:hover { background: var(--bg-elevated); }
.msheet-link:nth-child(1) { animation-delay: 60ms; }
.msheet-link:nth-child(2) { animation-delay: 120ms; }
.msheet-link:nth-child(3) { animation-delay: 180ms; }
.msheet-link:nth-child(4) { animation-delay: 240ms; }
.msheet-link:nth-child(5) { animation-delay: 300ms; }
.msheet-link:nth-child(6) { animation-delay: 360ms; }
.msheet-link:nth-child(7) { animation-delay: 420ms; }
.msheet-link:nth-child(8) { animation-delay: 480ms; }
@keyframes msheet-item-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.msheet-link__num {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.14em;
    flex: 0 0 32px;
    line-height: 1;
}
.msheet-link__label {
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 400;
    font-variation-settings: "opsz" 96;
    color: var(--text-primary);
    transition: color 200ms;
}
.msheet-link--brand .msheet-link__num,
.msheet-link--brand .msheet-link__label { color: var(--brand-primary); }
.msheet-link:hover .msheet-link__label { color: var(--brand-primary); }

.mobile-sheet__footer {
    flex: 0 0 auto;
    padding: 16px 22px 22px;
    border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   Page Main
   ============================================================ */
.page-main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 28px;
    min-height: calc(100vh - 60px - 220px);
}
.page-main-wide { max-width: 1240px; }

/* Safety net: prevent stray decorative glows / blurs from triggering
   horizontal scroll. overflow-x: clip is preferred over hidden because
   it doesn't establish a scroll container. */
html, body { overflow-x: clip; max-width: 100%; }

/* ============================================================
   Site Footer — refined "fat footer" with sitemap navigation
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    margin-top: 120px;
    padding: 72px 0 32px;
    color: var(--text-secondary);
    font-size: 14px;
    background: var(--bg-base);
}
.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}

/* ----- 4-column grid (symmetric) ----- */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 48px 40px;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--border-subtle);
    align-items: start;
}

@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 40px 32px;
    }
}
@media (max-width: 520px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* ----- Brand column ----- */
.footer-col--brand { display: flex; flex-direction: column; gap: 16px; }
.footer-brand {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-decoration: none;
    font-feature-settings: "ss01", "ss02";
    font-variation-settings: "opsz" 36;
    align-self: flex-start;
}
.footer-brand:hover { color: var(--brand-primary); }
.footer-tagline {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    max-width: 100%;
}

/* ----- Generic column ----- */
.footer-col__title {
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0 0 18px;
}
.footer-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.footer-list li { line-height: 1.4; }
.footer-list a,
.footer-list .cookie-settings-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: color 160ms;
    background: none; border: 0; padding: 0;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}
.footer-list a:hover,
.footer-list .cookie-settings-link:hover { color: var(--text-primary); }
.footer-list a:focus-visible,
.footer-list .cookie-settings-link:focus-visible { color: var(--brand-primary); }

.footer-list__more { margin-top: 4px; }
.footer-list__more a { color: var(--text-primary); }

.footer-empty { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ----- Optional "Aktuelle Artikel" row above the symmetric grid ----- */
.footer-recent {
    padding-bottom: 40px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-subtle);
}
.footer-recent .footer-col__title { margin-bottom: 14px; }
.footer-recent__list {
    list-style: none;
    margin: 0; padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 32px;
}
.footer-recent__list li { line-height: 1.45; }
.footer-recent__list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    letter-spacing: -0.005em;
    transition: color 160ms;
}
.footer-recent__list a:hover { color: var(--text-primary); }
.footer-recent__list .footer-list__more a { color: var(--text-primary); }

/* ----- Bottom bar ----- */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 28px;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12.5px;
    color: var(--text-muted);
}
.footer-copy {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.footer-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
}
.footer-meta a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 160ms;
}
.footer-meta a:hover { color: var(--text-primary); }
.footer-meta span[aria-hidden] { color: var(--border-default); }

/* ============================================================
   Admin Sub-nav (refined pill rail)
   ============================================================ */
.admin-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 18px 0 26px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 36px;
    overflow-x: auto;
    scrollbar-width: none;
}
.admin-subnav::-webkit-scrollbar { display: none; }
.admin-subnav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 11px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.005em;
    white-space: nowrap;
    transition: color 160ms, background-color 160ms;
}
.admin-subnav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.admin-subnav-link.active {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* ============================================================
   Alerts — refined inline notice
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    font-size: 13.5px;
    line-height: 1.55;
    display: flex; gap: 12px; align-items: flex-start;
    background: var(--bg-surface);
}
.alert::before {
    content: "";
    flex: 0 0 auto;
    width: 4px; height: 4px;
    border-radius: 50%;
    margin-top: 9px;
    background: var(--text-secondary);
}
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }
.alert-info::before    { background: var(--info); }
.alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.alert-success::before { background: var(--success); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-bg);     color: var(--warning); }
.alert-warning::before { background: var(--warning); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.alert-danger::before  { background: var(--danger); }

/* ============================================================
   Theme Toggle (segmented control)
   ============================================================ */
.theme-toggle {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    gap: 2px;
}
.theme-toggle__btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.005em;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color 160ms, background-color 160ms, box-shadow 220ms;
}
.theme-toggle__btn:hover { color: var(--text-primary); }
.theme-toggle__btn.is-active {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 0 0 0.5px var(--border-default);
}
.theme-toggle__btn svg { opacity: 0.85; }
.theme-toggle__btn.is-active svg { opacity: 1; color: var(--brand-primary); }

/* ============================================================
   Auth card (Login / Register form wrapper)
   ============================================================ */
.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    padding: 32px 28px;
    box-shadow: var(--shadow);
}
.form-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.form-field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.form-field input {
    width: 100%;
    padding: 11px 14px;
    font: inherit;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    transition: border-color 160ms, box-shadow 160ms;
}
.form-field input:focus {
    outline: 0;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-glow-sm);
}
.form-field input[readonly], .form-field input:disabled {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* ============================================================
   Page intro — editorial section header
   ============================================================ */
.page-intro {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 56px 0 36px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 40px;
}
.page-intro__eyebrow {
    font-family: var(--font-mono);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--brand-primary);
    margin: 0;
    font-weight: 500;
}
.page-intro__title {
    font-family: var(--font-display);
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 400;
    line-height: 1.04;
    letter-spacing: -0.025em;
    margin: 0;
    font-feature-settings: "ss01", "ss02";
    font-variation-settings: "opsz" 144, "SOFT" 30;
    color: var(--text-primary);
}
.page-intro__title em {
    font-style: italic;
    font-variation-settings: "opsz" 144, "SOFT" 100;
    color: var(--brand-primary);
}
.page-intro__subtitle {
    font-size: 16px;
    line-height: 1.55;
    color: var(--text-secondary);
    max-width: 60ch;
    margin: 4px 0 0;
}

/* ============================================================
   Cookie banner
   ============================================================ */
.cookie-banner {
    position: fixed; bottom: 16px; left: 16px; right: 16px;
    z-index: 90;
    padding: 16px 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
}
.cookie-banner-inner {
    max-width: 1040px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px 28px;
    align-items: center;
}
.cookie-banner-text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-secondary);
}
.cookie-banner-link { color: var(--text-primary); font-weight: 500; }
.cookie-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
    .cookie-banner-inner { grid-template-columns: 1fr; }
    .cookie-banner-actions { justify-content: stretch; }
}

/* ============================================================
   Editorial decorative grain (subtle film-paper texture)
   ============================================================ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.018;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================
   Page reveal (subtle fade-in on first paint)
   Opacity-only — `transform` would create a containing block
   for position:fixed descendants (breaks modals).
   ============================================================ */
@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.page-main { animation: page-fade-in 240ms ease both; }
