/* ──────────────────────────────────────────────────────────────
   Blog styles — RTL

   The blog pages are rendered by /api/blog.js, so unlike the hand-written
   pages they have no inline <style>. This file therefore carries the base
   (body, nav bar, footer, container) as well as the blog-specific parts,
   and stays in sync with the palette used across the site.

   The `.post-content` block also defines every class the dashboard editor is
   allowed to emit (fs-*, ta-*, blog-*), which is the same allowlist the
   server-side sanitizer enforces in api/_blog.js.
   ────────────────────────────────────────────────────────────── */

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

:root {
  --black: #0d1b2e;
  --panel: #142842;
  --white: #f5f0eb;
  --accent: #e8c97e;
  --accent2: #c97eb4;
  --line: rgba(245, 240, 235, 0.1);
  --muted: rgba(245, 240, 235, 0.55);
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--black);
  color: var(--white);
  font-family: 'Heebo', sans-serif;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Honeypot: hidden in place rather than parked off-canvas, which in RTL would
   add phantom scroll width to the page. */
.hp {
  position: absolute; width: 1px; height: 1px; padding: 0; border: 0;
  opacity: 0; pointer-events: none; overflow: hidden; clip: rect(0 0 0 0);
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 48px; }

/* ── NAV (matches the hand-written pages, then site-nav.js takes over) ──
   Scoped to #navbar rather than the bare `nav` the other pages use: the blog
   is the only part of the site with in-page navigation of its own, and a bare
   selector would pin those to the top of the screen too. */
nav#navbar {
  position: fixed; top: 0; right: 0; left: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 48px;
  z-index: 100;
  transition: background 0.4s, padding 0.4s;
}
nav#navbar.scrolled { background: rgba(13, 27, 46, 0.95); backdrop-filter: blur(12px); padding: 16px 48px; }
.nav-logo { font-size: 1.1rem; letter-spacing: 0.05em; color: var(--accent); text-decoration: none; line-height: 1.3; }
.nav-logo .sub-name { display: block; font-size: 0.65em; color: rgba(232, 201, 126, 0.6); }
.nav-back { font-size: 0.8rem; letter-spacing: 0.1em; color: rgba(245, 240, 235, 0.5); text-decoration: none; transition: color 0.3s; }
.nav-back:hover { color: var(--accent); }

/* ── HERO ── */
.blog-hero {
  padding: 170px 0 60px;
  text-align: center;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(232, 201, 126, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 50%, rgba(201, 126, 180, 0.05) 0%, transparent 60%);
}
.hero-label { font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--accent); margin-bottom: 22px; }
.hero-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 300; line-height: 1.25; margin-bottom: 22px; }
.hero-divider { width: 60px; height: 1px; background: var(--accent); margin: 0 auto 28px; opacity: 0.4; }
.hero-desc { max-width: 640px; margin: 0 auto; font-size: 1.02rem; font-weight: 300; line-height: 1.9; color: rgba(245, 240, 235, 0.7); }

.btn-outline {
  display: inline-block; margin-top: 28px; padding: 12px 28px;
  border: 1px solid var(--accent); border-radius: 40px;
  color: var(--accent); text-decoration: none; font-size: 0.9rem;
  transition: background 0.25s, color 0.25s;
}
.btn-outline:hover { background: var(--accent); color: var(--black); }

/* ── SEARCH ── */
.blog-main { padding-bottom: 90px; }
.blog-search { display: flex; gap: 10px; align-items: center; justify-content: center; margin-bottom: 26px; flex-wrap: wrap; }
.blog-search input {
  flex: 0 1 340px; padding: 11px 16px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); border-radius: 40px;
  color: var(--white); font-family: inherit; font-size: 0.92rem;
}
.blog-search input::placeholder { color: rgba(245, 240, 235, 0.35); }
.blog-search input:focus { outline: none; border-color: var(--accent); }
.blog-search button {
  padding: 11px 22px; border: 1px solid var(--accent); border-radius: 40px;
  background: transparent; color: var(--accent); font-family: inherit; font-size: 0.88rem; cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.blog-search button:hover { background: var(--accent); color: var(--black); }
.blog-search-clear { color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.blog-search-clear:hover { color: var(--accent); }

/* ── CATEGORY CHIPS ── */
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 44px; }
.chip {
  padding: 8px 20px; border: 1px solid var(--line); border-radius: 40px;
  color: rgba(245, 240, 235, 0.65); text-decoration: none; font-size: 0.86rem;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--black); font-weight: 500; }

