/* ═══════════════════════════════════════════════
   rotecodefraktion — Editorial Redesign
   Accent: #c8102e
   ═══════════════════════════════════════════════ */

/* ─── TOKENS (Light) ─── */
:root {
  --bg: #faf8f5;
  --bg-surface: #ffffff;
  --bg-muted: #f0eee9;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-tertiary: #999999;
  --accent: #c8102e;
  --accent-hover: #a00d24;
  --border: #e5e0d8;
  --border-strong: #c8102e;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.08);
  --display: 'Instrument Serif', Georgia, serif;
  --body: 'DM Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --max-w: 1080px;
  --content-w: 680px;
}

/* ─── TOKENS (Dark — system preference) ─── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --bg-surface: #1e1e1e;
    --bg-muted: #2a2a2a;
    --text: #e8e4df;
    --text-secondary: #a8a8a8;
    --text-tertiary: #666666;
    --accent: #ff4d5e;
    --accent-hover: #ff6b7a;
    --border: #2e2e2e;
    --border-strong: #ff4d5e;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }
}

/* ─── TOKENS (Dark — manual override) ─── */
[data-theme="dark"] {
  --bg: #141414;
  --bg-surface: #1e1e1e;
  --bg-muted: #2a2a2a;
  --text: #e8e4df;
  --text-secondary: #a8a8a8;
  --text-tertiary: #666666;
  --accent: #ff4d5e;
  --accent-hover: #ff6b7a;
  --border: #2e2e2e;
  --border-strong: #ff4d5e;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: var(--bg); color: var(--text); font-family: var(--body); font-size: 17px; font-weight: 400; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── NAV ─── */
nav.global { position: sticky; top: 0; z-index: 1000; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.nav-bar { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; height: 48px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 6px; }
.nav-logo .dot { color: var(--accent); font-size: 20px; line-height: 1; }
.nav-links { display: flex; gap: 24px; list-style: none; }
.nav-links a { font-family: var(--body); font-size: 13px; color: var(--text-secondary); transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.theme-toggle { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-surface); cursor: pointer; display: grid; place-items: center; font-size: 13px; transition: background 0.15s; color: var(--text-secondary); }
.theme-toggle:hover { background: var(--bg-muted); }

/* ─── MASTHEAD ─── */
.masthead { padding: 40px 24px 28px; border-bottom: 3px solid var(--accent); max-width: var(--max-w); margin: 0 auto; }
.masthead h1 { font-family: var(--display); font-size: 36px; font-weight: 400; line-height: 1.1; color: var(--text); margin-bottom: 4px; }
.masthead .tagline { font-family: var(--body); font-size: 15px; color: var(--text-secondary); }

/* ─── NEWSPAPER GRID ─── */
.news-grid { display: grid; grid-template-columns: 1.5fr 1fr; max-width: var(--max-w); margin: 0 auto; }
.lead-article { padding: 28px 24px; border-right: 1px solid var(--border); }
.lead-article .img-wrap { border-radius: 8px; overflow: hidden; box-shadow: var(--card-shadow); margin-bottom: 16px; }
.lead-article .img-wrap img { width: 100%; height: auto; }
.meta { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); margin-bottom: 8px; }
.lead-article h2 { font-family: var(--display); font-size: 28px; font-weight: 400; line-height: 1.15; color: var(--text); margin-bottom: 10px; }
.lead-article .excerpt { font-family: var(--body); font-size: 15px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 14px; }
.read-more { font-size: 14px; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.read-more:hover { text-decoration: underline; text-underline-offset: 3px; }

.secondary-articles { display: flex; flex-direction: column; }
.sec-item { padding: 24px 24px; border-bottom: 1px solid var(--border); flex: 1; transition: background 0.15s; }
.sec-item:last-child { border-bottom: none; }
.sec-item:hover { background: var(--bg-muted); }
.sec-item .meta { font-size: 10px; margin-bottom: 6px; }
.sec-item h3 { font-family: var(--display); font-size: 20px; font-weight: 400; line-height: 1.2; color: var(--text); margin-bottom: 6px; }
.sec-item .excerpt { font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* ─── RED DIVIDER ─── */
.divider { border: none; border-top: 2px solid var(--accent); max-width: var(--max-w); margin: 0 auto; }

/* ─── MORE POSTS (3-col) ─── */
.more-posts { display: grid; grid-template-columns: 1fr 1fr 1fr; max-width: var(--max-w); margin: 0 auto; border-bottom: 1px solid var(--border); }
.more-item { padding: 20px 24px; border-right: 1px solid var(--border); transition: background 0.15s; position: relative; }
.more-item:last-child { border-right: none; }
.more-item:hover { background: var(--bg-muted); padding-left: 36px; }
.more-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 0.2s; }
.more-item:hover::before { width: 3px; }
.more-item .meta { font-size: 10px; color: var(--text-tertiary); margin-bottom: 4px; }
.more-item h4 { font-family: var(--display); font-size: 16px; font-weight: 400; line-height: 1.25; color: var(--text); }

/* ─── NEWS TICKER ─── */
.news-ticker { padding: 28px 24px; background: var(--bg-surface); max-width: var(--max-w); margin: 0 auto; border-bottom: 1px solid var(--border); }
.news-ticker-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.news-ticker-header h3 { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-tertiary); display: flex; align-items: center; gap: 8px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.news-ticker-header .all-link { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.news-ticker-header .all-link:hover { text-decoration: underline; }
.news-list { list-style: none; }
.news-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--bg-muted); }
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--bg); }
.news-item .date { font-family: var(--mono); font-size: 10px; color: var(--text-tertiary); }
.news-item .title { font-family: var(--body); font-size: 14px; color: var(--text); line-height: 1.4; }
.news-item .source { font-family: var(--mono); font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }

