/* ==========================================================================
   B'Sefer HaChaim 5787
   Palette + artwork sampled from Simone Lassar's flyer.
   Every piece of art is a white-on-transparent PNG used as a CSS mask, so
   any motif can be recoloured from a variable. See tools/slice-art.py.
   ========================================================================== */

:root {
  --ink:        #0f0d0b;
  --ink-2:      #1b1712;
  --cream:      #ede4d4;
  --cream-dim:  #b7ac99;
  --brown:      #a87f4e;
  --brown-lt:   #c89b62;
  --brown-dk:   #5c4429;
  --red:        #e23a2e;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --wrap: 1080px;
  --narrow: 760px;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.12; margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0 0 1.1em; }
b { font-weight: 650; }
i { font-style: italic; }

a { color: var(--brown-lt); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--cream); }

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

.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 20;
  background: var(--cream); color: var(--ink);
  padding: 0.55rem 0.9rem; border-radius: 4px;
}

.wrap { width: min(92vw, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(92vw, var(--narrow)); }
.center { text-align: center; }

/* ---------------------------------------------------------------- motifs */

.motif {
  display: block;
  background-color: var(--motif, var(--brown-dk));
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
  pointer-events: none;
}

.motif-pom-cut   { -webkit-mask-image: url(../art/pomegranate-cut.png);   mask-image: url(../art/pomegranate-cut.png);   aspect-ratio: 297/344; }
.motif-sprig     { -webkit-mask-image: url(../art/floral-sprig.png);      mask-image: url(../art/floral-sprig.png);      aspect-ratio: 770/194; }
.motif-fish      { -webkit-mask-image: url(../art/fish.png);              mask-image: url(../art/fish.png);              aspect-ratio: 333/264; }
.motif-leaf      { -webkit-mask-image: url(../art/leaf-branch.png);       mask-image: url(../art/leaf-branch.png);       aspect-ratio: 268/882; }
.motif-olive     { -webkit-mask-image: url(../art/olive-branch.png);      mask-image: url(../art/olive-branch.png);      aspect-ratio: 341/795; }
.motif-books     { -webkit-mask-image: url(../art/machzor-stack.png);     mask-image: url(../art/machzor-stack.png);     aspect-ratio: 611/368; }
.motif-shofar    { -webkit-mask-image: url(../art/shofar.png);            mask-image: url(../art/shofar.png);            aspect-ratio: 546/238; }
.motif-pom-whole { -webkit-mask-image: url(../art/pomegranate-whole.png); mask-image: url(../art/pomegranate-whole.png); aspect-ratio: 357/413; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--brown) 22%, transparent);
}
.topbar-in {
  width: min(94vw, 1240px); margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.7rem 0;
}
.wordmark { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--cream); }
/* the title is the flyer's own hand lettering, not type */
.wordmark-art {
  display: block;
  width: clamp(132px, 14vw, 172px); aspect-ratio: 405/78;
  background-color: var(--cream);
  -webkit-mask-image: url(../art/wordmark.png); mask-image: url(../art/wordmark.png);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;   mask-size: 100% 100%;
}
.wordmark-he { color: var(--brown); font-size: 0.95rem; }

