/* SmartWords Blog — KB-aligned chrome.
   Mirrors the kb-seo hero pattern: a teal card containing the brand
   lockup, locale switcher, breadcrumbs, eyebrow, title, optional
   answer callout, hero summary, action row (Google Play, Play games,
   Take a level test), and a search form. The post content sits on a
   light page surface below the hero. */

:root {
  --brand-primary: #1867C0;
  --brand-primary-dark: #1F5592;
  --brand-primary-rgb: 24 103 192;
  --brand-secondary: #48A9A6;
  --brand-secondary-rgb: 72 169 166;
  --ink: #1A293B;
  --ink-muted: #505E70;
  --ink-soft: #7B8492;
  --surface: #FFFFFF;
  --surface-alt: #F0F4FE;
  --page-bg: #F7F7FE;
  --border: #DCE5FE;
  --hero-bg: var(--brand-secondary);
  --hero-ink: #FFFFFF;
  --hero-ink-soft: rgba(255, 255, 255, 0.92);
  --radius-pill: 999px;
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow: 0 24px 48px rgba(31, 41, 55, 0.08);
  --shadow-soft: 0 12px 24px rgba(9, 26, 60, 0.15);
  --max-width: 1120px;
  --content-width: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--page-bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.6;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(var(--brand-primary-rgb), 0.08) 0%, transparent 30%),
    linear-gradient(180deg, var(--page-bg) 0%, var(--surface-alt) 100%);
  display: flex;
  flex-direction: column;
}

a { color: var(--brand-primary); text-decoration-color: rgba(var(--brand-primary-rgb), 0.45); text-underline-offset: 0.18em; }
a:hover { color: var(--brand-primary-dark); }

img { max-width: 100%; }

/* ---------- Hero (teal card chrome) ---------- */
.hero {
  padding: 1.25rem 1.25rem 1rem;
}
.hero__inner {
  margin: 0 auto;
  max-width: var(--max-width);
  background: var(--hero-bg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  color: var(--hero-ink);
  padding: 1.5rem 1.5rem 1.75rem;
  position: relative;
}

.hero__chrome {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1.2rem;
  position: relative;
  z-index: 5;
}

.brand-lockup {
  align-items: center;
  color: var(--hero-ink);
  display: inline-flex;
  gap: 0.7rem;
  text-decoration: none;
}
.brand-lockup:hover { color: var(--hero-ink); }
.brand-lockup__icon {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.18));
  flex: 0 0 auto;
  height: 42px;
  width: 42px;
}
.brand-lockup__text {
  filter: brightness(0) invert(1);
  flex: 0 0 auto;
  height: 22px;
  width: auto;
}
.brand-lockup__tm {
  font-size: 0.95rem;
  font-weight: 300;
  opacity: 0.8;
}

.hero__controls {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  position: relative;
  z-index: 4;
}

.hero__content { position: relative; z-index: 1; }

.eyebrow {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
}

.breadcrumbs { margin-bottom: 1rem; }
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.breadcrumbs li {
  align-items: center;
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  gap: 0.55rem;
}
.breadcrumbs li:not(:last-child)::after {
  content: "/";
  opacity: 0.68;
}
.breadcrumbs a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: currentColor;
  opacity: 0.85;
}
.breadcrumbs a:hover { opacity: 1; text-decoration-thickness: 2px; }

.hero__heading {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
}

.answer-callout {
  background: rgba(var(--brand-primary-rgb), 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-left: 4px solid #FFFFFF;
  border-radius: var(--radius-sm);
  color: var(--hero-ink);
  font-size: 1.05rem;
  margin: 1rem 0 0;
  max-width: 46rem;
  padding: 0.95rem 1rem;
}
[dir="rtl"] .answer-callout { border-left: 1px solid rgba(255, 255, 255, 0.2); border-right: 4px solid #FFFFFF; }

.hero__summary {
  color: var(--hero-ink-soft);
  font-size: 1.04rem;
  margin: 1rem 0 0;
  max-width: 58rem;
}

.hero__footer {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.hero__promo-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.hero__play-badge {
  display: inline-flex;
  align-items: center;
  background: #000000;
  border-radius: 10px;
  padding: 4px 12px;
  text-decoration: none;
}
.hero__play-badge img { display: block; height: 36px; width: auto; }
.hero__promo-anchor {
  align-items: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius-pill);
  color: var(--hero-ink);
  display: inline-flex;
  font-size: 0.92rem;
  font-weight: 600;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.55rem 1rem;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.hero__promo-anchor:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--hero-ink);
}
.hero__promo-anchor svg { flex: 0 0 auto; }
.hero__promo-anchor-tag {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-pill);
  color: var(--hero-ink);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.5rem;
  text-transform: uppercase;
}