/* ── CARDS ── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.cards-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: transform 0.3s, border-color 0.3s;
}
.card:hover { transform: translateY(-4px); border-color: rgba(232, 201, 126, 0.4); }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-media { aspect-ratio: 16 / 9; background: rgba(0, 0, 0, 0.2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media-empty {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(232, 201, 126, 0.14) 0%, transparent 65%),
    radial-gradient(ellipse at 70% 60%, rgba(201, 126, 180, 0.12) 0%, transparent 65%);
}
.card-body { padding: 22px 22px 26px; }
.card-cat { display: inline-block; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.card-title { font-size: 1.15rem; font-weight: 500; line-height: 1.5; margin-bottom: 10px; }
.card:hover .card-title { color: var(--accent); }
.card-excerpt { font-size: 0.92rem; font-weight: 300; line-height: 1.75; color: rgba(245, 240, 235, 0.6); margin-bottom: 16px; }
.card-meta { font-size: 0.78rem; color: rgba(245, 240, 235, 0.35); display: flex; gap: 8px; flex-wrap: wrap; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 0; font-weight: 300; }

/* ── PAGER ── */
.pager { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 54px; }
.pager-btn {
  padding: 10px 22px; border: 1px solid var(--line); border-radius: 40px;
  color: rgba(245, 240, 235, 0.7); text-decoration: none; font-size: 0.86rem; transition: border-color 0.25s, color 0.25s;
}
.pager-btn:hover { border-color: var(--accent); color: var(--accent); }
.pager-pos { font-size: 0.82rem; color: var(--muted); }

/* ── POST ── */
.preview-banner {
  margin-top: 84px; padding: 12px 20px; text-align: center;
  background: rgba(232, 201, 126, 0.12); border-bottom: 1px solid rgba(232, 201, 126, 0.3);
  color: var(--accent); font-size: 0.88rem;
}
.post-main { padding: 130px 0 90px; max-width: 860px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--muted); margin-bottom: 26px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.post-head { margin-bottom: 34px; }
.post-cat {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); text-decoration: none; margin-bottom: 16px;
}
.post-cat:hover { text-decoration: underline; }
.post-title { font-size: clamp(1.8rem, 4.2vw, 2.7rem); font-weight: 700; line-height: 1.3; margin-bottom: 16px; }
.post-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; color: rgba(245, 240, 235, 0.4); margin-bottom: 20px; }
.post-lead { font-size: 1.1rem; font-weight: 300; line-height: 1.9; color: rgba(245, 240, 235, 0.75); }

.post-cover { margin: 0 0 40px; border-radius: 16px; overflow: hidden; }
.post-cover img { width: 100%; height: auto; display: block; }

/* ── POST CONTENT (the editor's output) ── */
.post-content { font-size: 1.05rem; font-weight: 300; line-height: 2; color: rgba(245, 240, 235, 0.85); }
.post-content > *:first-child { margin-top: 0; }
.post-content p { margin: 0 0 1.3em; }
.post-content h2 { font-size: 1.7rem; font-weight: 700; line-height: 1.4; margin: 2em 0 0.7em; color: var(--white); }
.post-content h3 { font-size: 1.35rem; font-weight: 500; line-height: 1.45; margin: 1.7em 0 0.6em; color: var(--white); }
.post-content h4 { font-size: 1.12rem; font-weight: 500; line-height: 1.5; margin: 1.5em 0 0.5em; color: var(--accent); }
.post-content strong, .post-content b { font-weight: 700; color: var(--white); }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.post-content a:hover { color: var(--accent2); }
.post-content ul, .post-content ol { margin: 0 0 1.3em; padding-inline-start: 1.5em; }
.post-content li { margin-bottom: 0.5em; }
.post-content ul li::marker { color: var(--accent); }
.post-content ol li::marker { color: var(--accent); }
.post-content blockquote {
  margin: 1.8em 0; padding: 6px 22px;
  border-inline-start: 2px solid var(--accent);
  color: rgba(245, 240, 235, 0.72); font-style: italic;
}
.post-content hr { border: none; height: 1px; background: var(--line); margin: 2.4em 0; }
.post-content mark { background: rgba(232, 201, 126, 0.25); color: var(--white); padding: 0 4px; border-radius: 3px; }