.topnav { display: flex; align-items: center; gap: clamp(0.85rem, 2.2vw, 1.6rem); }
.topnav a { color: var(--cream-dim); text-decoration: none; font-size: 0.94rem; }
.topnav a:hover { color: var(--cream); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-block;
  background: var(--red); color: #fff;
  padding: 0.72rem 1.5rem;
  border-radius: 2px;
  font-weight: 650; font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  border: 1px solid var(--red);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn:hover { background: transparent; color: var(--red); }
.btn-sm { padding: 0.42rem 0.95rem; font-size: 0.88rem; }
.btn-lg { padding: 0.95rem 2.4rem; font-size: 1.05rem; }
.topnav .btn-sm { color: #fff; }
.topnav .btn-sm:hover { color: var(--red); }

/* registration closed: same shape as .btn, but inert */
.btn-off {
  background: transparent; color: var(--cream-dim);
  border-color: currentColor; cursor: default;
}
.btn-off:hover { background: transparent; color: var(--cream-dim); }
.topnav .btn-off, .topnav .btn-off:hover { color: var(--cream-dim); }

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  min-height: calc(100svh - 60px);
  display: grid; place-items: center;
  padding: clamp(2rem, 5vh, 3.5rem) 0 clamp(2.5rem, 6vh, 4rem);
  isolation: isolate;
  /* clip sideways only: motifs bleed off the left/right edges as intended, but
     the bottom ones carry on down into the next section instead of being
     sliced off. `clip` (not `hidden`) is what allows one axis to stay visible. */
  overflow-x: clip;
}

.hero-art { position: absolute; inset: 0; z-index: -1; }
.hero-art .motif { position: absolute; opacity: 0.62; }

.motif-pom-cut   { top: -5%;  left: -2%;   width: clamp(120px, 16vw, 290px); --motif: var(--brown-dk); opacity: 0.85; }
.motif-sprig     { top: 3%;   left: 27%;   width: clamp(180px, 30vw, 500px); --motif: var(--brown-dk); }
.motif-fish      { top: 5%;   right: -2%;  width: clamp(105px, 14vw, 260px); --motif: var(--brown-dk); opacity: 0.85; }
.motif-leaf      { top: 17%;  left: -2%;   width: clamp(80px, 10vw, 185px);  --motif: var(--brown-dk); }
.motif-olive     { top: 22%;  right: -1%;  width: clamp(80px, 11vw, 205px);  --motif: var(--brown-dk); }
/* these two run off the bottom of the hero and carry on down the page */
.motif-books     { bottom: -9%; left: -2%;  width: clamp(170px, 25vw, 440px); --motif: var(--brown-dk); opacity: 0.85; }
.motif-shofar    { bottom: 3%;  left: 40%;  width: clamp(150px, 22vw, 400px); --motif: var(--brown-dk); }
.motif-pom-whole { bottom: -8%; right: -1%; width: clamp(125px, 17vw, 290px); --motif: var(--brown-dk); opacity: 0.85; }

.hero-in {
  position: relative; z-index: 1;
  width: min(94vw, 1240px);
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.75rem, 4.5vw, 4rem);
}

/* --- the flyer's hand-lettering, pulled apart into lines ---
   Line widths are each word's true width as a share of the widest one, so
   the stack keeps the artist's original proportions while filling the
   column edge to edge. Natural sizes are in tools/slice-art.py. */
.lettering { display: block; }
.ln {
  display: block;
  background-color: var(--cream);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;   mask-size: 100% 100%;
}
.ln + .ln { margin-top: clamp(0.35rem, 1.1vh, 0.8rem); }

.ln-anti { width: 82.1%; aspect-ratio: 746/153; -webkit-mask-image: url(../art/word-anti-zionist.png);     mask-image: url(../art/word-anti-zionist.png); }
.ln-trad { width: 73.4%; aspect-ratio: 667/76;  -webkit-mask-image: url(../art/word-traditional.png);      mask-image: url(../art/word-traditional.png);      background-color: var(--brown-lt); }
.ln-egal { width: 69.6%; aspect-ratio: 633/88;  -webkit-mask-image: url(../art/word-egalitarian.png);      mask-image: url(../art/word-egalitarian.png);      background-color: var(--brown-lt); }
.ln-comm { width: 78.5%; aspect-ratio: 714/85;  -webkit-mask-image: url(../art/word-community-led.png);    mask-image: url(../art/word-community-led.png);    background-color: var(--brown-lt); }
.ln-rosh { width: 95.1%; aspect-ratio: 864/88;  -webkit-mask-image: url(../art/word-rosh-hashana.png);     mask-image: url(../art/word-rosh-hashana.png); }
.ln-day  { width: 100%;  aspect-ratio: 909/83;  -webkit-mask-image: url(../art/word-day-1-2-services.png); mask-image: url(../art/word-day-1-2-services.png); }