/* ─── PROJECT ─── */
.project-section { padding: 40px 24px; max-width: var(--max-w); margin: 0 auto; }
.project-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: center; }
.project-img { background: var(--bg-muted); border-radius: 8px; overflow: hidden; min-height: 160px; display: flex; align-items: center; justify-content: center; }
.project-img img { width: 100%; height: auto; }
.project-body .meta { margin-bottom: 8px; }
.project-body h3 { font-family: var(--display); font-size: 24px; font-weight: 400; line-height: 1.2; color: var(--text); margin-bottom: 8px; }
.project-body .desc { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 16px; }
.btn-cta { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--accent); color: #fff; border-radius: 6px; font-family: var(--body); font-size: 14px; font-weight: 500; border: none; cursor: pointer; transition: background 0.15s; }
.btn-cta:hover { background: var(--accent-hover); color: #fff; }
.text-link { font-size: 14px; color: var(--accent); margin-left: 12px; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ─── ARTICLE PAGE ─── */
.article-header { max-width: var(--content-w); margin: 0 auto; padding: 48px 24px 0; }
.breadcrumb { font-family: var(--mono); font-size: 11px; color: var(--text-tertiary); margin-bottom: 20px; display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.article-tags { display: flex; gap: 8px; margin-bottom: 16px; }
.article-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); background: #fef2f2; padding: 3px 8px; border-radius: 3px; }
[data-theme="dark"] .article-tag { background: rgba(255,77,94,0.1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .article-tag { background: rgba(255,77,94,0.1); }
}
.article-title { font-family: var(--display); font-size: clamp(32px, 5vw, 40px); font-weight: 400; line-height: 1.12; color: var(--text); margin-bottom: 16px; }
.article-meta { font-family: var(--mono); font-size: 11px; color: var(--text-tertiary); letter-spacing: 0.3px; display: flex; gap: 12px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid var(--border); }
.article-hero { max-width: var(--content-w); margin: 28px auto 0; padding: 0 24px; }
.article-hero img { width: 100%; border-radius: 8px; box-shadow: var(--card-shadow); }

/* ─── PROSE ─── */
.prose { max-width: var(--content-w); margin: 0 auto; padding: 32px 24px 48px; font-size: 17px; line-height: 1.7; color: var(--text-secondary); }
.prose p { margin: 0 0 1.4em; }
.prose h2 { font-family: var(--display); font-size: 28px; font-weight: 400; line-height: 1.2; margin: 2.2em 0 0.6em; color: var(--text); padding-top: 1.2em; border-top: 1px solid var(--border); }
.prose h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.prose h3 { font-family: var(--body); font-size: 18px; font-weight: 600; line-height: 1.3; margin: 1.8em 0 0.5em; color: var(--text); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-muted); padding: 2px 6px; border-radius: 4px; }
.prose pre { background: #1a1a1a; color: #e8e4df; padding: 20px 24px; border-radius: 8px; overflow-x: auto; font-size: 14px; line-height: 1.6; margin: 1.5em 0; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose ul, .prose ol { margin: 0 0 1.4em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; margin: 1.5em 0; color: var(--text-secondary); font-style: italic; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.5em 0; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.prose th { background: var(--bg-muted); font-weight: 600; }
.prose img { border-radius: 8px; margin: 1.5em 0; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

/* ─── ARTICLE FOOTER ─── */
.article-footer { max-width: var(--content-w); margin: 0 auto; padding: 0 24px 48px; }
.article-footer .divider { margin: 0 0 28px; max-width: 100%; }
.author-block { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.author-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-muted); object-fit: cover; flex-shrink: 0; }
.author-name { font-family: var(--body); font-size: 15px; font-weight: 600; color: var(--text); }
.author-bio { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin-top: 2px; }
.related-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-tertiary); margin-bottom: 12px; }
.related-list { list-style: none; }
.related-item { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); transition: all 0.15s; position: relative; cursor: pointer; }
.related-item:last-child { border-bottom: none; }
.related-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 0.2s; }
.related-item:hover { padding-left: 12px; }
.related-item:hover::before { width: 3px; }
.related-item .title { font-family: var(--display); font-size: 17px; color: var(--text); }
.related-item .tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-tertiary); }

