@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* Typography + tokens — mirrors design-tokens.css + docs/design-system/design-system.md */

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

:root {
  --blog-max-width: 87.5rem; /* 1400px — matches main site container */
  --blog-gutter: clamp(0.75rem, 4vw, 1.5rem);
  --blog-font-sans: 'DM Sans', system-ui, sans-serif;
  --blog-font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --blog-tracking-tight: -0.025em;
  --blog-foreground: hsl(222.2 84% 4.9%);
  --blog-prose: #374151;
  --blog-muted: #6b7280;
  --blog-muted-strong: #4b5563;
  /* OMH brand (aligned with src/styles/design-tokens.css) */
  --omh-navy: hsl(214, 78%, 20%);
  --omh-blue: hsl(217, 100%, 54%);
  --omh-blue-deep: hsl(221, 100%, 50%);
  --omh-mist: hsl(210, 40%, 97%);
  --omh-gradient-cta: linear-gradient(90deg, var(--omh-blue-deep) 0%, var(--omh-blue) 100%);
  --focus-ring: hsl(217 100% 54% / 0.3);
  /* Legacy mental-* aliases (kept for existing rules) */
  --mental-50: hsl(210, 40%, 97%);
  --mental-100: hsl(210, 60%, 93%);
  --mental-300: hsl(217, 100%, 74%);
  --mental-600: var(--omh-blue);
  --mental-700: var(--omh-blue-deep);
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  /* Page canvas — matches marketing Layout.astro / global.css --background */
  --blog-page-bg: hsl(210 40% 98%);
}

html {
  -webkit-text-size-adjust: 100%;
}

body.blog-page {
  margin: 0;
  font-family: var(--blog-font-sans);
  font-size: 1rem;
  color: var(--blog-foreground);
  background: var(--blog-page-bg);
  line-height: 1.625;
  overflow-x: hidden;
  min-width: 320px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.blog-page h1,
.blog-page h2,
.blog-page h3,
.blog-page h4 {
  font-family: var(--blog-font-display);
  letter-spacing: var(--blog-tracking-tight);
}

/* Shared 1400px shell (main content) */
.blog-shell {
  width: 100%;
  max-width: var(--blog-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--blog-gutter);
  padding-right: var(--blog-gutter);
}

.blog-main {
  /* Reserve space for fixed marketing Navbar (~pt-24 / 6rem) */
  padding-top: 6rem;
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  width: 100%;
}

.blog-container {
  width: 100%;
  max-width: var(--blog-max-width);
  margin: 0 auto;
  padding-left: var(--blog-gutter);
  padding-right: var(--blog-gutter);
}

.blog-breadcrumb {
  margin-bottom: 1.25rem;
  font-size: clamp(0.875rem, 2.5vw, 0.95rem);
  color: var(--blog-muted);
}

.blog-breadcrumb a {
  color: var(--blog-muted);
  text-decoration: none;
}

.blog-breadcrumb a:hover {
  color: var(--mental-600);
}

.blog-breadcrumb__sep {
  margin: 0 0.35rem;
  color: var(--gray-500);
}

.blog-key-takeaway {
  margin: 0 0 1.25rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--mental-600);
  background: var(--mental-50);
  color: var(--blog-prose);
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.6;
  border-radius: 0 0.5rem 0.5rem 0;
}

.blog-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--mental-100);
  color: var(--mental-700);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.blog-article h1 {
  font-size: clamp(1.875rem, 5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 1rem;
  overflow-wrap: break-word;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--blog-muted);
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.blog-hero {
  border-radius: 0.75rem;
  overflow: hidden;
  margin: 0 0 1.5rem;
  max-height: min(500px, 55vw);
}

.blog-hero img,
.blog-card__img img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  display: block;
}

.blog-prose {
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 1rem;
  line-height: 1.625;
  color: var(--blog-prose);
}

.blog-prose h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2.75rem 0 1rem;
  line-height: 1.3;
  color: var(--blog-foreground);
}

.blog-prose h2:first-child {
  margin-top: 0;
}

.blog-prose h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  line-height: 1.35;
  color: var(--blog-foreground);
}

.blog-prose h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  line-height: 1.4;
  color: var(--blog-foreground);
}

.blog-prose p {
  margin: 0 0 1.375rem;
}

.blog-prose ul,
.blog-prose ol {
  margin: 0 0 1.375rem;
  padding-left: 1.25rem;
}

@media (min-width: 375px) {
  .blog-prose ul,
  .blog-prose ol {
    padding-left: 1.5rem;
  }
}

