/*
 * Dynamic Flow content hub (blog) stylesheet.
 *
 * Shared by public/blog/index.html and every article at
 * public/blog/<slug>/index.html. These are plain static pages, NOT the SPA,
 * so they do not load /styles.css (the app bundle). Instead this file mirrors
 * the design tokens used by the guide/legal pages (guide-*.html, privacy.html,
 * terms.html) so the hub reads as the same brand.
 *
 * One shared stylesheet (rather than the guide pages' per-file inline <style>)
 * is a deliberate choice: ~100 articles will link this, and a cached
 * same-origin file is far leaner than duplicating the CSS into every article.
 * Served under CSP style-src 'self', which the portal already allows.
 */

:root {
  --ink: #102a30;
  --ink-soft: #335056;
  --muted: #5f7a7f;
  --line: #dde7e8;
  --surface: #ffffff;
  --surface-soft: #f3f7f7;
  --surface-tint: #e6f2f3;
  --teal: #0a6e75;
  --teal-dark: #063b4a;
  --gold: #c79a3a;
  --ok: #2f8f6b;
  --danger: #c14a45;

  --content-width: 760px;
  --wide-width: 1040px;
  --radius: 14px;
  --shadow-soft: 0 2px 12px rgba(6, 59, 74, 0.10);
  --shadow-raise: 0 10px 28px rgba(6, 59, 74, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: "Heebo", "Arial", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
  line-height: 1.75;
  font-size: 1.02rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Accessibility: skip link + focus ---------------------------------- */

.skip-link {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 100;
  background: var(--teal-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

a { color: var(--teal); }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Header + primary nav ---------------------------------------------- */

.site-header {
  background: var(--teal-dark);
  color: #fff;
}
.site-header__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 16px clamp(16px, 5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}
.brand:hover { text-decoration: none; }
.brand img {
  height: 34px;
  width: auto;
  display: block;
  border-radius: 6px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.site-nav a {
  color: #eaf5f5;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover,
.site-nav a:focus-visible { background: rgba(255, 255, 255, 0.12); text-decoration: none; }
.site-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.18);
}

/* ---- Layout ------------------------------------------------------------ */

main { display: block; }

.hub-hero {
  background: linear-gradient(180deg, var(--teal-dark), #08525c);
  color: #fff;
  padding: 40px clamp(16px, 5vw, 40px) 48px;
}
.hub-hero__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
}
.hub-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.25;
}
.hub-hero p {
  margin: 0;
  max-width: 60ch;
  color: #d9eeee;
  font-size: 1.05rem;
}

.wrap {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 32px clamp(16px, 5vw, 40px) 64px;
}
.wrap--article {
  max-width: var(--content-width);
}

/* ---- Cluster listing (index) ------------------------------------------- */

.cluster {
  margin-top: 40px;
}
.cluster:first-of-type { margin-top: 8px; }
.cluster > h2 {
  font-size: 1.35rem;
  color: var(--teal-dark);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--surface-tint);
}
.cluster > p.cluster__intro {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover,
.post-card:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-raise);
}
@media (prefers-reduced-motion: reduce) {
  .post-card { transition: none; }
  .post-card:hover, .post-card:focus-within { transform: none; }
}
.post-card h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.4;
}
.post-card h3 a {
  color: var(--ink);
  text-decoration: none;
}
.post-card h3 a:hover { color: var(--teal); text-decoration: underline; }
/* Whole-card click target while keeping the heading link the accessible name. */
.post-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.post-card { position: relative; }
.post-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}
.post-card__meta {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.post-card__meta time { color: var(--muted); }

.hub-empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  color: var(--muted);
  text-align: center;
}

/* ---- Hub video embeds --------------------------------------------------- */