/* --- facts panel alongside the lettering --- */
.hero-side { border-left: 1px solid color-mix(in srgb, var(--brown) 35%, transparent); padding-left: clamp(1.25rem, 2.5vw, 2.25rem); }
.hero-he {
  margin: 0 0 0.25rem; color: var(--brown-lt);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.3;
  text-align: left; /* RTL text would otherwise right-align away from the label below */
}
.eyebrow {
  margin: 0;
  font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--brown);
}

.squiggle {
  display: block; margin: clamp(1rem, 2.4vh, 1.5rem) 0;
  width: min(100%, 260px); aspect-ratio: 931/123;
  background-color: var(--red);
  -webkit-mask-image: url(../art/squiggle.png); mask-image: url(../art/squiggle.png);
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;   mask-size: 100% 100%;
}

.when { margin-bottom: clamp(1.2rem, 3vh, 1.9rem); }
.when-row {
  margin: 0 0 0.35em;
  font-size: clamp(0.98rem, 1.3vw, 1.1rem);
  display: flex; flex-direction: column;
}
.when-row b { font-weight: 650; }
.when-row span { color: var(--brown-lt); font-size: 0.94em; }
.when-note {
  margin: 0.9rem 0 0;
  font-size: 0.86rem; line-height: 1.5;
  color: var(--cream-dim);
}
.hero-cta { margin: 0; }

/* ----------------------------------------------------------------- bands */

.band { position: relative; padding: clamp(3.5rem, 9vh, 6.5rem) 0; overflow: hidden; }
/* extra headroom so the books and pomegranate spilling out of the hero have
   clear space before the About copy starts */
#about { padding-top: clamp(6rem, 14vh, 9.5rem); }
.band-alt { background: var(--ink-2); }
.band-cta {
  background: var(--ink-2);
  border-block: 1px solid color-mix(in srgb, var(--brown) 25%, transparent);
}
.band .wrap { position: relative; z-index: 1; }

.motif-band { position: absolute; opacity: 0.4; --motif: var(--brown-dk); z-index: 0; }
.motif-band-olive { top: -6%;    right: -3%; width: clamp(90px, 12vw, 190px); }
.motif-band-shofar{ bottom: -14%; left: -4%; width: clamp(160px, 22vw, 340px); }
.motif-band-pom   { top: 2%;     right: -5%; width: clamp(110px, 14vw, 230px); }
.motif-band-sprig {
  top: -6%; left: 50%; translate: -50% 0;
  width: clamp(220px, 36vw, 470px); opacity: 0.3;
}

.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.76rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--brown);
}
.band h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin-bottom: 1.1rem; }
.lead { font-size: clamp(1rem, 1.6vw, 1.14rem); color: color-mix(in srgb, var(--cream) 88%, transparent); }
.lead-tight { max-width: 56ch; }

/* ----------------------------------------------------------------- drash */

.drash-he {
  margin: 0 0 0.3rem; color: var(--brown-lt);
  font-size: clamp(1.5rem, 3.2vw, 2.1rem); line-height: 1.4;
  text-align: left; /* RTL text would otherwise right-align away from the translation */
}
.drash-en {
  margin: 0 0 2rem; font-style: italic;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--brown);
}
.drash-p {
  color: color-mix(in srgb, var(--cream) 88%, transparent);
  font-size: clamp(1rem, 1.6vw, 1.14rem);
}
.drash-p:last-child { margin-bottom: 0; }

.marks { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.marks li { position: relative; padding-left: 1.6rem; color: color-mix(in srgb, var(--cream) 88%, transparent); }
.marks li::before {
  content: ""; position: absolute; left: 0; top: 0.66em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}

/* -------------------------------------------------------------- schedule */

.days {
  display: grid; gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 2.5rem;
}
.day { border-top: 2px solid var(--brown); padding-top: 1.2rem; }
.day h3 { font-size: 1.25rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.7rem; }
.day h3 span {
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--brown-lt);
}
.day dl {
  margin: 1.2rem 0 0;
  display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.55rem 0.9rem;
}
.day dt { color: var(--brown-lt); font-variant-numeric: tabular-nums; }
.day dd { margin: 0; color: color-mix(in srgb, var(--cream) 88%, transparent); }
.day dd i { color: var(--cream-dim); font-size: 0.94em; }