.blog-prose li {
  margin-bottom: 0.625rem;
}

.blog-prose li > ul,
.blog-prose li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.blog-prose a {
  color: var(--mental-600);
  text-decoration: underline;
  text-decoration-color: hsl(217 100% 54% / 0.35);
  text-underline-offset: 0.15em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.blog-prose a:hover {
  color: var(--mental-700);
  text-decoration-color: currentColor;
}

.blog-prose strong {
  font-weight: 600;
}

.blog-prose blockquote {
  margin: 0 0 1.375rem;
  padding: 0.75rem 1.25rem;
  border-left: 3px solid var(--mental-300);
  background: var(--gray-50);
  color: var(--blog-muted-strong);
  border-radius: 0 0.375rem 0.375rem 0;
}

.blog-prose blockquote p:last-child {
  margin-bottom: 0;
}

.blog-prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--gray-200);
}

.blog-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  padding: 0.125em 0.375em;
  border-radius: 0.25rem;
  background: var(--gray-100);
  color: var(--gray-800);
}

.blog-prose pre {
  margin: 0 0 1.375rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background: var(--gray-800);
  color: #f3f4f6;
  font-size: 0.875rem;
  line-height: 1.6;
}

.blog-prose pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.blog-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.5rem 0 1.375rem;
}

/* Tables: single grid inside scroll wrapper — header and body columns stay aligned */
.blog-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 0 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
}

.blog-prose table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
  line-height: 1.5;
}

.blog-prose table th,
.blog-prose table td {
  padding: 0.5rem 0.625rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--gray-200);
  overflow-wrap: anywhere;
  hyphens: auto;
}

.blog-prose table th:not(:last-child),
.blog-prose table td:not(:last-child) {
  border-right: 1px solid var(--gray-100);
}

.blog-prose table th {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--blog-muted-strong);
  background: var(--gray-50);
}

.blog-prose table tbody tr:last-child td {
  border-bottom: none;
}

.blog-prose table tbody tr:nth-child(even) {
  background: rgba(249, 250, 251, 0.6);
}

/* Column widths come from build-time <colgroup>; keep cell text from blowing layout */
.blog-prose table col {
  min-width: 0;
}

@media (min-width: 375px) {
  .blog-prose table th,
  .blog-prose table td {
    padding: 0.5625rem 0.75rem;
  }
}

@media (min-width: 768px) {
  .blog-prose table {
    font-size: 0.9375rem;
  }

  .blog-prose table th,
  .blog-prose table td {
    padding: 0.6875rem 1rem;
  }
}

.blog-related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.blog-related h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--blog-foreground);
}

.blog-related ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.blog-related li {
  margin-bottom: 0.5rem;
}

.blog-related a {
  color: var(--mental-600);
  font-weight: 500;
  text-decoration: none;
}

.blog-related a:hover {
  text-decoration: underline;
}

.blog-cta {
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--mental-50);
  border-radius: 0.75rem;
  border: 1px solid var(--mental-100);
}

/* Main conversion band — mirrors CTAMain / CtaBand on the marketing site */
.blog-cta--main {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(135deg, hsl(214, 78%, 20%) 0%, hsl(221, 100%, 50%) 100%);
  border: none;
  border-radius: 1rem;
  color: #fff;
  box-shadow: 0 8px 32px hsl(217 100% 54% / 0.15);
}

.blog-cta__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .blog-cta__inner {
    flex-direction: row;
    align-items: center;
    gap: 2rem;
  }
}

.blog-cta__content {
  flex: 1;
  min-width: 0;
  text-align: center;
}

@media (min-width: 768px) {
  .blog-cta__content {
    text-align: left;
  }
}

.blog-cta__title {
  margin: 0 0 0.75rem;
  font-family: var(--blog-font-display);
  font-size: clamp(1.375rem, 3.5vw, 1.875rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: var(--blog-tracking-tight);
  color: #fff;
}

.blog-cta__text {
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(0.9375rem, 2.5vw, 1.0625rem);
  line-height: 1.65;
}

.blog-cta--main .blog-cta__text {
  color: rgba(255, 255, 255, 0.85);
}

.blog-cta__bullets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .blog-cta__bullets {
    justify-content: flex-start;
  }
}

.blog-cta__bullets li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}

.blog-cta__bullets li::before {
  content: '';
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #34d399;
}

.blog-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex-shrink: 0;
}

.blog-cta--main .blog-cta__actions {
  justify-content: center;
  width: 100%;
}

@media (min-width: 768px) {
  .blog-cta--main .blog-cta__actions {
    width: auto;
    justify-content: flex-end;
  }
}

