:root {
  --canvas: #F7F6F3;
  --surface: #FFFFFF;
  --ink: #2F3437;
  --ink-strong: #111111;
  --muted: #787774;
  --line: #EAEAEA;
  --night: #1E2340;
  --night-ink: #F2F1EC;
  --accent: #1E2340;
  --tag-bg: #E1F3FE;
  --tag-ink: #1F6C9F;
  --gold-bg: #FBF3DB;
  --gold-ink: #956400;
  --serif-he: "Frank Ruhl Libre", "Newsreader", Georgia, serif;
  --serif-lat: "Newsreader", "Frank Ruhl Libre", Georgia, serif;
  --sans-he: "Heebo", system-ui, sans-serif;
  --sans-lat: "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --serif: var(--serif-he);
  --sans: var(--sans-he);
  --radius: 10px;
  --wrap: 68rem;
  --read: 40rem;
  color-scheme: light;
}
html[lang="en"], html[lang="fr"], html[lang="es"] { --serif: var(--serif-lat); --sans: var(--sans-lat); }

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #11142A;
    --surface: #171B35;
    --ink: #DCDBD5;
    --ink-strong: #F5F4EF;
    --muted: #9A9BAA;
    --line: rgba(255,255,255,0.09);
    --night: #0B0D1E;
    --accent: #C9CCE8;
    --tag-bg: rgba(225,243,254,0.10);
    --tag-ink: #A9D3F2;
    --gold-bg: rgba(251,243,219,0.10);
    --gold-ink: #E4C47A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; z-index: 50; background: var(--surface); padding: .5rem 1rem; }

/* Top bar: translucent layer, content scrolls underneath */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; flex-shrink: 0; }
.brand img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.brand-name { font: 600 1.2rem/1 var(--serif); color: var(--ink-strong); letter-spacing: -0.01em; }
.nav { display: flex; gap: 1.4rem; margin-inline-start: auto; }
.nav a, .mobile-nav a { text-decoration: none; color: var(--muted); font-size: .95rem; transition: color .15s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink-strong); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.lang button {
  border: 0; background: transparent; padding: .3rem .55rem; font: 500 .75rem/1 var(--sans-lat);
  letter-spacing: .04em; color: var(--muted); cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--ink-strong); color: var(--canvas); }
.menu-btn { display: none; }
.mobile-nav { display: none; }

@media (max-width: 820px) {
  .nav { display: none; }
  .lang { margin-inline-start: auto; }
  .menu-btn {
    display: grid; gap: 5px; place-content: center; width: 40px; height: 40px;
    border: 1px solid var(--line); border-radius: 8px; background: transparent; cursor: pointer;
  }
  .menu-btn span { display: block; width: 16px; height: 1.5px; background: var(--ink-strong); }
  .mobile-nav:not([hidden]) {
    display: grid; padding: .25rem 1rem 1rem; max-width: var(--wrap); margin: 0 auto;
  }
  .mobile-nav a { padding: .8rem 0; border-top: 1px solid var(--line); font-size: 1.05rem; color: var(--ink); }
  .brand-name { font-size: 1.05rem; }
}

main { outline: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 1rem; }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.section + .section { border-top: 1px solid var(--line); }

.kicker {
  font: 500 .72rem/1 var(--sans-lat); text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
html[lang="he"] .kicker { font-family: var(--sans-he); letter-spacing: .04em; font-size: .85rem; }

h1, h2, h3 { font-family: var(--serif); color: var(--ink-strong); font-weight: 500; margin: 0; }
.display {
  font-size: clamp(2.5rem, 7vw, 5rem); line-height: 1.04; letter-spacing: -0.03em;
}
html[lang="he"] .display { letter-spacing: -0.01em; line-height: 1.1; }
.h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em; }
.lead { font-size: clamp(1.08rem, 1.6vw, 1.25rem); color: var(--muted); max-width: 36rem; line-height: 1.65; }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 60vw; height: 60vw; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--night) 7%, transparent), transparent);
}
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.hero-text { display: grid; gap: 1.4rem; }
.hero-art {
  aspect-ratio: 1; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: var(--night);
}
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.25rem; border-radius: 6px;
  text-decoration: none; font-weight: 500; font-size: .95rem; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--ink-strong); color: var(--canvas); }
