/* ============================================================
   TeachBack Blog -- shared styles
   Aligned with the landing design system: Assistant is the ONLY
   font, warm ivory palette, terracotta accent, subtle film grain.
   The header is identical to the home page; article content is a
   centred reading column. North star: "חבר חכם שמקרין שקט".
   No build step: plain CSS, cached across all blog pages.
   ============================================================ */

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

:root {
  --bg: #FFF8F2;
  --bg-elevated: #FFFBF6;
  --dark: #1F1B04;
  --text: #363007;
  --text-muted: rgba(54, 48, 7, 0.66);
  --border: rgba(54, 48, 7, 0.10);
  --peach: #E0BEAE;
  --amber: #C09454;
  --terracotta: #D26B49;
  --terracotta-hover: #BF5C3D;
  --deep-orange: #D46A2B;
  --accent: #D4874D;
  --radius: 14px;
  --shadow-warm: 0 1px 3px rgba(80, 71, 43, 0.06), 0 4px 20px rgba(80, 71, 43, 0.07);
  --shadow-warm-lg: 0 2px 4px rgba(80, 71, 43, 0.04), 0 10px 40px rgba(80, 71, 43, 0.11);
  /* comfortable Hebrew reading measure */
  --measure: 46rem;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Assistant', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 18px;
  line-height: 1.8;
}

/* ─── FILM GRAIN OVERLAY (same as landing, subtle) ─── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  background-size: 512px;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  mix-blend-mode: multiply;
}

tb-header, .blog-main, tb-footer { position: relative; z-index: 1; }

::selection { background: rgba(212, 135, 77, 0.22); color: var(--dark); }

a { color: var(--terracotta); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--terracotta-hover); }

/* NAV + FOOTER live in /site-chrome.js (<tb-header> / <tb-footer>) so the
   header and footer are single-sourced and identical across home + blog. */
a:focus-visible, button:focus-visible { outline: 2px solid var(--terracotta-hover); outline-offset: 2px; border-radius: 4px; }

/* ─── SHARED LAYOUT ─── centred reading column ─── */
.blog-main { max-width: 72rem; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }
.wrap-narrow { max-width: var(--measure); margin-inline: auto; }

/* ─── BLOG HUB (index) ─── */
.hub-hero { text-align: center; padding: 84px 0 44px; }
.hub-hero .eyebrow {
  font-size: 0.9rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--terracotta); margin-bottom: 14px; text-transform: uppercase;
}
.hub-hero h1 {
  font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.2rem); color: var(--dark);
  line-height: 1.14; letter-spacing: -0.5px; margin-bottom: 18px;
}
.hub-hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 34rem; margin-inline: auto; line-height: 1.65; }

.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;
}

.blog-search { max-width: 34rem; margin: 4px auto 0; }
.blog-search input {
  width: 100%; box-sizing: border-box; padding: 13px 18px;
  font: inherit; font-size: 1rem; color: var(--dark);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.blog-search input::placeholder { color: var(--text-muted); }
.blog-search input:focus-visible {
  outline: none; border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(212, 107, 73, 0.15);
}
.blog-search-empty { text-align: center; color: var(--text-muted); font-size: 1.05rem; padding: 28px 0 4px; }

.post-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px; padding: 24px 0 80px;
}
.post-grid .post-card[hidden] { display: none; }
.post-card {
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 26px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-warm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-warm-lg); border-color: rgba(210,107,73,0.25); }
.post-card-img {
  display: block; width: 100%; height: auto;
  border-radius: 12px; margin-bottom: 18px;
}
.post-card .tag {
  align-self: flex-start;
  font-size: 0.78rem; font-weight: 700; color: var(--amber);
  background: rgba(192, 148, 84, 0.12);
  padding: 4px 12px; border-radius: 999px; margin-bottom: 16px;
}
.post-card h2 {
  font-weight: 700;
  font-size: 1.35rem; color: var(--dark); line-height: 1.3; letter-spacing: -0.2px; margin-bottom: 10px;
}
.post-card p { color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 18px; flex: 1; }
.post-card .read-more { color: var(--terracotta); font-weight: 700; font-size: 0.95rem; }
.post-card.soon { opacity: 0.6; pointer-events: none; }
.post-card.soon .tag { color: var(--text-muted); background: rgba(54, 48, 7, 0.06); }

/* ─── ARTICLE ─── centred reading column ─── */
.article-header { padding: 60px 0 0; }
.article-hero {
  display: block; width: 100%; max-width: var(--measure); height: auto;
  margin: 8px auto 12px;
  border-radius: 14px; box-shadow: var(--shadow-warm);
}
.breadcrumb { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 22px; }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--terracotta); }
.article-header .tag {
  display: inline-block; font-size: 0.82rem; font-weight: 700; color: var(--amber);
  background: rgba(192, 148, 84, 0.12); padding: 5px 14px; border-radius: 999px; margin-bottom: 20px;
}
.article-header h1 {
  font-weight: 800;
  font-size: clamp(2rem, 4.4vw, 3rem); color: var(--dark);
  line-height: 1.16; letter-spacing: -0.6px; margin-bottom: 20px;
  text-wrap: balance;
}
.article-meta { font-size: 0.92rem; color: var(--text-muted); font-weight: 500; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.article-meta .dot { opacity: 0.45; }

/* the "deck" -- a lighter, larger intro that breathes */
.article-lead {
  font-size: clamp(1.18rem, 2.2vw, 1.34rem); line-height: 1.66; color: var(--text);
  font-weight: 400; margin: 26px 0 0;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--border);
}

