/* ==========================================================================
   RAIL – Theme für KERN
   Aufbau: schmale Icon-Sidebar links · Suchleiste + Tag/Nacht oben · Themenleiste · Inhalt
   Erbt Farben, Dark Mode, Buttons, Pagination und Artikeltexte vom Standard-Design.
   ========================================================================== */
/* Das Haupt-CSS wird in templates/layout.php mit Versionsnummer eingebunden ($baseCssUrl) – hier stehen nur die Rail-Stile. */

:root { --rail-w: 64px; --r-wrap: 1200px; --r-radius: 12px; --r-hero-top: 1.75rem; --r-hero-bottom: 2.75rem; }   /* Abstand oberhalb/unterhalb des Seitenkopfs */

.r-app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }
.r-body { min-width: 0; }

/* --- Icon-Sidebar --- */
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; background: var(--bg-paper); border-right: 1px solid var(--border-subtle); z-index: 200; }
.r-logo { width: 36px; height: 36px; margin-bottom: 10px; display: grid; place-items: center; background: var(--text-main); color: var(--bg-paper); border-radius: 8px; font-weight: 700; font-size: 1rem; }
.r-btn, .rail summary { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--text-muted); background: none; border: 0; cursor: pointer; transition: background 0.15s, color 0.15s; list-style: none; }
.r-btn:hover, .rail summary:hover { background: var(--bg-soft); color: var(--text-main); }
.r-btn.on { background: var(--bg-soft); color: var(--text-main); }
.r-btn svg, .rail summary svg, .r-theme svg { width: 22px; height: 22px; }
.rail summary::-webkit-details-marker { display: none; }
.r-btn.profile { width: 46px; height: 46px; }
.r-btn.profile .avatar-img, .r-btn.profile .avatar { width: 34px; height: 34px; font-size: 0.95rem; box-shadow: 0 0 0 2px var(--border-subtle); transition: box-shadow 0.15s; }
.r-btn.profile:hover .avatar-img, .r-btn.profile:hover .avatar { box-shadow: 0 0 0 2px var(--accent-warm); }
.r-sep { width: 28px; height: 1px; background: var(--border-subtle); margin: 8px 0; }
.r-spacer { flex: 1; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--text-main); color: var(--bg-paper); padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.75rem; white-space: nowrap; z-index: 300; pointer-events: none; }
.r-more { position: relative; }
.r-more[open] summary { background: var(--bg-soft); color: var(--text-main); }
.r-more[open] [data-tip]:hover::after { display: none; }
.r-pop { position: absolute; left: calc(100% + 10px); bottom: 0; min-width: 210px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 0.4rem; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.16); z-index: 300; }
.r-pop a { display: block; padding: 0.55rem 0.8rem; border-radius: 8px; font-size: 0.9rem; color: var(--text-main); }
.r-pop a:hover { background: var(--bg-soft); }

/* --- Kopf: Suche + Tag/Nacht, darunter Themenleiste --- */
.r-head { position: sticky; top: 0; z-index: 100; background: var(--bg-paper); }
.r-top { display: flex; align-items: center; gap: 1rem; padding: 0.8rem 1.5rem; }
.r-search { flex: 1; position: relative; }
.r-search svg { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); }
.r-search input { width: 100%; height: 48px; padding: 0 1.2rem 0 3rem; font: inherit; font-size: 1rem; border: 1px solid transparent; border-radius: 999px; background: var(--bg-soft); color: var(--text-main); }
.r-search input:focus { outline: none; background: var(--bg-card); border-color: var(--text-muted); }
.r-theme { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--border-subtle); border-radius: 50%; background: none; color: var(--text-main); cursor: pointer; transition: background 0.15s; flex: none; }
.r-theme:hover { background: var(--bg-soft); }
.r-theme .i-sun { display: none; }
body.dark-mode .r-theme .i-moon { display: none; }
body.dark-mode .r-theme .i-sun { display: block; }
.r-tabs { display: flex; padding: 0 1.5rem; border-bottom: 1px solid var(--border-subtle); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.r-tabs::-webkit-scrollbar { display: none; }
.r-tabs a { padding: 0.8rem 0.9rem; font-size: 0.92rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.r-tabs a:hover { color: var(--text-main); }
.r-tabs a.on { color: var(--text-main); box-shadow: inset 0 -2px 0 var(--text-main); }

/* --- Inhalt (redaktionell: Hauptartikel + Kartenraster) --- */
.r-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem; margin: 0 0 1.25rem; font-size: 0.82rem; color: var(--text-muted); }
.r-crumbs a { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.6rem; border-radius: 999px; transition: background 0.15s, color 0.15s; }
.r-crumbs a:hover { background: var(--bg-soft); color: var(--text-main); }
.r-crumbs svg { width: 14px; height: 14px; }
.r-crumbs .sep { display: inline-flex; opacity: 0.4; }
.r-crumbs .cur { padding: 0.22rem 0.6rem; color: var(--text-main); font-weight: 600; }
.r-wrap { max-width: var(--r-wrap); margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.r-wrap > article { max-width: none; }
/* Einheitlicher Seitenkopf: Startseite, Listen, Seiten und Beiträge sehen gleich aus */
.r-wrap .hero-section.compact, .r-wrap .article-head { padding: 0.5rem 0 2rem; margin: var(--r-hero-top) 0 var(--r-hero-bottom); border-bottom: 1px solid var(--border-subtle); }
.r-wrap .hero-section.compact .hero-title, .r-wrap .article-head .hero-title { font-size: clamp(2rem, 4.2vw, 3.1rem); letter-spacing: -0.03em; line-height: 1.12; margin: 0.4rem 0 0.8rem; }
.r-wrap .hero-section.compact .hero-subtitle { margin: 0; max-width: 720px; font-size: 1.08rem; }
.r-wrap .article-head .post-meta { margin-bottom: 0; }
.r-h { font-size: 0.8rem; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 2.5rem 0 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--border-subtle); }

.r-feature { position: relative; display: flex; align-items: flex-end; min-height: 440px; border-radius: 16px; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.r-feature .cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.r-feature:hover .cover { transform: scale(1.03); }
.r-feature .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.5) 42%, rgba(0, 0, 0, 0.05) 100%), linear-gradient(to right, rgba(0, 0, 0, 0.35), transparent 60%); }
.r-feature .txt { position: relative; padding: 2.25rem; max-width: 760px; }
.r-badge { display: inline-block; background: var(--accent-warm); color: #fff; padding: 0.2rem 0.7rem; border-radius: 999px; font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.8rem; }
.r-feature h2 { font-size: clamp(1.7rem, 3.4vw, 2.7rem); line-height: 1.12; letter-spacing: -0.028em; margin-bottom: 0.8rem; }
.r-card h3 a:hover { color: var(--accent-warm); }
.r-feature p { color: rgba(255, 255, 255, 0.88); margin-bottom: 1rem; max-width: 60ch; }
.r-feature .r-cat { color: #ffb98a; }
.r-feature .r-meta { color: rgba(255, 255, 255, 0.78); }

.r-grid, .posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 2.2rem 1.6rem; grid-auto-rows: auto; }
.r-card { display: flex; flex-direction: column; gap: 0.8rem; }
.r-img { display: block; overflow: hidden; border-radius: var(--r-radius); background: var(--bg-soft); }
.r-img img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; transition: transform 0.4s; }
.r-card:hover .r-img img { transform: scale(1.03); }
.r-ph { display: grid; place-items: center; aspect-ratio: 16 / 10; color: rgba(255, 255, 255, 0.75); font-size: 3rem; font-weight: 700; background: linear-gradient(135deg, var(--c1), var(--c2)); }
.r-cat { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-warm); }
.r-card h3 { font-size: 1.2rem; line-height: 1.28; letter-spacing: -0.015em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.r-meta { font-size: 0.8rem; color: var(--text-muted); }

.r-foot { border-top: 1px solid var(--border-subtle); }
.r-foot-in { max-width: var(--r-wrap); margin: 0 auto; padding: 1.4rem 1.5rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-muted); }
.r-foot a { margin-left: 1rem; }
.r-foot a:hover { color: var(--accent-warm); }