.btn-primary:hover { background: #333; }
@media (prefers-color-scheme: dark) { .btn-primary:hover { background: #fff; } }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--ink-strong); }
.btn-ghost:hover { border-color: var(--muted); }
.arrow { display: inline-block; }
html[dir="rtl"] .arrow { transform: scaleX(-1); }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 15rem; order: -1; }
}

/* Section headers */
.sec-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2.25rem; flex-wrap: wrap; }
.sec-head .more { color: var(--muted); text-decoration: none; font-size: .95rem; }
.sec-head .more:hover { color: var(--ink-strong); }

/* Feature card: this week's parasha, on the logo's night sky */
.feature {
  display: grid; grid-template-columns: 1fr 1fr; border-radius: 14px; overflow: hidden;
  background: var(--night); color: var(--night-ink); text-decoration: none; border: 1px solid var(--line);
}
.feature-body { padding: clamp(1.75rem, 4vw, 3rem); display: grid; gap: 1rem; align-content: start; }
.feature h3 { color: #fff; font-size: clamp(1.7rem, 3.2vw, 2.4rem); line-height: 1.12; letter-spacing: -0.02em; }
.feature p { color: rgba(242,241,236,.78); margin: 0; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--serif-lat); font-size: 1.08rem; line-height: 1.6; }
.feature .tag { background: rgba(255,255,255,.1); color: #fff; }
.feature .go { color: #fff; font-weight: 500; margin-top: .5rem; }
.feature-media { position: relative; min-height: 16rem; }
.feature-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
@media (max-width: 760px) { .feature { grid-template-columns: 1fr; } .feature-media { min-height: 12rem; order: -1; } }

.tag {
  display: inline-block; width: fit-content; border-radius: 9999px; padding: .28rem .7rem;
  font: 500 .7rem/1 var(--sans-lat); letter-spacing: .06em; text-transform: uppercase;
  background: var(--tag-bg); color: var(--tag-ink);
}
html[lang="he"] .tag { font-family: var(--sans-he); font-size: .78rem; letter-spacing: 0; }
.tag-gold { background: var(--gold-bg); color: var(--gold-ink); }
.meta { color: var(--muted); font-size: .88rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* Bento of essays */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; display: grid; align-content: start; overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.04); border-color: color-mix(in srgb, var(--muted) 40%, var(--line)); }
.card-body { padding: 1.5rem 1.6rem 1.75rem; display: grid; gap: .7rem; }
.card h3, .card p[dir="ltr"] { text-align: start; }
.card h3 { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.015em; }
.card p { margin: 0; color: var(--muted); font-size: .97rem; }
.card-img { aspect-ratio: 16/9; background: var(--night); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.bento > .card:nth-child(1) { grid-column: span 4; grid-row: span 2; }
.bento > .card:nth-child(1) .card-img { aspect-ratio: 16/8; }
.bento > .card:nth-child(1) h3 { font-size: clamp(1.6rem, 2.8vw, 2.1rem); }
.bento > .card:nth-child(n+2) { grid-column: span 2; }
.bento > .card:nth-child(n+2) .card-img { display: none; }
@media (max-width: 760px) { .bento { grid-template-columns: 1fr; } .bento > .card { grid-column: auto !important; } }

/* Lists */
.list { display: grid; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 9rem 1fr auto; gap: 1.5rem; align-items: baseline;
  padding: 1.4rem 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.row:hover h3 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.row .p-name { font: 500 1.05rem/1.3 var(--serif-he); color: var(--ink-strong); }
.row .p-name small { display: block; font: 400 .85rem/1.3 var(--sans-lat); color: var(--muted); margin-top: .2rem; }
.row h3 { font-size: 1.3rem; line-height: 1.25; }
.row p { margin: .35rem 0 0; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .date { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.row.soon { opacity: .55; }
.row.soon h3 { font-size: 1rem; color: var(--muted); font-family: var(--sans); }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; gap: .35rem; } }

.book { margin-top: 3rem; }
.book:first-child { margin-top: 0; }
.book-title { font: 500 .8rem/1 var(--sans-lat); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 1rem; }
html[lang="he"] .book-title { font-family: var(--sans-he); letter-spacing: .02em; font-size: .9rem; }

/* Reading view */
.page-head { display: grid; gap: 1rem; max-width: 48rem; }
.reader { max-width: var(--read); margin: 0 auto; }
.reader-head { display: grid; gap: 1rem; margin-bottom: 2.5rem; }
.reader-head h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1.08; letter-spacing: -0.025em; }
.reader-head .sub { font: italic 400 1.25rem/1.5 var(--serif-lat); color: var(--muted); margin: 0; }
.back { color: var(--muted); text-decoration: none; font-size: .9rem; width: fit-content; }
.back:hover { color: var(--ink-strong); }
.prose { font: 400 1.18rem/1.75 var(--serif-lat); color: var(--ink); }
.prose[dir="rtl"] { font-family: var(--serif-he); font-size: 1.22rem; }
.prose p { margin: 0 0 1.35em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--serif-lat); margin: 2em 0 .6em; line-height: 1.25; letter-spacing: -0.01em; }
.prose h2 { font-size: 1.6rem; } .prose h3 { font-size: 1.35rem; } .prose h4 { font-size: 1.15rem; }
.prose blockquote { margin: 1.8em 0; padding-inline-start: 1.25rem; border-inline-start: 2px solid var(--ink-strong); color: var(--ink-strong); font-style: italic; }
.prose img { border-radius: 8px; margin: 1.5em auto; }
.prose figure { margin: 0; }
.prose figcaption { font: .85rem/1.4 var(--sans-lat); color: var(--muted); text-align: center; }
.prose a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; margin: 0 0 1.35em; }
.prose li { margin-bottom: .45em; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em auto; width: 30%; }
.lang-note { font-size: .85rem; color: var(--muted); display: flex; gap: .5rem; align-items: center; }

