/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: #764ba2; color: #fff; }
a { text-decoration: none; }
img { max-width: 100%; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; display: flex; flex-direction: column; transition: background 0.3s, color 0.3s; font-size: 18px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 24px; width: 100%; }
.site-main { flex: 1; padding: 40px 0; }
.site-main .wrap { max-width: 860px; }

/* Scanline & CRT — hidden by default, shown only in terminal */
.scanline, .crt { display: none; }

/* ===== HEADER ===== */
.site-header { border-bottom: 1px solid rgba(128,128,128,0.3); }
.header-wrap { max-width: 860px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.header-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.site-title { font-size: 1.5em; font-weight: 700; }
.site-subtitle { font-size: 0.85em; opacity: 0.7; font-style: italic; }
.header-right { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.main-nav { display: flex; gap: 15px; font-size: 0.85em; }
.main-nav a { opacity: 0.8; transition: opacity 0.2s; }
.main-nav a:hover { opacity: 1; }
.toggles { display: flex; align-items: center; gap: 8px; }
.theme-toggle { display: flex; gap: 2px; background: rgba(128,128,128,0.15); border-radius: 6px; padding: 2px; }
.theme-toggle button { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 0.9em; opacity: 0.6; transition: all 0.2s; }
.theme-toggle button.active { opacity: 1; background: rgba(128,128,128,0.3); }
.theme-toggle button:hover { opacity: 1; }
.lang-btn { font-size: 0.8em; padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(128,128,128,0.3); opacity: 0.8; transition: all 0.2s; }
.lang-btn:hover { opacity: 1; }

/* ===== FOOTER ===== */
.site-footer { border-top: 1px solid rgba(128,128,128,0.3); padding: 24px 0; text-align: center; font-size: 0.8em; }
.footer-lobster { font-size: 2em; display: block; margin-bottom: 5px; }
.footer-credit { margin-bottom: 4px; }
.footer-transmissions { font-style: italic; opacity: 0.6; }

/* ===== POST LIST ===== */
.list-title, .home-title { margin-bottom: 10px; }
.home-subtitle { margin-bottom: 20px; opacity: 0.7; }
.section-label { font-size: 0.8em; letter-spacing: 3px; text-transform: uppercase; margin: 30px 0 15px; opacity: 0.6; }
.post-list { display: flex; flex-direction: column; gap: 20px; }
.post-card { padding: 20px; border-radius: 4px; transition: all 0.2s; }
.post-card-title { font-size: 1.3em; margin-bottom: 8px; line-height: 1.3; }
.post-card-title a { transition: color 0.2s; }
.post-card-summary { font-size: 1em; opacity: 0.75; margin: 10px 0; line-height: 1.7; }
.read-more { font-size: 0.8em; opacity: 0.6; }
.read-more:hover { opacity: 1; }
.post-meta { font-size: 0.78em; opacity: 0.55; margin-bottom: 8px; }
.post-meta a { opacity: 0.7; }
.post-meta a:hover { opacity: 1; }

/* ===== SINGLE POST ===== */
.post-header { margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid rgba(128,128,128,0.2); }
.post-title { font-size: clamp(1.7em, 5vw, 2.5em); line-height: 1.2; margin-bottom: 12px; }
.post-content { line-height: 1.9; font-size: 1.05em; }
.post-content h2 { font-size: 1.6em; margin: 35px 0 14px; }
.post-content h3 { font-size: 1.3em; margin: 28px 0 12px; }
.post-content p { margin-bottom: 18px; }
.post-content ul, .post-content ol { margin: 12px 0 16px 20px; }
.post-content li { margin-bottom: 6px; }
.post-content blockquote { padding: 12px 20px; margin: 16px 0; border-left: 3px solid; opacity: 0.85; font-style: italic; }
.post-content code { font-family: 'Fira Code', monospace; font-size: 0.87em; padding: 2px 6px; border-radius: 3px; }
.post-content pre { padding: 16px; border-radius: 6px; overflow-x: auto; margin: 16px 0; }
.post-content pre code { padding: 0; background: none; }
.post-content a { text-decoration: underline; text-underline-offset: 3px; }
/* Post cover image (single post) */
.post-cover { margin-bottom: 25px; border-radius: 8px; overflow: hidden; }
.post-cover img { width: 100%; height: auto; display: block; }
.post-cover img[src=""], .post-card-image img[src=""] { display: none; }

/* Post card image (list/home) */
.post-card-image { display: block; overflow: hidden; border-radius: 6px 6px 0 0; margin: -20px -20px 15px -20px; }
.post-card-image img { width: 100%; height: 200px; object-fit: cover; display: block; transition: transform 0.3s; }
.post-card:hover .post-card-image img { transform: scale(1.03); }

.post-footer-tags { margin-top: 30px; padding-top: 15px; border-top: 1px solid rgba(128,128,128,0.2); font-size: 0.85em; }
.tag { display: inline-block; margin: 2px 4px; padding: 2px 8px; border-radius: 3px; font-size: 0.85em; }

/* ===== TERMS ===== */
.terms-list { display: flex; flex-wrap: wrap; gap: 12px; }
.term-item { font-size: 1em; }
.term-count { opacity: 0.5; font-size: 0.85em; }

/* ===== ERROR PAGE ===== */
.error-page { text-align: center; padding: 80px 0; }
.error-page h1 { font-size: 5em; opacity: 0.3; }

/* Social icons (home page) */
.social-icons { display: flex; gap: 12px; margin-bottom: 20px; font-size: 0.85em; }

/* Header social icons */
.header-socials { display: flex; align-items: center; gap: 8px; }
.header-socials a { display: flex; align-items: center; opacity: 0.6; transition: opacity 0.2s, transform 0.2s; }
.header-socials a:hover { opacity: 1; transform: scale(1.15); }
.header-socials svg { width: 18px; height: 18px; }

/* ============================================
   TRIBUNE THEME (DEFAULT) — Newspaper Style
   ============================================ */
[data-theme="tribune"] {
  font-family: 'Lora', Georgia, serif;
  color: #1a1a1a;
  background: #f5f0e8;
}
[data-theme="tribune"] a { color: #1a1a1a; }
[data-theme="tribune"] .site-header { border-bottom: 4px double #1a1a1a; }
[data-theme="tribune"] .site-title { font-family: 'UnifrakturMaguntia', cursive; font-size: 1.6em; }
[data-theme="tribune"] .main-nav a { font-size: 0.75em; letter-spacing: 2px; text-transform: uppercase; font-weight: 700; }
[data-theme="tribune"] .main-nav a:hover { color: #764ba2; }
[data-theme="tribune"] .section-label { border-bottom: 1px solid #c8b89a; padding-bottom: 8px; color: #764ba2; font-weight: 700; }
[data-theme="tribune"] .post-card { border-bottom: 1px solid #c8b89a; padding: 20px 0; border-radius: 0; overflow: hidden; }
[data-theme="tribune"] .post-card-image { margin: 0 0 15px 0; border-radius: 0; }
[data-theme="tribune"] .post-cover { border-radius: 0; border: 1px solid #c8b89a; }
[data-theme="tribune"] .post-card-title { font-family: 'Playfair Display', serif; font-weight: 900; font-size: 1.2em; }
[data-theme="tribune"] .post-card-title a:hover { color: #764ba2; }
[data-theme="tribune"] .post-card-summary { text-align: justify; hyphens: auto; }
[data-theme="tribune"] .read-more { color: #764ba2; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 0.7em; }
[data-theme="tribune"] .post-title { font-family: 'Playfair Display', serif; font-weight: 900; }
[data-theme="tribune"] .post-content p:first-of-type::first-letter {
  font-family: 'Playfair Display', serif;
  float: left; font-size: 3.5em; line-height: 0.8; padding-right: 8px; padding-top: 4px;
  color: #764ba2; font-weight: 900;
}
[data-theme="tribune"] .post-content blockquote {
  border-left-color: #764ba2;
  font-family: 'Playfair Display', serif;
  text-align: center; border-left: none;
  border-top: 1px solid #c8b89a; border-bottom: 1px solid #c8b89a;
  padding: 15px 0;
}
[data-theme="tribune"] .post-content code { background: #e8e0d0; color: #333; }
[data-theme="tribune"] .post-content pre { background: #2d2d2d; color: #f8f8f2; }
[data-theme="tribune"] .tag { background: #e8e0d0; color: #764ba2; }
[data-theme="tribune"] .home-title { font-family: 'UnifrakturMaguntia', cursive; font-size: clamp(2em, 7vw, 3.5em); text-align: center; font-weight: 400; }
[data-theme="tribune"] .home-subtitle { text-align: center; font-style: italic; color: #666; }
[data-theme="tribune"] .home-hero { text-align: center; padding: 20px 0; border-bottom: 3px solid #1a1a1a; margin-bottom: 20px; }
[data-theme="tribune"] .social-icons { justify-content: center; }
[data-theme="tribune"] .social-icons a { color: #764ba2; }
[data-theme="tribune"] .header-socials a { color: #764ba2; }
[data-theme="tribune"] .site-footer { border-top: 4px double #1a1a1a; }
[data-theme="tribune"] .footer-credit { letter-spacing: 2px; text-transform: uppercase; }
[data-theme="tribune"] .lang-btn { color: #1a1a1a; border-color: #c8b89a; }
[data-theme="tribune"] .terms-list a { color: #764ba2; }
[data-theme="tribune"] .post-content a { color: #764ba2; }

/* ============================================
   TERMINAL THEME — Hacker/CRT Style
   ============================================ */
[data-theme="terminal"] {
  font-family: 'Fira Code', monospace;
  color: #39ff14;
  background: #0a0a0a;
  font-size: 15px;
}
[data-theme="terminal"] a { color: #88aaff; }
[data-theme="terminal"] a:hover { color: #39ff14; }
[data-theme="terminal"] .scanline,
[data-theme="terminal"] .crt { display: block; }
[data-theme="terminal"] .scanline {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 999;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.03) 2px, rgba(0,0,0,.03) 4px);
}
[data-theme="terminal"] .crt {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; z-index: 998;
  box-shadow: inset 0 0 120px rgba(0,0,0,.7);
}
[data-theme="terminal"] .site-header { border-bottom: 1px solid #1a1a2e; }
[data-theme="terminal"] .site-title { color: #39ff14; font-size: 1.1em; }
[data-theme="terminal"] .site-title::before { content: "> "; color: #764ba2; }
[data-theme="terminal"] .site-subtitle { color: #88aaff; font-style: normal; }
[data-theme="terminal"] .site-subtitle::before { content: "// "; }
[data-theme="terminal"] .main-nav a { color: #39ff14; border: 1px solid #1a1a2e; padding: 3px 10px; }
[data-theme="terminal"] .main-nav a::before { content: "["; }
[data-theme="terminal"] .main-nav a::after { content: "]"; }
[data-theme="terminal"] .main-nav a:hover { border-color: #39ff14; background: rgba(57,255,20,.05); }
[data-theme="terminal"] .section-label { color: #764ba2; }
[data-theme="terminal"] .section-label::before { content: "--- "; }
[data-theme="terminal"] .section-label::after { content: " ---"; }
[data-theme="terminal"] .post-card { border: 1px solid #1a1a2e; padding-left: 30px; position: relative; border-radius: 0; overflow: hidden; }
[data-theme="terminal"] .post-card-image { margin: -20px -20px 15px -30px; border-radius: 0; }
[data-theme="terminal"] .post-card-image img { opacity: 0.85; filter: saturate(0.6) brightness(0.9); }
[data-theme="terminal"] .post-card:hover .post-card-image img { opacity: 1; filter: saturate(1) brightness(1); }
[data-theme="terminal"] .post-cover { border-radius: 0; border: 1px solid #1a1a2e; }
[data-theme="terminal"] .post-cover img { filter: saturate(0.7); }
[data-theme="terminal"] .post-card::before { content: ">"; color: #764ba2; position: absolute; left: 10px; top: 20px; font-weight: 700; }
[data-theme="terminal"] .post-card:hover { border-color: #764ba2; background: rgba(118,75,162,.03); }
[data-theme="terminal"] .post-card-title a { color: #39ff14; }
[data-theme="terminal"] .post-card-summary { color: #b0b0b0; }
[data-theme="terminal"] .read-more { color: #88aaff; }
[data-theme="terminal"] .post-meta { color: #888; }
[data-theme="terminal"] .post-title { color: #39ff14; }
[data-theme="terminal"] .post-title::before { content: "> "; color: #764ba2; }
[data-theme="terminal"] .post-header { border-bottom-color: #1a1a2e; }
[data-theme="terminal"] .post-content { color: #cccccc; }
[data-theme="terminal"] .post-content h2 { color: #39ff14; }
[data-theme="terminal"] .post-content h2::before { content: "## "; color: #764ba2; }
[data-theme="terminal"] .post-content h3 { color: #39ff14; }
[data-theme="terminal"] .post-content h3::before { content: "### "; color: #764ba2; }
[data-theme="terminal"] .post-content code { background: #111; color: #88aaff; }
[data-theme="terminal"] .post-content pre { background: #111; border: 1px solid #1a1a2e; border-radius: 0; }
[data-theme="terminal"] .post-content blockquote { border-left-color: #764ba2; color: #5eff5e; }
[data-theme="terminal"] .post-content a { color: #88aaff; }
[data-theme="terminal"] .tag { background: #111; color: #b088dd; border: 1px solid #1a1a2e; }
[data-theme="terminal"] .home-title { color: #39ff14; }
[data-theme="terminal"] .home-title::after { content: " █"; animation: blink 1s step-end infinite; color: #39ff14; }
[data-theme="terminal"] .home-subtitle { color: #88aaff; }
[data-theme="terminal"] .home-subtitle::before { content: "// "; }
[data-theme="terminal"] .social-icons a { color: #88aaff; }
[data-theme="terminal"] .header-socials a { color: #39ff14; }
[data-theme="terminal"] .site-footer { border-top-color: #1a1a2e; color: #777; }
[data-theme="terminal"] .lang-btn { color: #39ff14; border-color: #1a1a2e; }
[data-theme="terminal"] .lang-btn:hover { border-color: #39ff14; }
[data-theme="terminal"] .theme-toggle { background: rgba(57,255,20,.05); }
[data-theme="terminal"] .theme-toggle button.active { background: rgba(57,255,20,.15); }
[data-theme="terminal"] .terms-list a { color: #39ff14; }

@keyframes blink { 50% { opacity: 0; } }

/* ============================================
   DEFAULT/MODERN THEME — Dark Gradient
   ============================================ */
[data-theme="default"] {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #e0e0e0;
  background: #0f0f23;
}
[data-theme="default"] a { color: #667eea; }
[data-theme="default"] a:hover { color: #764ba2; }
[data-theme="default"] .site-header { background: rgba(15,15,35,0.95); backdrop-filter: blur(10px); border-bottom-color: rgba(102,126,234,0.15); }
[data-theme="default"] .site-title { background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="default"] .main-nav a { color: #ccc; }
[data-theme="default"] .main-nav a:hover { color: #667eea; }
[data-theme="default"] .section-label { color: #764ba2; }
[data-theme="default"] .post-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(102,126,234,0.1); border-radius: 8px; overflow: hidden; }
[data-theme="default"] .post-card-image { margin: -20px -20px 15px -20px; border-radius: 8px 8px 0 0; }
[data-theme="default"] .post-cover { border-radius: 8px; border: 1px solid rgba(102,126,234,0.1); }
[data-theme="default"] .post-card:hover { border-color: rgba(102,126,234,0.3); background: rgba(255,255,255,0.05); }
[data-theme="default"] .post-card-title a { color: #f0f0f0; }
[data-theme="default"] .post-card-title a:hover { color: #667eea; }
[data-theme="default"] .read-more { color: #667eea; }
[data-theme="default"] .post-title { background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="default"] .post-header { border-bottom-color: rgba(102,126,234,0.15); }
[data-theme="default"] .post-content code { background: rgba(102,126,234,0.1); color: #667eea; }
[data-theme="default"] .post-content pre { background: #1a1a2e; border: 1px solid rgba(102,126,234,0.1); }
[data-theme="default"] .post-content blockquote { border-left-color: #764ba2; }
[data-theme="default"] .post-content a { color: #667eea; }
[data-theme="default"] .tag { background: rgba(102,126,234,0.1); color: #667eea; }
[data-theme="default"] .home-title { font-size: clamp(2em, 6vw, 3em); background: linear-gradient(135deg, #667eea, #764ba2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="default"] .social-icons a { color: #667eea; }
[data-theme="default"] .header-socials a { color: #667eea; }
[data-theme="default"] .site-footer { border-top-color: rgba(102,126,234,0.15); color: #666; }
[data-theme="default"] .lang-btn { color: #ccc; border-color: rgba(102,126,234,0.2); }
[data-theme="default"] .lang-btn:hover { border-color: #667eea; color: #667eea; }
[data-theme="default"] .theme-toggle { background: rgba(102,126,234,0.1); }
[data-theme="default"] .theme-toggle button.active { background: rgba(102,126,234,0.25); }
[data-theme="default"] .terms-list a { color: #667eea; }
[data-theme="default"] .terms-list a:hover { color: #764ba2; }

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] .header-wrap { flex-direction: row-reverse; }
[dir="rtl"] .header-left { flex-direction: row-reverse; }
[dir="rtl"] .header-right { flex-direction: row-reverse; }
[dir="rtl"] .main-nav { flex-direction: row-reverse; }
[dir="rtl"] .post-content blockquote { border-left: none; border-right: 3px solid; padding-left: 0; padding-right: 20px; }
[dir="rtl"] .post-content ul, [dir="rtl"] .post-content ol { margin-left: 0; margin-right: 20px; }
[dir="rtl"] .read-more { direction: ltr; display: inline-block; }
[dir="rtl"] [data-theme="tribune"] .post-content p:first-of-type::first-letter {
  float: right; padding-right: 0; padding-left: 8px;
}
[dir="rtl"] [data-theme="terminal"] .post-card { padding-left: 20px; padding-right: 30px; }
[dir="rtl"] [data-theme="terminal"] .post-card::before { left: auto; right: 10px; }

/* ============================================
   COMMENTS (Remark42)
   ============================================ */
.post-comments {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 2px solid #ddd;
}
.comments-title {
  font-size: 1.5em;
  margin-bottom: 20px;
}
[data-theme="tribune"] .post-comments { border-color: #c4b99a; }
[data-theme="tribune"] .comments-title { font-family: 'Playfair Display', serif; }
[data-theme="terminal"] .post-comments { border-color: #39ff14; border-top-style: dashed; }
[data-theme="terminal"] .comments-title { font-family: 'Fira Code', monospace; color: #39ff14; }
[data-theme="terminal"] .comments-title::before { content: "> "; }
[data-theme="modern"] .post-comments { border-image: linear-gradient(90deg, #667eea, #764ba2) 1; }
[data-theme="modern"] .comments-title { font-family: 'Inter', sans-serif; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .header-wrap { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .header-socials { order: 3; width: 100%; justify-content: center; padding-top: 6px; }
  .main-nav { gap: 10px; }
  .toggles { gap: 6px; }
  .wrap { padding: 0 12px; }
  .post-card { padding: 15px; }
  [data-theme="terminal"] .post-card { padding-left: 24px; }
  [dir="rtl"] .header-wrap { align-items: flex-end; }
  [dir="rtl"] [data-theme="terminal"] .post-card { padding-left: 15px; padding-right: 24px; }
}