/* --- Mobil: Sidebar wird zur Leiste unten --- */
@media (max-width: 800px) {
    .r-app { grid-template-columns: 1fr; }
    .rail { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: 58px; flex-direction: row; justify-content: space-around; padding: 0 0.5rem; gap: 0; border-right: 0; border-top: 1px solid var(--border-subtle); }
    .r-logo, .r-sep, .r-spacer { display: none; }
    .r-pop { left: auto; right: 0.25rem; bottom: calc(100% + 8px); }
    [data-tip]:hover::after { display: none; }
    .r-top { padding: 0.6rem 1rem; }
    .r-tabs { padding: 0 1rem; }
    .r-wrap { padding: 1rem 1rem 5.5rem; }
    .r-feature { min-height: 340px; }
    .r-feature .txt { padding: 1.4rem; }
    .r-foot-in { padding-bottom: 5rem; }
}

/* --- Rail 2.0: großes Burger-Menü (3 Spalten + Fußzeile), Logo mit bis zu 3 Buchstaben --- */
.r-logo { font-size: 0.85rem; letter-spacing: -0.02em; overflow: hidden; }
.r-mega { position: absolute; left: calc(100% + 12px); bottom: 0; width: min(800px, calc(100vw - 110px)); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2); z-index: 300; overflow: hidden; }
.r-mega-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; padding: 1.75rem 1.75rem 1.25rem; }
.r-mega h5 { font-family: 'JetBrains Mono', monospace; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 0.7rem; }
.r-mega-cols a { display: flex; align-items: center; gap: 0.65rem; padding: 0.45rem 0.55rem; margin: 0 -0.55rem; border-radius: 8px; font-size: 0.93rem; color: var(--text-main); }
.r-mega-cols a:hover { background: var(--bg-soft); }
.r-mega-cols svg { width: 18px; height: 18px; color: var(--text-muted); flex: none; }
.r-mega-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem 1.75rem; border-top: 1px solid var(--border-subtle); background: var(--bg-soft); font-size: 0.8rem; color: var(--text-muted); }
.r-mega-foot a:hover { color: var(--accent-warm); }
@media (max-width: 800px) {
    .r-mega { position: fixed; left: 0.5rem; right: 0.5rem; bottom: 66px; width: auto; max-height: calc(100vh - 90px); overflow-y: auto; }
    .r-mega-cols { grid-template-columns: 1fr; gap: 1.1rem; padding: 1.25rem; }
    .r-mega-foot { padding: 0.8rem 1.25rem; }
}

/* --- Rail 2.1: Icons in den Spaltenüberschriften, Links in der Fußzeile des Burger-Menüs --- */
.r-mega h5 { display: flex; align-items: center; gap: 0.5rem; }
.r-mega h5 svg { width: 15px; height: 15px; color: var(--accent-warm); flex: none; }
.r-mega-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; justify-content: flex-end; }

/* --- Rail 2.2: Buttons im Seitenkopf --- */
.r-wrap .hero-section .hero-actions { margin-top: 1.4rem; }