/* ---------- Search form ---------- */
.kb-search-form {
  display: grid;
  flex: 1 1 22rem;
  max-width: 32rem;
}
.kb-search-form__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.kb-search-form__input {
  appearance: none;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: var(--radius-pill);
  color: var(--hero-ink);
  flex: 1 1 16rem;
  font: inherit;
  min-height: 44px;
  padding: 0.65rem 1rem;
}
.kb-search-form__input::placeholder { color: rgba(255, 255, 255, 0.72); }
.kb-search-form__input:focus {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
  outline: none;
}
.kb-search-form__button {
  flex: 0 0 auto;
  min-width: 6.5rem;
}

/* ---------- Buttons ---------- */
.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  display: inline-flex;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  gap: 0.45rem;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary {
  background: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-soft);
}
.button--primary:hover { background: var(--brand-primary-dark); color: #FFFFFF; }
.button--secondary { background: transparent; border-color: var(--border); color: var(--brand-primary); }
.button--secondary:hover { background: var(--surface-alt); color: var(--brand-primary-dark); }
.button--secondary.button--on-hero {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
  color: var(--hero-ink);
}
.button--secondary.button--on-hero:hover {
  background: rgba(255, 255, 255, 0.20);
  border-color: rgba(255, 255, 255, 0.50);
  color: var(--hero-ink);
}

/* ---------- Locale menu (in hero chrome) ---------- */
.locale-menu {
  align-items: center;
  display: inline-flex;
  position: relative;
  z-index: 40;
}
.locale-menu[open] { z-index: 60; }
.locale-menu img { width: 1.35rem; height: 1.35rem; object-fit: cover; border-radius: 999px; }
.locale-menu__trigger {
  align-items: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius-pill);
  color: var(--hero-ink);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 0.4rem;
  list-style: none;
  min-height: 42px;
  min-width: 58px;
  padding: 0.35rem 0.7rem;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.locale-menu__trigger::-webkit-details-marker { display: none; }
.locale-menu__trigger:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-1px); }
.locale-menu__chevron { transition: transform 0.15s ease; }
.locale-menu[open] .locale-menu__chevron { transform: rotate(180deg); }
.locale-menu__popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  display: none;
  gap: 0.45rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0.65rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  width: 10.6rem;
  z-index: 50;
}
[dir="rtl"] .locale-menu__popover { right: auto; left: 0; }
.locale-menu[open] .locale-menu__popover { display: grid; }
.locale-menu__option {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: inline-flex;
  height: 2.5rem;
  justify-content: center;
  min-width: 2.5rem;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}
