/* ==========================================================================
   מגדלור — Stylesheet
   Sections: reset · backdrop · layout · typography · buttons · header ·
             hero · contact · footer · breakpoints · motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 6rem;
  background: var(--navy-950);
}

body {
  min-height: 100svh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg,
picture,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
textarea,
button {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   Backdrop — two clips running back to back behind the whole document
   -------------------------------------------------------------------------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--navy-950);
  pointer-events: none;
}

/* Two stacked clips. Only the active one is opaque; the handoff is a linear
   crossfade, which is invisible here because clip 1 ends on very nearly the
   frame clip 2 opens on (and vice versa). */
.backdrop__video {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity var(--backdrop-crossfade, 800ms) linear;
}

.backdrop__video.is-active {
  opacity: 1;
}

/* Without JS only clip 1 ever plays, so it must not be left transparent. */
.backdrop__video[data-backdrop-clip="1"] {
  opacity: 1;
}

.backdrop__video[data-backdrop-clip="1"]:not(.is-active) {
  opacity: 0;
}

/* Scrim: keeps the hero legible over a moving image without flattening it.
   Kept fairly even top-to-bottom — the gap between the sheets lands at a
   varying height, and a strong falloff made it look washed out. */
.backdrop__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgb(6 10 20 / 0.62) 0%,
    rgb(6 10 20 / 0.48) 45%,
    rgb(6 10 20 / 0.62) 100%
  );
}

/* Pause control (WCAG 2.2.2). Fixed to the bottom corner so it is reachable
   from anywhere on the page, and it is a real button so it appears in the
   tab order and reads correctly to a screen reader. */
.motion-toggle {
  position: fixed;
  inset-block-end: var(--space-4);
  inset-inline-start: var(--space-4);
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.875rem;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: var(--radius-full);
  background: rgb(6 10 20 / 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e9edf5;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.motion-toggle[hidden] {
  display: none;
}

.motion-toggle:hover {
  background: rgb(6 10 20 / 0.95);
  border-color: rgb(224 168 60 / 0.6);
}

.motion-toggle__play {
  display: none;
}

.motion-toggle[data-stopped="true"] .motion-toggle__play {
  display: block;
}

.motion-toggle[data-stopped="true"] .motion-toggle__pause {
  display: none;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-gap);
}

/* A light panel over the backdrop. Separated from the footer so the video
   reads as a band between them rather than disappearing entirely. */
.sheet {
  position: relative;
  background: var(--sheet);
  backdrop-filter: blur(20px) saturate(115%);
  -webkit-backdrop-filter: blur(20px) saturate(115%);
  box-shadow: var(--shadow-lg);
}

.sheet + .sheet {
  margin-block-start: var(--sheet-gap);
}

/* Not `.sheet + .site-footer`: the footer is a sibling of <main>, not of the
   section inside it, so that adjacency never matched and the band was lost. */
.site-footer {
  margin-block-start: var(--sheet-gap);
}

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-5);
  background: #e0a83c;
  color: var(--navy-950);
  border-radius: var(--radius);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--duration) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-hero);
  font-weight: 700;
}

h2 {
  font-size: var(--text-h2);
}

h3 {
  font-size: var(--text-h3);
  line-height: var(--leading-snug);
}

p {
  text-wrap: pretty;
}