/* ─── BLOG ARCHIVE ─── */
.archive-header { padding: 48px 24px 20px; max-width: var(--max-w); margin: 0 auto; border-bottom: 2px solid var(--accent); }
.archive-header h1 { font-family: var(--display); font-size: 32px; font-weight: 400; color: var(--text); margin-bottom: 4px; }
.archive-header .desc { font-size: 14px; color: var(--text-secondary); }
.filter-row { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 10px; border-radius: 4px; cursor: pointer; transition: all 0.15s; border: none; }
.filter-btn.active { background: var(--accent); color: #fff; }
.filter-btn:not(.active) { background: var(--bg-muted); color: var(--text-secondary); }
.filter-btn:not(.active):hover { background: var(--border); }
.archive-list { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.archive-item { display: grid; grid-template-columns: 80px 1fr auto; gap: 16px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--border); transition: all 0.15s; position: relative; }
.archive-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 0.2s; }
.archive-item:hover { padding-left: 12px; background: var(--bg-muted); }
.archive-item:hover::before { width: 3px; }
.archive-item .date { font-family: var(--mono); font-size: 11px; color: var(--text-tertiary); }
.archive-item h3 { font-family: var(--display); font-size: 20px; font-weight: 400; line-height: 1.2; color: var(--text); margin-bottom: 4px; }
.archive-item .excerpt { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.archive-item .tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent); white-space: nowrap; }

/* ─── NEWS ARCHIVE ─── */
.news-archive-header { padding: 48px 24px 20px; max-width: var(--max-w); margin: 0 auto; border-bottom: 2px solid var(--accent); }
.news-archive-header h1 { font-family: var(--display); font-size: 32px; font-weight: 400; color: var(--text); display: flex; align-items: center; gap: 10px; }
.news-archive-header .desc { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.news-day { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.news-day-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-tertiary); padding: 16px 0 8px; border-bottom: 1px solid var(--border); }
.news-day-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--bg-muted); }
.news-day-item:hover { background: var(--bg-muted); }
.news-day-item .title { font-size: 14px; color: var(--text); line-height: 1.4; }
.news-day-item .source { font-family: var(--mono); font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }

/* ─── FOOTER ─── */
footer { border-top: 1px solid var(--border); padding: 16px 24px; }
.footer-inner { max-width: var(--max-w); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; }
.footer-inner, .footer-inner a { font-family: var(--mono); font-size: 11px; color: var(--text-tertiary); }
.footer-inner a:hover { color: var(--text); }

/* ─── LIGHTBOX ─── */
.prose img { cursor: zoom-in; }
.lightbox { display: none; position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lightbox.active { display: flex; animation: fadeIn 0.2s ease; }
.lightbox img { max-width: 95vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.4); object-fit: contain; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── ANIMATIONS ─── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.8s cubic-bezier(0.25,1,0.5,1), transform 0.8s cubic-bezier(0.25,1,0.5,1); }
.reveal.vis { opacity: 1; transform: none; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .news-grid { grid-template-columns: 1fr; }
  .lead-article { border-right: none; border-bottom: 1px solid var(--border); }
  .project-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .more-posts { grid-template-columns: 1fr; }
  .more-item { border-right: none; border-bottom: 1px solid var(--border); }
  .more-item:last-child { border-bottom: none; }
  .archive-item { grid-template-columns: 1fr; gap: 4px; }
  .archive-item .date { order: -1; }
  .author-block { flex-direction: column; text-align: center; }
}
@media (max-width: 480px) {
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 11px; }
  .masthead h1 { font-size: 28px; }
}