.blog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: clamp(0.8125rem, 2.5vw, 0.9rem);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
}

.blog-btn--primary {
  background: var(--omh-gradient-cta);
  color: #fff;
}

.blog-btn--primary:hover {
  filter: brightness(1.05);
}

.blog-btn--main {
  width: 100%;
  padding: 1rem 2rem;
  border-radius: 9999px;
  background: #fff;
  color: hsl(214, 78%, 20%);
  font-size: clamp(0.9375rem, 2.5vw, 1.0625rem);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.blog-btn--main:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

@media (min-width: 480px) {
  .blog-btn--main {
    width: auto;
  }
}

.blog-btn--secondary {
  background: #fff;
  color: var(--mental-600);
  border-color: var(--mental-600);
}

.blog-btn--ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-200);
}

.blog-btn--sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

.blog-hub-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  line-height: 1.25;
  color: var(--blog-foreground);
}

.blog-hub-sub {
  color: var(--blog-muted);
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.625;
}

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

.blog-hub-search {
  margin: 0 0 1.5rem;
}

.blog-hub-search__field {
  position: relative;
  display: flex;
  align-items: center;
}

.blog-hub-search__icon {
  position: absolute;
  left: 0.875rem;
  color: var(--blog-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.blog-hub-search__input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem 2.75rem 0.625rem 2.75rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--blog-foreground);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.blog-hub-search__input::placeholder {
  color: var(--blog-muted);
}

.blog-hub-search__input:hover {
  border-color: var(--gray-500);
}

.blog-hub-search__input:focus {
  outline: none;
  border-color: var(--omh-blue);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--focus-ring);
}

.blog-hub-search__input::-webkit-search-cancel-button,
.blog-hub-search__input::-webkit-search-decoration {
  -webkit-appearance: none;
}

.blog-hub-search__clear {
  position: absolute;
  right: 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--blog-muted);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.blog-hub-search__clear:hover {
  color: var(--blog-foreground);
  background: var(--gray-100);
}

.blog-hub-search__clear:focus-visible {
  outline: 2px solid var(--mental-600);
  outline-offset: 2px;
}

.blog-hub-search__status {
  min-height: 1.25rem;
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--blog-muted);
  line-height: 1.4;
}

.blog-hub-search__empty {
  margin: 0 0 1.5rem;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.9375rem;
  color: var(--blog-muted-strong);
  background: var(--gray-50);
  border: 1px dashed var(--gray-200);
  border-radius: 0.75rem;
  line-height: 1.5;
}

.blog-page--hub-redirect .blog-main {
  padding-top: clamp(4.5rem, 12vw, 6rem);
  text-align: center;
}

.blog-hub-redirect .blog-hub-sub {
  color: var(--gray-600);
  margin: 0;
}

.blog-lang-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.blog-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.blog-card {
  border: 1px solid var(--gray-200);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
  background: #fff;
  min-width: 0;
}

/* Ensure filtered cards stay hidden (display:block above can override [hidden] in some browsers). */
.blog-card[hidden],
.blog-card.blog-card--filtered-out {
  display: none !important;
}

.blog-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.blog-card__img {
  height: clamp(140px, 40vw, 180px);
  overflow: hidden;
}

.blog-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.blog-card__body {
  padding: clamp(1rem, 3vw, 1.25rem);
}

.blog-card__cat {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mental-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.blog-card__title {
  font-size: 1.125rem;
  margin: 0.5rem 0;
  font-weight: 700;
  line-height: 1.35;
  color: var(--blog-foreground);
}

.blog-card__excerpt {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  color: var(--blog-muted-strong);
  margin: 0;
  line-height: 1.5;
}

/* ——— Responsive breakpoints ——— */

/* iPhone SE and small phones: stack CTAs */
@media (max-width: 479px) {
  .blog-btn--sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  .blog-cta__actions {
    flex-direction: column;
  }

  .blog-cta__actions .blog-btn {
    width: 100%;
  }

  .blog-lang-picker .blog-btn {
    width: 100%;
  }
}

/* Large phones: 2-column card grid when width allows */
@media (min-width: 480px) {
  .blog-lang-picker {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .blog-hub-title {
    font-size: 2.25rem;
  }

  .blog-hub-sub {
    font-size: 1.125rem;
  }

  .blog-article h1 {
    font-size: 2.25rem;
  }
}

@media (min-width: 1280px) {
  .blog-article h1 {
    font-size: 3rem;
  }
}

/* Desktop: 3-column cards within 1400px */
@media (min-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