a {
  color: var(--support);
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

.lead {
  font-size: var(--text-lead);
  color: var(--text);
}

/* Section headers -------------------------------------------------------- */

.section-head {
  max-width: 60ch;
  margin-block-end: var(--space-7);
}

.section-head--flush {
  margin-block-end: 0;
}

.section-head__kicker {
  display: block;
  margin-block-end: var(--space-3);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.section-head p {
  margin-block-start: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-lead);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.875rem 1.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.btn--primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--btn-primary-bg-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn--block {
  inline-size: 100%;
  padding-block: 1rem;
  border-radius: var(--radius);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

/* --------------------------------------------------------------------------
   Header — dark while it floats over the hero, light once it sits on a sheet
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  border-block-end: 1px solid transparent;
  transition:
    background-color var(--duration) var(--ease-out),
    border-color var(--duration) var(--ease-out);
}

/* At the top the bar has no sheet under it, only video. Text-shadow alone
   is not measurable contrast, so carry a gradient of its own: white-ish
   text over a bright video frame is otherwise ~1.8:1. */
.site-header:not([data-scrolled="true"]) {
  background: linear-gradient(
    to bottom,
    rgb(4 8 16 / 0.75) 0%,
    rgb(4 8 16 / 0.4) 100%
  );
}

.site-header[data-scrolled="true"] {
  background: rgb(247 249 252 / 0.9);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border-block-end-color: var(--line);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  block-size: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text-strong);
}

.brand img {
  block-size: 2.5rem;
  inline-size: auto;
  transition: filter var(--duration) var(--ease-out);
}

/* The mark is drawn in navy: invert it only while the header is on the video. */
.site-header:not([data-scrolled="true"]) .brand img {
  filter: brightness(0) invert(1) drop-shadow(0 0 6px rgb(224 168 60 / 0.35));
}

.brand__name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-header:not([data-scrolled="true"]) .brand__name {
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.6);
}

/* --------------------------------------------------------------------------
   Hero — full-bleed statement over the live backdrop
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  display: grid;
  align-items: center;
  min-block-size: calc(100svh - 4.5rem);
  padding-block: var(--space-8) var(--space-7);
}

/* Text plate. The global scrim is not enough on its own: the video's bright
   data-wave sweeps through this area and drops the headline to ~1.8:1.
   Darkens the text side (right, in RTL) and leaves the lighthouse side open. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to left,
    rgb(4 8 16 / 0.86) 0%,
    rgb(4 8 16 / 0.7) 34%,
    rgb(4 8 16 / 0.28) 62%,
    transparent 82%
  );
  pointer-events: none;
}

.hero > .shell {
  position: relative;
  z-index: 1;
}

/* Sized in rem, not ch: `ch` here would resolve against the body font
   rather than the display-scale heading and wrap the tagline far too early. */
.hero__copy {
  max-width: min(46rem, 100%);
}

.hero__copy > * + * {
  margin-block-start: var(--space-5);
}

/* The two lead paragraphs are one thought each — keep them tighter to each
   other than to the heading and the promise line. */
.hero__copy .lead + .lead {
  margin-block-start: var(--space-4);
}

/* Opening line above the headline: tells a first-time visitor who is behind
   the site before they read anything else. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.eyebrow::before {
  content: "";
  inline-size: 0.5rem;
  block-size: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--accent-bright);
  box-shadow: 0 0 12px 2px rgb(224 168 60 / 0.7);
}

.hero h1 {
  text-shadow: 0 2px 30px rgb(0 0 0 / 0.55);
}

/* Block at every width: the accent clause is long enough to wrap, and left
   inline the gold would start mid-line and hide the comma break. */
.hero h1 .accent {
  display: block;
  color: var(--accent-bright);
  text-shadow: 0 0 40px rgb(224 168 60 / 0.45);
}

/* rem, not ch — `ch` resolves narrow against this font and left the lead
   as a tall column under a much wider headline. */
.hero .lead {
  max-width: min(38rem, 100%);
  text-shadow: 0 1px 16px rgb(0 0 0 / 0.6);
}

/* The promise and the CTA sit on one row: the button reads as the answer to
   the line beside it rather than as a detached block further down. */
.hero__promise {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4) var(--space-5);
}

/* Carries the weight the eyebrow used to: the one promise most likely to
   decide whether someone writes at all. */