/* the whole body is one measure-wide centred column, so every block --
   paragraphs, headings, boxes -- shares the exact same right edge */
.article-body { max-width: var(--measure); margin-inline: auto; padding: 34px 0 40px; }
.article-body > * { max-width: 100%; overflow-wrap: break-word; }
.article-body h2 {
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 1.85rem); color: var(--dark); line-height: 1.28; letter-spacing: -0.3px;
  margin: 52px 0 16px;
}
.article-body h3 {
  font-weight: 700;
  font-size: 1.28rem; color: var(--dark); line-height: 1.35; margin: 34px 0 10px;
}
.article-body p { margin: 0 0 22px; }
.article-body ul, .article-body ol { margin: 0 0 24px; padding-inline-start: 1.4em; }
.article-body li { margin-bottom: 10px; }
.article-body li::marker { color: var(--accent); }
.article-body strong { color: var(--dark); font-weight: 700; }
.article-body em { color: var(--dark); }
.article-body a { font-weight: 600; }

.article-body blockquote {
  border-inline-start: 3px solid var(--terracotta);
  background: var(--bg-elevated);
  padding: 20px 26px; border-radius: 0 14px 14px 0;
  margin: 32px auto; color: var(--dark);
  font-size: clamp(1.1rem, 2vw, 1.25rem); line-height: 1.55; font-weight: 500;
}

.callout {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  margin: 34px auto;
  box-shadow: var(--shadow-warm);
}
.callout .callout-label {
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.05em;
  color: var(--terracotta); margin-bottom: 10px; text-transform: uppercase;
}
.callout p:last-child { margin-bottom: 0; }

/* ─── REFERENCES ─── structured + scannable, never a blob of text ─── */
.sources {
  max-width: var(--measure);
  margin: 52px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.sources .sources-title {
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: 20px;
}
.sources .sources-list { list-style: none; counter-reset: src; display: grid; gap: 18px; margin: 0; padding: 0; }
.sources .sources-list li {
  counter-increment: src;
  position: relative;
  padding-inline-start: 38px;
  margin: 0;
}
.sources .sources-list li::before {
  content: counter(src);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: rgba(192, 148, 84, 0.14);
  color: var(--amber);
  border-radius: 999px;
  font-size: 0.76rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sources .src-topic { display: block; font-weight: 700; color: var(--dark); font-size: 0.93rem; line-height: 1.5; }
.sources .src-ref { display: block; color: var(--text-muted); font-size: 0.88rem; line-height: 1.55; text-align: right; }
.sources .src-ref em { font-style: italic; color: var(--text); }

/* soft, honest product mention at article end */
.tb-note {
  background: linear-gradient(135deg, rgba(224,190,174,0.24), rgba(212,135,77,0.10));
  border: 1px solid rgba(210,107,73,0.18);
  border-radius: 20px;
  padding: 32px 32px;
  margin: 48px auto 0;
  max-width: var(--measure);
}
.tb-note h3 { font-weight: 800; font-size: 1.3rem; color: var(--dark); line-height: 1.3; letter-spacing: -0.3px; margin-bottom: 12px; }
.tb-note p { margin-bottom: 20px; color: var(--text); }
.tb-note .tb-cta {
  display: inline-block; background: var(--terracotta); color: #fff; text-decoration: none;
  font-weight: 700; padding: 12px 26px; border-radius: 999px; transition: background 0.2s ease, transform 0.2s ease;
}
.tb-note .tb-cta:hover { background: var(--terracotta-hover); transform: translateY(-1px); color:#fff; }

/* ─── READ NEXT ─── a small carousel of other guides ─── */
.read-next { max-width: var(--measure); margin: 48px auto 0; }
.read-next .read-next-title {
  font-size: 0.8rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: 18px;
}
.read-next .read-next-track {
  display: flex; gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.read-next .read-next-track::-webkit-scrollbar { display: none; }
.read-next .read-next-card {
  scroll-snap-align: start;
  flex: 0 0 min(320px, 82%);
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-warm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.read-next .read-next-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-warm-lg); border-color: rgba(210,107,73,0.25); }
.read-next .read-next-card .tag {
  align-self: flex-start;
  font-size: 0.72rem; font-weight: 700; color: var(--amber);
  background: rgba(192, 148, 84, 0.12);
  padding: 3px 11px; border-radius: 999px; margin-bottom: 12px;
}
.read-next .read-next-card h3 {
  font-weight: 700; font-size: 1.06rem; color: var(--dark);
  line-height: 1.35; letter-spacing: -0.2px; margin: 0 0 12px;
}
.read-next .read-next-card .read-more { margin-top: auto; color: var(--terracotta); font-weight: 700; font-size: 0.9rem; }

.article-footer-nav { max-width: var(--measure); margin: 40px auto 0; padding-top: 28px; border-top: 1px solid var(--border); }
.article-footer-nav a { font-weight: 700; text-decoration: none; }

/* FOOTER lives in /site-chrome.js (<tb-footer>) */

@media (max-width: 620px) {
  body { font-size: 17px; line-height: 1.75; }
  .article-header { padding: 36px 0 0; }
  .article-body { padding: 28px 0 32px; }
  .article-body h2 { margin-top: 40px; }
}