.fineprint { font-size: 0.88rem; color: var(--cream-dim); margin: 1.2rem 0 0; }

/* ------------------------------------------------------------------- faq */

.faq { margin-top: 2.5rem; }
.faq details {
  border-top: 1px solid color-mix(in srgb, var(--brown) 28%, transparent);
}
.faq details:last-of-type {
  border-bottom: 1px solid color-mix(in srgb, var(--brown) 28%, transparent);
}
.faq summary {
  /* block, not flex: inline markup in a question (e.g. <i>aliyah</i>) would
     otherwise be split off as its own flex item and pushed across the row */
  display: block; position: relative;
  padding: 1.15rem 2.5rem 1.15rem 0;
  cursor: pointer;
  list-style: none;
  font-size: clamp(1rem, 1.8vw, 1.12rem);
  font-weight: 600;
  color: var(--cream);
  transition: color 0.15s ease;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--brown-lt); }
.faq summary::after {
  content: ""; position: absolute; right: 0; top: 1.15rem;
  width: 15px; height: 15px; margin-top: 0.45em;
  background:
    linear-gradient(var(--brown-lt), var(--brown-lt)) center / 15px 1.5px no-repeat,
    linear-gradient(var(--brown-lt), var(--brown-lt)) center / 1.5px 15px no-repeat;
  transition: transform 0.25s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .answer { padding: 0 0 1.5rem; max-width: 62ch; }
.faq .answer p { color: color-mix(in srgb, var(--cream) 84%, transparent); }
.faq .answer p:last-child { margin-bottom: 0; }
.faq .answer ul { margin: 0; padding-left: 1.1rem; }
.faq .answer li { color: color-mix(in srgb, var(--cream) 84%, transparent); margin-bottom: 0.35rem; }

@media (prefers-reduced-motion: no-preference) {
  .faq details[open] .answer { animation: reveal 0.25s ease both; }
  @keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  position: relative; overflow: hidden;
  text-align: center;
  padding: clamp(3rem, 8vh, 5rem) 0 clamp(2.5rem, 6vh, 4rem);
  border-top: 1px solid color-mix(in srgb, var(--brown) 25%, transparent);
}
.site-footer .wrap { position: relative; z-index: 1; }
.foot-he { color: var(--brown); font-size: 1.35rem; margin: 0 0 0.35rem; }
.foot-name { font-weight: 650; margin: 0 0 1.4rem; }
.foot-credit { margin: 0 0 0.3rem; font-size: 0.9rem; color: var(--cream-dim); }
.foot-credit b { color: var(--brown-lt); font-weight: 600; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .hero-art .motif { opacity: 0.42; }
  .motif-sprig, .motif-shofar { display: none; }
  .hero-in { grid-template-columns: 1fr; gap: clamp(1.5rem, 4vh, 2.25rem); }
  .ln { margin-inline: auto; } /* centred, to sit with the centred panel below */
  .hero-side {
    border-left: 0; padding-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--brown) 35%, transparent);
    padding-top: clamp(1.25rem, 3vh, 1.75rem);
  }
  .squiggle { margin-inline: auto; }
  .hero-side { text-align: center; }
  .hero-he { text-align: center; }
  /* date + time on one line here -- saves the vertical room that would push
     the Register button below the fold on a phone */
  .when-row { flex-direction: row; justify-content: center; align-items: baseline; gap: 0.55rem; }
}

@media (max-width: 620px) {
  .topnav a:not(.btn) { display: none; }
  .wordmark-he { display: none; }
  .motif-leaf, .motif-olive { display: none; }
  .hero-art .motif { opacity: 0.35; }
  .day dl { grid-template-columns: 3.6rem 1fr; }
}
