html {
  scroll-padding-top: 72px;
}

:root {
  --ink: #0f172a;
  --accent: #2563eb;
  --muted: #64748b;
  --canvas: #f8fafc;
  --focus-ring: 2px solid #2563eb;
  --focus-offset: 2px;

  /* Layout — 8px grid */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --section-y: 36px;
  --section-x: 20px;
  --container-max: 1200px;
  --card-pad: 18px;
  --card-radius: 10px;
  --card-gap: 20px;

  --font-h1: 28px;
  --font-h2: 22px;
  --font-h3: 18px;
  --font-subpage-h1: 20px;
  --font-subpage-h2: 17px;
  --subpage-hero-y: 18px;
  --subpage-section-y: 24px;
  --font-body: 16px;
  --lh-body: 1.6;
  --btn-h: 44px;
  --btn-px: 20px;
  --btn-py: 10px;
  --btn-fs: 14px;
}

/* Centered page shell — max 1200px */
.layout-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}

/* Section rhythm: ~36px vertical (desktop), 20px horizontal */
main > section {
  padding: var(--section-y) var(--section-x);
}

main > div:first-of-type {
  padding: var(--section-y) var(--section-x);
}

img,
video {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* Typography scale inside main */
main h1,
main h1.font-display {
  font-size: var(--font-h1);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

main h2,
main h2.font-display {
  font-size: var(--font-h2);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

main h3,
main h3.font-display {
  font-size: var(--font-h3);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Home · compact topic cards (site map grid) */
#topics h3.font-display {
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* Home · first-hour timeline steps */
#timeline h3.font-display {
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.timeline-badge {
  font-variant-numeric: tabular-nums;
}

main p {
  font-size: var(--font-body);
  line-height: var(--lh-body);
}

/* Inner guide pages: tighter vertical rhythm, smaller titles */
body.subpage main > div:first-of-type {
  padding-top: var(--subpage-hero-y);
  padding-bottom: var(--subpage-hero-y);
}

body.subpage main > section {
  padding-top: var(--subpage-section-y);
  padding-bottom: var(--subpage-section-y);
}

body.subpage main h1,
body.subpage main h1.font-display {
  font-size: var(--font-subpage-h1);
  line-height: 1.28;
  letter-spacing: -0.02em;
}

body.subpage main h2.font-display:not(.section-kicker) {
  font-size: var(--font-subpage-h2);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

body.subpage main p,
body.subpage main li {
  font-size: 15px;
  line-height: 1.5;
}

body.subpage main .section-kicker {
  font-size: 11px;
  letter-spacing: 0.1em;
}

body.subpage main .subpage-guide {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  gap: 0.35rem 0.5rem;
}

body.subpage main .subpage-guide a {
  color: #64748b;
  font-weight: 600;
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  margin: -0.2rem -0.45rem;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

body.subpage main .subpage-guide a:hover {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.05);
}

body.subpage main .subpage-guide a[aria-current='page'] {
  color: var(--ink);
  font-weight: 700;
  background: rgba(15, 23, 42, 0.06);
}

/* Primary / solid CTAs — 44px min height, 10×20 padding, 14px label */
main a.btn-cta,
main .btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h);
  padding: var(--btn-py) var(--btn-px);
  font-size: var(--btn-fs);
  line-height: 1.25;
  border-radius: var(--card-radius);
  box-sizing: border-box;
}

header .btn-cta-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h);
  padding: var(--btn-py) var(--btn-px);
  font-size: var(--btn-fs);
  line-height: 1.25;
  border-radius: var(--card-radius);
  box-sizing: border-box;
}

/* Card surface — 20px pad, 10px radius, grids use gap-5 (20px) in HTML */
.ui-card {
  padding: var(--card-pad);
  border-radius: var(--card-radius);
}

.site-header {
  padding-left: var(--section-x);
  padding-right: var(--section-x);
  overflow: visible;
}

/* Top bar (logo + nav + lang) paints above the mobile strip so the language menu is not covered. */
.site-header > .layout-container {
  position: relative;
  z-index: 2;
}

.site-header > nav {
  position: relative;
  z-index: 1;
}

/* Header: any row that contains #site-lang-switch-root (strip or dropdown + CTA) may shrink */
.site-header .layout-container.flex > div:has(#site-lang-switch-root) {
  min-width: 0;
  flex-shrink: 1;
  column-gap: 0.75rem;
}

/* #site-lang-switch-root: inline strip (e.g. /il) OR dropdown (details.lang-nav) — keep UI inside bounds on every locale */
#site-lang-switch-root {
  box-sizing: border-box;
  position: relative;
  min-width: 0;
  max-width: min(100%, 22rem);
  flex-shrink: 1;
}
#site-lang-switch-root .site-lang-switch {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  white-space: nowrap;
  justify-content: flex-start;
  column-gap: 0.375rem;
  row-gap: 0.25rem;
  padding-block: 0.375rem;
  padding-inline: 0.625rem 0.75rem;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