.blog-videos {
  content-visibility: auto;
  contain-intrinsic-size: 720px;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.video-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.video-card video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--teal-dark);
}
.video-card h3 {
  margin: 16px 18px 4px;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.35;
}
.video-card p {
  margin: 0 18px 18px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ---- Article ----------------------------------------------------------- */

.article-head {
  margin-bottom: 12px;
}
.breadcrumbs {
  font-size: 0.86rem;
  color: var(--muted);
  margin: 0 0 16px;
}
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before {
  content: "‹"; /* RTL: chevron points along the reading direction */
  color: var(--line);
}
/* LTR pages (the English hub + /blog/en/ articles) flip the only glyph in this
   stylesheet that isn't already a CSS logical property. Everything else uses
   inset-inline / padding-inline / text-align:start, so it mirrors for free. */
[dir="ltr"] .breadcrumbs li + li::before { content: "›"; }
.breadcrumbs a { color: var(--muted); }

.article-head h1 {
  font-size: clamp(1.6rem, 4.2vw, 2.3rem);
  line-height: 1.28;
  margin: 0 0 12px;
  color: var(--ink);
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.article-meta .tag {
  background: var(--surface-tint);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 600;
  font-size: 0.82rem;
}

.article-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 38px);
  box-shadow: var(--shadow-soft);
}

/* Direct-answer-first hook block. */
.answer-box {
  background: var(--surface-tint);
  border: 1px solid var(--teal);
  border-inline-start: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0 0 28px;
}
.answer-box p { margin: 0; font-size: 1.06rem; }
.answer-box p + p { margin-top: 8px; }

.article-body h2 {
  font-size: 1.35rem;
  color: var(--teal-dark);
  margin: 34px 0 10px;
  scroll-margin-top: 16px;
}
.article-body h3 {
  font-size: 1.12rem;
  color: var(--ink);
  margin: 24px 0 8px;
  scroll-margin-top: 16px;
}
.article-body p { margin: 0 0 16px; }
.article-body ul,
.article-body ol { margin: 0 0 16px; padding-inline-start: 22px; }
.article-body li { margin-bottom: 8px; }
.article-body :target {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
  border-radius: 6px;
}
.article-body img,
.article-body video {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.article-body figure { margin: 20px 0; }
.article-body figcaption {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
  text-align: center;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 0.95rem;
}
.article-body th,
.article-body td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: start;
}
.article-body th { background: var(--surface-soft); }
/* Wide content scrolls inside its own box; the page never scrolls sideways. */
.table-scroll { overflow-x: auto; }

.takeaway {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 28px 0;
}
.takeaway h2 { margin-top: 0; }

/* ---- FAQ --------------------------------------------------------------- */

.faq { margin-top: 36px; }
.faq h2 {
  font-size: 1.35rem;
  color: var(--teal-dark);
  margin: 0 0 12px;
}
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--ink);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  margin-inline-start: auto;
  color: var(--teal);
  font-size: 1.3rem;
  line-height: 1;
}
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq details > div {
  padding: 4px 18px 16px;
  color: var(--ink-soft);
}
.faq details > div p { margin: 8px 0 0; }

/* ---- Sources / citations ---------------------------------------------- */

.sources {
  margin-top: 36px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.sources h2 { font-size: 1.15rem; color: var(--teal-dark); margin: 0 0 10px; }
.sources ol { margin: 0; padding-inline-start: 20px; }
.sources li { margin-bottom: 8px; font-size: 0.92rem; color: var(--ink-soft); }
.sources a { word-break: break-word; }

/* ---- Author box -------------------------------------------------------- */

.author-box {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-soft);
}
.author-box__avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.author-box__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-box__name { margin: 0; font-size: 1.02rem; color: var(--ink); }
.author-box__role { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

/* ---- Footer ------------------------------------------------------------ */

.site-footer {
  background: var(--teal-dark);
  color: #d9eeee;
  margin-top: 48px;
}
.site-footer__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 28px clamp(16px, 5vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: #fff; font-weight: 600; }
.site-footer nav {
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
}
.site-footer nav a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.site-footer__legal { font-size: 0.85rem; color: #a9d2d4; margin: 0; }

/* ---- Utilities --------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