.lead__strong {
  color: var(--accent-bright);
  font-family: var(--font-display);
  font-size: var(--text-lead);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 16px rgb(0 0 0 / 0.6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* The hero CTA is a sentence, not a label — it has to be able to wrap. */
.hero__actions .btn {
  white-space: normal;
  text-align: center;
}

/* Scroll cue ------------------------------------------------------------- */

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-block-start: var(--space-7);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.scroll-cue svg {
  animation: nudge 2.4s var(--ease-out) infinite;
}

.scroll-cue:hover {
  color: var(--accent-bright);
}

@keyframes nudge {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(4px); }
}

/* --------------------------------------------------------------------------
   Moments — a static grid of quotes. Everything is visible at once: no
   sideways scrolling, no arrows, and nothing that moves on its own.
   Six cards → three columns in two rows on desktop.
   -------------------------------------------------------------------------- */

.moments__grid {
  display: grid;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.moment {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent-bright);
  border-radius: var(--radius-lg);
}

.moment__quote {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 500;
  line-height: var(--leading-snug);
  text-wrap: pretty;
}

.moment__quote::before {
  content: "״";
  display: block;
  color: var(--accent);
  font-size: 1.5em;
  line-height: 0.9;
}

.moment__role {
  margin-block-start: auto;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Contact — the point of the page
   -------------------------------------------------------------------------- */

/* Everything above leads here, so the sheet gets one gold marker. */
.contact::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  block-size: 2px;
  background: linear-gradient(
    to inline-end,
    transparent,
    var(--accent-bright),
    transparent
  );
}

.contact__panel {
  display: grid;
  gap: clamp(2rem, 1rem + 4vw, 3.5rem);
}

.form {
  display: grid;
  gap: var(--space-4);
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.field {
  display: grid;
  gap: var(--space-2);
}

.field label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
}

.field__optional {
  margin-inline-start: var(--space-2);
  color: var(--text-muted);
  font-weight: 400;
}

.field input,
.field textarea {
  inline-size: 100%;
  padding: 0.8125rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  color: var(--text-strong);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #8b95a8;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  background: var(--surface-raised);
  border-color: var(--support);
  box-shadow: 0 0 0 3px rgb(0 105 92 / 0.18);
}

.field textarea {
  resize: vertical;
  min-block-size: 7rem;
}

.field__error {
  color: #b3261e;
  font-size: var(--text-xs);
  font-weight: 600;
}

.field__error:empty {
  display: none;
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: #b3261e;
}

/* Honeypot — off-screen but reachable by bots. */
.hp {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form__note {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.form__status {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
}

.form__status:empty {
  display: none;
}

.form__status[data-state="success"] {
  background: var(--support-soft);
  border: 1px solid var(--support-line);
  color: var(--support-strong);
}

.form__status[data-state="error"] {
  background: #fdeceb;
  border: 1px solid #f3bdb8;
  color: #8c1d18;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  padding-block: var(--space-7);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-6);
}

.site-footer__brand img {
  block-size: 3.5rem;
  inline-size: auto;
  margin-block-end: var(--space-4);
}

.site-footer__brand p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 40ch;
}

.footer-nav {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.footer-nav h2 {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.footer-nav a {
  color: var(--text);
  font-size: var(--text-sm);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--support);
  text-decoration: underline;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  margin-block-start: var(--space-6);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--line);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

/* --------------------------------------------------------------------------
   Breakpoints
   -------------------------------------------------------------------------- */

/* Narrow screens: the copy spans the full width, so darken the whole plate
   rather than only the text side. */
@media (max-width: 47.999rem) {
  .hero::before {
    background: linear-gradient(
      to bottom,
      rgb(4 8 16 / 0.6) 0%,
      rgb(4 8 16 / 0.8) 45%,
      rgb(4 8 16 / 0.6) 100%
    );
  }
}

@media (min-width: 48rem) {
  .moments__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer__grid {
    grid-template-columns: 2fr 1fr;
    gap: var(--space-7);
  }
}

@media (min-width: 64rem) {
  /* Six cards as three columns → exactly two rows. */
  .moments__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .contact__panel {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
  }
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