#site-lang-switch-root .site-lang-switch a {
  padding-inline: 0.3125rem;
}
#site-lang-switch-root .site-lang-switch::-webkit-scrollbar {
  height: 4px;
}
#site-lang-switch-root .site-lang-switch::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
}

/* RTL pages: keep locale codes in a stable LTR strip so overflow scroll matches the pill border */
html[dir='rtl'] #site-lang-switch-root .site-lang-switch {
  direction: ltr;
}

/* Dropdown under #site-lang-switch-root — panel + long native names stay inside the box / viewport */
#site-lang-switch-root .lang-nav {
  max-width: 100%;
}

#site-lang-switch-root .lang-nav__summary {
  max-width: 100%;
}

#site-lang-switch-root .lang-nav__panel {
  max-width: min(20rem, calc(100vw - 1.5rem));
  min-width: min(11rem, calc(100vw - 1.5rem));
  box-sizing: border-box;
}

#site-lang-switch-root .lang-nav__opt {
  overflow-wrap: anywhere;
}

.site-footer {
  padding: calc(var(--section-y) * 0.85) var(--section-x);
}

[data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .motion-safe\:animate-pulse {
    animation: none !important;
  }
  .back-to-top,
  .fixed-download-btn {
    transition: none !important;
  }
}

.font-display {
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.nav-link {
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}
.nav-link:hover::after {
  width: 100%;
}
.nav-link[aria-current='page'] {
  color: var(--ink);
  font-weight: 600;
}
.nav-link[aria-current='page']::after {
  width: 100%;
}

.timeline-line::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 3rem;
  bottom: 0.75rem;
  width: 2px;
  background: linear-gradient(180deg, #bfdbfe 0%, #e2e8f0 100%);
  border-radius: 2px;
}
.timeline-line--compact::before {
  left: 17px;
  top: 2.35rem;
  bottom: 0.5rem;
}
@media (min-width: 640px) {
  .timeline-line::before {
    left: 23px;
  }
  .timeline-line--compact::before {
    left: 21px;
    top: 2.4rem;
  }
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

details summary::-webkit-details-marker {
  display: none;
}
.faq-summary {
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  transition: color 0.2s;
}
.faq-summary::after {
  content: '+';
  flex-shrink: 0;
  margin-top: 0.1em;
  font-weight: 600;
  font-size: 1.1em;
  line-height: 1.2;
  color: #94a3b8;
  transition: color 0.2s;
}
details[open] > .faq-summary::after {
  content: '−';
  color: var(--accent);
}

.back-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s, box-shadow 0.2s;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.25);
}