.locale-menu__option:hover { border-color: rgba(var(--brand-primary-rgb), 0.36); transform: translateY(-1px); }
.locale-menu__option--active {
  border-color: rgba(var(--brand-primary-rgb), 0.62);
  box-shadow: inset 0 0 0 1px rgba(var(--brand-primary-rgb), 0.2);
}
.locale-menu__badge {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 1.35rem;
  justify-content: center;
  width: 1.35rem;
  color: var(--brand-primary-dark);
}
.locale-menu__badge--arabic { background: #118847; color: #FFFFFF; }

.visually-hidden {
  border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px;
  overflow: hidden; padding: 0; position: absolute; white-space: nowrap; width: 1px;
}

/* ---------- Main content surface ---------- */
.site-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.empty-state {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  text-align: center;
}

/* ---------- Post grid (index + tag + search) ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}
.post-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.post-card__hero {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--surface-alt);
}
.post-card__hero img { width: 100%; height: 100%; object-fit: cover; }
.post-card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.post-card__meta { color: var(--ink-soft); font-size: 0.85rem; margin: 0; display: flex; gap: 8px; align-items: center; }
.post-card__title { font-size: 1.3rem; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
.post-card__title a { color: var(--ink); text-decoration: none; }
.post-card__title a:hover { color: var(--brand-primary); }
.post-card__excerpt { color: var(--ink-muted); font-size: 0.98rem; margin: 0; }

/* ---------- Tag pills ---------- */
.tag-pills { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(var(--brand-primary-rgb), 0.08);
  color: var(--brand-primary-dark);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}
.tag-pill:hover { background: rgba(var(--brand-primary-rgb), 0.16); }

/* ---------- Pagination ---------- */
.pagination {
  margin: 48px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pagination__link {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.pagination__link:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.pagination__status { color: var(--ink-soft); font-size: 0.9rem; }
.pagination__placeholder { display: inline-block; min-width: 1px; }

/* ---------- Single post body ---------- */
.post {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: clamp(28px, 4vw, 48px);
  box-shadow: var(--shadow);
  max-width: var(--content-width);
  margin: 0 auto;
}
.post__hero { margin: 0 0 32px; border-radius: var(--radius-md); overflow: hidden; }
.post__hero img { width: 100%; }

.prose { color: var(--ink); }
.prose a { color: var(--brand-primary); }
.prose code { background: var(--surface-alt); padding: 0.15em 0.4em; border-radius: 6px; font-size: 0.92em; }
.prose pre { background: #0b1220; color: #e2e8f0; border-radius: var(--radius-md); padding: 18px 20px; overflow-x: auto; }
.prose blockquote {
  border-left: 4px solid var(--brand-primary);
  padding-left: 16px;
  color: var(--ink-muted);
  font-style: italic;
}
[dir="rtl"] .prose blockquote { border-left: none; border-right: 4px solid var(--brand-primary); padding-left: 0; padding-right: 16px; }

.fallback-banner {
  margin: 0 0 24px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 122, 89, 0.10);
  border: 1px solid rgba(255, 122, 89, 0.30);
  color: #8a3a1f;
  font-size: 0.92rem;
}

/* ---------- Related reads ---------- */
.related { max-width: var(--content-width); margin: 48px auto 0; }
.related__title { font-size: 1.2rem; margin: 0 0 16px; letter-spacing: -0.01em; }
.related__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.related__list a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
}
.related__list a:hover { border-color: var(--brand-primary); }
.related__item-title { font-weight: 600; }
.related__item-meta { color: var(--ink-soft); font-size: 0.85rem; }

.back-link { max-width: var(--content-width); margin: 32px auto 0; }

/* ---------- Footer (mirrors kb-seo .site-footer*) ---------- */
.site-footer {
  margin-top: auto;
  padding: 0 1.25rem 2rem;
}
.site-footer__inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  color: var(--ink);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2rem;
}
.site-footer__grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.site-footer__column { align-content: start; display: grid; gap: 0.75rem; }
.site-footer__column--brand { gap: 0.9rem; }
.site-footer__tagline,
.site-footer__heading { color: var(--ink); margin: 0; }
.site-footer__tagline { font-size: 1rem; font-weight: 600; }
.site-footer__heading { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.site-footer__brand-link {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  gap: 0.7rem;
  max-width: fit-content;
  text-decoration: none;
}
.site-footer__brand-link:hover { color: var(--ink); }
.site-footer__brand-icon { height: 38px; width: 38px; }
.site-footer__brand-text { height: 22px; width: auto; }
.site-footer__brand-tm { font-size: 0.95rem; font-weight: 300; opacity: 0.8; }
.site-footer__legal { color: var(--ink-muted); display: grid; gap: 0.25rem; font-size: 0.9rem; }
.site-footer__links {
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-footer__links a {
  color: var(--ink);
  font-size: 1rem;
  text-decoration: none;
}
.site-footer__links a:hover { color: var(--brand-primary); }
.site-footer__socials { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.site-footer__social-link {
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-muted);
  display: inline-flex;
  height: 2.5rem;
  justify-content: center;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
  width: 2.5rem;
}
.site-footer__social-link:hover {
  border-color: rgba(var(--brand-primary-rgb), 0.36);
  color: var(--brand-primary);
  transform: translateY(-1px);
}
[dir="rtl"] .site-footer__brand-link { direction: ltr; }
[dir="rtl"] .site-footer__inner { text-align: right; }

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
  .hero { padding: 0.75rem 0.75rem 0.5rem; }
  .hero__inner { padding: 1.25rem 1.25rem 1.5rem; border-radius: var(--radius-md); }
  .brand-lockup__text { height: 18px; }
  .hero__promo-anchors { width: 100%; }
  .kb-search-form { flex: 1 1 100%; max-width: none; }
}