.video { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; }
.video-frame { aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--night); border: 1px solid var(--line); position: relative; }
.video-frame iframe, .video-frame img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.play {
  position: absolute; inset: 0; display: grid; place-items: center; border: 0; background: rgba(11,13,30,.25); cursor: pointer;
}
.play span {
  width: 68px; height: 68px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center;
  transition: transform .15s;
}
.play:hover span { transform: scale(1.05); }
.play svg { margin-inline-start: 4px; }
html[dir="rtl"] .play svg { margin-inline-start: 0; margin-inline-end: -4px; }

/* Ask form */
.ask-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 820px) { .ask-grid { grid-template-columns: 1fr; } }
.form { display: grid; gap: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(1.25rem, 3vw, 2rem); }
.field { display: grid; gap: .45rem; }
.field label, .field legend { font-size: .85rem; font-weight: 500; color: var(--ink-strong); padding: 0; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink-strong); background: var(--canvas);
  border: 1px solid var(--line); border-radius: 6px; padding: .75rem .85rem;
}
.field textarea { min-height: 9rem; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink-strong); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
fieldset { border: 0; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .2rem; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  border: 1px solid var(--line); border-radius: 9999px; padding: .42rem .85rem; font-size: .88rem; font-weight: 400;
  cursor: pointer; color: var(--ink); background: var(--canvas); transition: background .15s, color .15s, border-color .15s;
}
.chips input:checked + label { background: var(--ink-strong); color: var(--canvas); border-color: var(--ink-strong); }
.chips input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: .6rem; align-items: center; font-size: .9rem; color: var(--muted); }
.check input { width: 1rem; height: 1rem; accent-color: var(--ink-strong); }
.status { font-size: .92rem; margin: 0; min-height: 1.4em; }
.status.ok { color: #346538; }
@media (prefers-color-scheme: dark) { .status.ok { color: #9BC79F; } }

/* About + contact */
.about-grid { display: grid; grid-template-columns: .7fr 1.3fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }
.about-grid .prose p:first-child { font-size: 1.35rem; color: var(--ink-strong); }
.contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
@media (max-width: 640px) { .contact-cards { grid-template-columns: 1fr; } }
.contact-cards a { padding: 1.4rem; display: grid; gap: .4rem; }
.contact-cards strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; color: var(--ink-strong); }
.contact-cards span { color: var(--muted); font-size: .88rem; direction: ltr; text-align: start; }

/* CTA strip */
.cta { display: flex; align-items: center; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.cta .h2 { max-width: 30rem; }

.footer { border-top: 1px solid var(--line); }
.footer-inner { max-width: var(--wrap); margin: 0 auto; padding: 2.5rem 1rem; display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; justify-content: space-between; color: var(--muted); }
.footer-brand { display: flex; gap: .6rem; align-items: center; font: 500 1rem var(--serif); color: var(--ink-strong); }
.footer-brand img { border-radius: 6px; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { text-decoration: none; font-size: .92rem; }
.footer-links a:hover { color: var(--ink-strong); }

/* Entry motion: quiet fade-up, off when reduced motion is asked for */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; }
.reveal.done { transition: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
@media (prefers-reduced-transparency: reduce) { .topbar { background: var(--canvas); backdrop-filter: none; } }