.fixed-download-btn {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--btn-h);
  padding: var(--btn-py) var(--btn-px);
  border-radius: var(--card-radius) 0 0 var(--card-radius);
  background: var(--accent);
  color: #fff;
  font-size: var(--btn-fs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: -8px 12px 32px rgba(37, 99, 235, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-right: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s, background-color 0.2s;
}
.fixed-download-btn:hover {
  background: #1d4ed8;
  box-shadow: -10px 16px 40px rgba(37, 99, 235, 0.38);
  transform: translateY(-50%) translateX(-2px);
}
.fixed-download-btn.at-section {
  opacity: 0.72;
}

/* Home · #download band — CTA matches header / fixed download sizing */
#download .btn-download-band {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--btn-h);
  padding: var(--btn-py) var(--btn-px);
  font-size: var(--btn-fs);
  line-height: 1.25;
  border-radius: var(--card-radius);
  box-sizing: border-box;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
#download .btn-download-band:hover {
  background: #1d4ed8;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}
#download .btn-download-band:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

@media (max-width: 640px) {
  .fixed-download-btn span {
    display: none;
  }
  .fixed-download-btn {
    padding: var(--btn-py) 12px;
  }
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.img-checker {
  --chk-a: #cbd5e1;
  --chk-b: #f1f5f9;
  --cs: 16px;
  background-color: var(--chk-b);
  background-image: linear-gradient(45deg, var(--chk-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--chk-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--chk-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--chk-a) 75%);
  background-size: var(--cs) var(--cs);
  background-position: 0 0, 0 calc(var(--cs) / 2), calc(var(--cs) / 2) calc(var(--cs) / -2), calc(var(--cs) / -2) 0;
}
.img-checker--hero {
  --cs: 16px;
  --chk-a: #cbd5e1;
  --chk-b: #f8fafc;
}
.img-checker--feature {
  --cs: 16px;
}

.browser-frame {
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08), 0 16px 48px -12px rgba(15, 23, 42, 0.1);
}

.section-kicker {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.quote-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  position: relative;
  overflow: hidden;
  border-radius: var(--card-radius);
}
.quote-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

main a:not([class*='rounded-lg']):not([class*='rounded-md']):not([class*='rounded-card']):not(.nav-link):not(.fixed-download-btn):not(.btn-cta):not(.btn-cta-nav):not(.btn-download-band):not(.blog-card-link):not(.blog-pick-link) {
  color: #2563eb;
  font-weight: 500;
  text-underline-offset: 2px;
}
main a:not([class*='rounded-lg']):not([class*='rounded-md']):not([class*='rounded-card']):not(.nav-link):not(.fixed-download-btn):not(.btn-cta):not(.btn-cta-nav):not(.btn-download-band):not(.blog-card-link):not(.blog-pick-link):hover {
  color: #1d4ed8;
}

/* Blog listing + post — fixed 16:9 media, centered article column */
.blog-card-media {
  display: block;
  flex-shrink: 0;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: #f1f5f9;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

a.blog-pick-link {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

a.blog-pick-link .blog-continue {
  color: var(--accent);
}

a.blog-card-link {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}
a.blog-card-link:hover h2 {
  color: var(--accent);
}
a.blog-card-link .blog-continue {
  color: var(--accent);
  font-weight: 700;
}

.blog-post-hero-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  max-height: min(360px, 52vh);
  overflow: hidden;
  border-radius: var(--card-radius);
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f1f5f9;
}
.blog-post-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

body.blog-post-page .blog-post-article {
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

body.blog-post-page .blog-post-prose p {
  font-size: 1rem;
  line-height: 1.65;
}

body.blog-post-page .blog-post-prose h2 {
  margin-top: 0;
}

body.blog-post-page .blog-post-prose h3 {
  margin-top: 0.25rem;
}

body.blog-post-page .blog-post-prose ul {
  margin-top: 0;
}

body.blog-post-page .blog-post-prose aside {
  margin-top: 0.25rem;
}

body.blog-index-page main > section.blog-index-section {
  padding-top: 0;
  padding-bottom: 0;
}

/* Blog index — hero rhythm + card excerpts */
body.blog-index-page main > div.blog-index-hero:first-of-type {
  padding-top: 0;
  padding-bottom: 0;
}

body.blog-index-page .blog-index-hero .subpage-guide {
  justify-content: center;
}

body.blog-index-page .blog-card-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

a.blog-card-link:hover .blog-continue {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  body.blog-index-page article.blog-card {
    transition: none !important;
  }
}

@media (max-width: 639px) {
  main > section,
  main > div:first-of-type {
    padding-top: 28px;
    padding-bottom: 28px;
  }
  body.subpage main > div:first-of-type {
    padding-top: 18px;
    padding-bottom: 18px;
  }
  body.subpage main > section {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  .site-footer {
    padding-top: 28px;
    padding-bottom: 28px;
  }
}

/* Language dropdown in header (#site-lang-switch-root) — matches site pill styling */
.lang-nav {
  position: relative;
  flex-shrink: 0;
  z-index: 1;
}

.lang-nav[open] {
  z-index: 30;
}

.lang-nav__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.35rem 0.55rem;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  user-select: none;
}

.lang-nav__summary::-webkit-details-marker {
  display: none;
}

.lang-nav__code {
  font-weight: 800;
  color: var(--ink);
}

.lang-nav__caret {
  font-size: 9px;
  opacity: 0.65;
}

.lang-nav[open] .lang-nav__summary {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--ink);
}

.lang-nav__panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 11rem;
  max-height: min(70vh, 22rem);
  padding: 0.35rem 0;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lang-nav__opt {
  display: block;
  padding: 0.45rem 0.85rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.lang-nav__opt:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
}

.lang-nav__opt.is-current {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
}

/* Hebrew (RTL) under /il — used with lang="he" dir="rtl" */
html[dir='rtl'] body {
  font-family: 'Heebo', 'Inter', system-ui, -apple-system, sans-serif;
}

html[dir='rtl'] .back-to-top {
  right: auto;
  left: 1.25rem;
}

html[dir='rtl'] .fixed-download-btn {
  right: auto;
  left: 0;
  border-radius: 0 var(--card-radius) var(--card-radius) 0;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  border-left: none;
  box-shadow: 8px 12px 32px rgba(37, 99, 235, 0.3);
}

html[dir='rtl'] .fixed-download-btn:hover {
  transform: translateY(-50%) translateX(2px);
}

html[dir='rtl'] .faq-summary {
  flex-direction: row-reverse;
}

html[dir='rtl'] table {
  direction: rtl;
}