/* Font sizes offered by the editor's size menu. */
.post-content .fs-sm { font-size: 0.86em; }
.post-content .fs-md { font-size: 1em; }
.post-content .fs-lg { font-size: 1.22em; }
.post-content .fs-xl { font-size: 1.5em; line-height: 1.6; }
.post-content .lead { font-size: 1.15em; color: rgba(245, 240, 235, 0.9); }

/* Alignment offered by the editor's alignment buttons. */
.post-content .ta-right { text-align: right; }
.post-content .ta-left { text-align: left; }
.post-content .ta-center { text-align: center; }
.post-content .ta-justify { text-align: justify; }

/* Media inserted by the editor. */
.post-content figure { margin: 2em 0; }
.post-content figure img,
.post-content figure video { width: 100%; height: auto; display: block; border-radius: 14px; }
.post-content img { max-width: 100%; height: auto; border-radius: 14px; }
.post-content video { max-width: 100%; border-radius: 14px; background: #000; }
.post-content figcaption { margin-top: 10px; font-size: 0.84rem; color: var(--muted); text-align: center; }
.post-content .blog-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.post-content .blog-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ── SHARE ── */
.share { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--line); }
.share-label { font-size: 0.82rem; color: var(--muted); }
.share-btn {
  padding: 8px 18px; border: 1px solid var(--line); border-radius: 40px; background: transparent;
  color: rgba(245, 240, 235, 0.7); text-decoration: none; font-size: 0.84rem; font-family: inherit; cursor: pointer;
  transition: border-color 0.25s, color 0.25s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── NEWSLETTER ── */
.newsletter {
  margin: 60px 0 0; padding: 40px 34px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.newsletter h2 { font-size: 1.35rem; font-weight: 500; margin-bottom: 10px; }
.newsletter p { font-size: 0.92rem; font-weight: 300; color: var(--muted); margin-bottom: 22px; }
.newsletter form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.newsletter input[type=email] {
  flex: 0 1 300px; padding: 12px 18px; background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line); border-radius: 40px; color: var(--white); font-family: inherit; font-size: 0.95rem;
}
.newsletter input[type=email]:focus { outline: none; border-color: var(--accent); }
.newsletter button {
  padding: 12px 30px; background: var(--accent); color: var(--black); border: none; border-radius: 40px;
  font-family: inherit; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: opacity 0.25s;
}
.newsletter button:hover { opacity: 0.9; }
.newsletter button:disabled { opacity: 0.5; cursor: default; }
.newsletter-msg { margin: 14px 0 0; font-size: 0.86rem; min-height: 1.2em; }
.newsletter-msg.ok { color: #8fd19e; }
.newsletter-msg.error { color: #e58a8a; }

/* ── RELATED ── */
.related { margin-top: 74px; }
.related h2 { font-size: 1.3rem; font-weight: 500; margin-bottom: 26px; text-align: center; }

/* ── FOOTER ── */
footer { border-top: 1px solid rgba(245, 240, 235, 0.08); padding: 40px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer-logo { font-size: 0.95rem; letter-spacing: 0.05em; color: var(--accent); }
.footer-copy { font-size: 0.75rem; color: rgba(245, 240, 235, 0.25); }
.footer-back { font-size: 0.78rem; color: rgba(245, 240, 235, 0.35); text-decoration: none; transition: color 0.3s; }
.footer-back:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 1000px) {
  .cards, .cards-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  nav#navbar { padding: 20px 24px; }
  nav#navbar.scrolled { padding: 14px 24px; }
  .container { padding: 0 24px; }
  .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
  .post-main { padding-top: 110px; }
}
@media (max-width: 680px) {
  .cards, .cards-3 { grid-template-columns: 1fr; }
  .blog-hero { padding-top: 140px; }
  .post-content { font-size: 1rem; line-height: 1.95; }
  .newsletter { padding: 32px 22px; }
}
