/* Shared by every page on lomeda.app: tokens, base type, header, footer.
   Page-specific styles stay inline in each page. */

/* Rehov "night street" tokens — kept in step by hand with
   core/ui/src/commonMain/kotlin/com/lomeda/app/core/ui/theme/Color.kt
   (RehovDarkColors). */
:root {
  --bg-app: #0F1320;
  --surface-card: rgba(22, 28, 46, .72);
  --card-border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .16);
  --text-primary: #F4EFE6;
  --text-secondary: #9BA3B8;
  --text-muted: #6F7794;
  --text-soft: #C7CCDA;
  --accent: #F0A340;
  --accent-soft: #FFD9A0;
  --state-error: #F26D5E;
  --on-accent: #241300;
  --font-ui: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: clamp(20px, 5vw, 32px);
  --measure: 24ch;      /* headline measure */
  --measure-body: 58ch; /* body measure */

  /* Section rhythm. Sections size to their content — nothing on this page is
     a viewport-height slide. Each section pads half the gap on each side, so
     two neighbours meet at one full gap, not two. */
  --section: clamp(36px, 4.5vw, 64px);
  --section-compact: clamp(24px, 3vw, 40px);
  --split-gap: clamp(36px, 5vw, 80px);

  /* Portrait app captures are 1080 × 2340 (≈ 1 : 2.17), so the phone's width
     sets its height. Width is the one knob; never set both. */
  --phone-w: 370px;
  --screen-ratio: 1080 / 2340;

  --ease-out: cubic-bezier(.16, .84, .34, 1);
  --scroll: 0; /* 0 → 1 across the page, written by JS for the lamp drift */
}

* { box-sizing: border-box; }
/* clip, not hidden: the fixed lamp glow is wider than a phone, and body's
   overflow-x does not reach fixed elements. */
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap {
  width: min(1160px, 100%);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

h1, h2 { line-height: 1.1; letter-spacing: -.025em; margin: 0; font-weight: 600; }
h1 { font-size: clamp(2.15rem, 1.1rem + 3.2vw, 3.6rem); font-weight: 700; max-width: var(--measure); }
h2 { font-size: clamp(1.75rem, 1.1rem + 2.3vw, 2.75rem); max-width: var(--measure); }
p { margin: 0; max-width: var(--measure-body); }

.lede {
  margin-top: clamp(18px, 2.4vw, 26px);
  font-size: clamp(1.06rem, .98rem + .5vw, 1.3rem);
  color: var(--text-soft);
}
.body { margin-top: clamp(16px, 2.2vw, 24px); color: var(--text-secondary); }
.body + .body { margin-top: 14px; }

.eyebrow {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow + h1, .eyebrow + h2 { margin-top: 16px; }

/* ---------- header ----------
   The wordmark goes home; the menu sits inline on wide screens and folds
   behind a toggle on narrow ones. Without JavaScript the toggle is hidden
   and the links simply wrap under the wordmark. */
header {
  position: relative;
  z-index: 10;
  padding-block: clamp(20px, 3vw, 28px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}
.wordmark {
  font-size: clamp(1.35rem, 1.2rem + .7vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -.02em;
  color: inherit;
  text-decoration: none;
  /* A Latin name: its full stop stays after it on a right-to-left page. */
  direction: ltr;
  unicode-bidi: isolate;
}
.wordmark .dot { color: var(--accent); }
a.wordmark:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 4px; border-radius: 6px; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Plain text links. The underline grows from the start edge on hover and
   stays drawn under the current page. */
.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: .95rem;
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
  transition: color 200ms var(--ease-out);
}
.site-nav a::after {
  content: "";
  position: absolute;
  inset-inline: 12px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 320ms var(--ease-out);
}
html[dir="rtl"] .site-nav a::after { transform-origin: right center; }
.site-nav a:hover { color: var(--text-primary); }
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--text-primary); }
.site-nav a:focus-visible,
.icon-btn:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 10px; }

/* Desktop: the links drift in one after another on first paint. */
@keyframes nav-in {
  from { opacity: 0; transform: translate3d(0, -6px, 0); }
  to { opacity: 1; transform: none; }
}
@media (min-width: 860px) {
  .js .site-nav li { animation: nav-in 600ms var(--ease-out) both; }
  .js .site-nav li:nth-child(2) { animation-delay: 60ms; }
  .js .site-nav li:nth-child(3) { animation-delay: 120ms; }
  .js .site-nav li:nth-child(4) { animation-delay: 180ms; }
  .js .header-tools .lang { animation: nav-in 600ms var(--ease-out) 240ms both; }
}

/* A round header control: the menu toggle and the language button share it. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  color: var(--text-primary);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 160ms var(--ease-out), border-color 160ms var(--ease-out);
}
.icon-btn:hover { background: rgba(255, 255, 255, .09); }
.icon-btn[aria-expanded="true"] { border-color: var(--accent); }
.icon-btn svg { flex: none; width: 18px; height: 18px; }

/* ---------- language ----------
   A globe and the current code; the list drops below it, aligned to the end
   of the header so it never runs off a narrow screen. It needs JavaScript to
   do anything, so without it the control is not shown at all. */
.i18n-pending body { visibility: hidden; }
.no-js .lang { display: none; }
.lang { position: relative; }
.lang-code { font-size: .82rem; font-weight: 600; letter-spacing: .06em; }
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  min-width: 12rem;
  max-width: calc(100vw - 2 * var(--gutter));
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: #151A2A;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
}

/* ---------- drop-down panels: the language list and the folded menu ----------
   Both stay in the layout and animate between closed and open: the panel
   fades and unfolds from the corner of the control that opened it, then its
   items follow one by one. Closed panels are inert, so they take no focus. */
.lang-menu {
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -8px, 0) scale(.96);
  transform-origin: top right;
  transition:
    opacity 180ms ease,
    transform 260ms var(--ease-out),
    visibility 0s linear 260ms;
}
html[dir="rtl"] .lang-menu { transform-origin: top left; }
.lang-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 220ms ease,
    transform 420ms var(--ease-out),
    visibility 0s;
}
.lang-menu > li {
  opacity: 0;
  transform: translate3d(0, -6px, 0);
  transition: opacity 160ms ease, transform 160ms ease;
}
.lang-menu.is-open > li {
  opacity: 1;
  transform: none;
  transition: opacity 320ms ease, transform 420ms var(--ease-out);
  transition-delay: 60ms;
}
.lang-menu.is-open > li:nth-child(2) { transition-delay: 95ms; }
.lang-menu.is-open > li:nth-child(3) { transition-delay: 130ms; }
.lang-menu.is-open > li:nth-child(4) { transition-delay: 165ms; }
.lang-menu.is-open > li:nth-child(5) { transition-delay: 200ms; }
.lang-menu.is-open > li:nth-child(6) { transition-delay: 235ms; }
.lang-menu.is-open > li:nth-child(7) { transition-delay: 270ms; }
.lang-menu.is-open > li:nth-child(8) { transition-delay: 305ms; }

.lang-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: .98rem;
  line-height: 1.25;
  text-align: start;
  cursor: pointer;
}
.lang-menu button:hover { background: rgba(255, 255, 255, .06); color: var(--text-primary); }
.lang-menu button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: -2px; }
.lang-menu button[aria-current="true"] { color: var(--text-primary); font-weight: 500; }
.lang-menu button[aria-current="true"]::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* The toggle's three bars fold into a cross. */
.menu-toggle { display: none; padding: 8px; }
.burger, .burger::before, .burger::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 320ms var(--ease-out), background 120ms ease;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { transform: translateY(-6px); }
.burger::after { transform: translateY(6px); }
.menu-toggle[aria-expanded="true"] .burger { background: transparent; }
.menu-toggle[aria-expanded="true"] .burger::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .burger::after { transform: rotate(-45deg); }

@media (max-width: 859px) {
  .js .menu-toggle { display: inline-flex; }
  /* The folded menu drops below the header as one panel spanning the gutter:
     a plain list, one row per link, divided by hairlines. */
  .js .site-nav {
    position: absolute;
    top: 100%;
    inset-inline: var(--gutter);
    padding: 6px 18px;
    border: 1px solid var(--card-border);
    border-radius: 22px;
    background: #151A2A;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .9);
  }
  .js .site-nav {
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, -8px, 0) scale(.96);
    transform-origin: top right;
    transition:
      opacity 180ms ease,
      transform 260ms var(--ease-out),
      visibility 0s linear 260ms;
  }
  html.js[dir="rtl"] .site-nav { transform-origin: top left; }
  .js .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition:
      opacity 220ms ease,
      transform 420ms var(--ease-out),
      visibility 0s;
  }
  .js .site-nav li {
    opacity: 0;
    transform: translate3d(0, -6px, 0);
    transition: opacity 160ms ease, transform 160ms ease;
  }
  .js .site-nav.is-open li {
    opacity: 1;
    transform: none;
    transition: opacity 320ms ease, transform 420ms var(--ease-out);
    transition-delay: 60ms;
  }
  .js .site-nav.is-open li:nth-child(2) { transition-delay: 95ms; }
  .js .site-nav.is-open li:nth-child(3) { transition-delay: 130ms; }
  .js .site-nav.is-open li:nth-child(4) { transition-delay: 165ms; }
  .js .site-nav.is-open li:nth-child(5) { transition-delay: 200ms; }
  .js .site-nav.is-open li:nth-child(6) { transition-delay: 235ms; }
  .js .site-nav.is-open li:nth-child(7) { transition-delay: 270ms; }
  .js .site-nav.is-open li:nth-child(8) { transition-delay: 305ms; }
  .js .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .js .site-nav li + li { border-top: 1px solid var(--card-border); }
  .js .site-nav a { display: flex; width: 100%; min-height: 52px; padding: 14px 2px; font-size: 1.05rem; }
  .js .site-nav a::after { inset-inline: 2px auto; bottom: 12px; width: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .lang-menu, .lang-menu > li, .js .site-nav, .js .site-nav li {
    transform: none !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
  .js .site-nav li, .js .header-tools .lang { animation: none; }
  .burger, .burger::before, .burger::after, .site-nav a::after { transition: none; }
}

/* The honeypot and the input labels: present for a screen reader and for a
   bot, absent for everyone else. Never display:none — that is the one thing
   a form-filling script checks. */
.offscreen {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- footer ---------- */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--card-border);
  padding-block: clamp(26px, 3.5vw, 36px) clamp(32px, 4.5vw, 48px);
}
.footer-row {
  display: flex; flex-wrap: wrap; gap: 16px 32px;
  align-items: baseline; justify-content: space-between;
}
.footer-row p { color: var(--text-muted); font-size: .9rem; }
.footer-links {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  margin: 0; padding: 0; list-style: none;
}
.footer-links a {
  color: var(--text-secondary);
  font-size: .9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 2px;
}
.footer-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.footer-links a:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

/* ---------- legal pages ----------
   Long-form reading: one narrow column, numbered sections, a contents list
   that wraps rather than scrolls sideways. */
.legal { position: relative; z-index: 1; padding-block: clamp(12px, 3vw, 32px) clamp(48px, 7vw, 96px); }
.legal-doc { width: min(820px, 100%); }
.legal-doc h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); max-width: none; overflow-wrap: anywhere; hyphens: auto; }
.legal-meta { margin-top: 14px; color: var(--text-muted); font-size: .95rem; }
.legal-intro { margin-top: clamp(20px, 3vw, 28px); color: var(--text-soft); }
.legal-doc p, .legal-doc ul { max-width: none; }
.legal-toc {
  margin: clamp(28px, 4vw, 40px) 0 0;
  padding: clamp(18px, 2.6vw, 24px) clamp(20px, 3vw, 28px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--surface-card);
}
.legal-toc ol { margin: 10px 0 0; padding-inline-start: 1.4em; columns: 2 16rem; column-gap: 32px; }
.legal-toc li { padding-block: 3px; break-inside: avoid; color: var(--text-muted); }
.legal-toc a { color: var(--text-secondary); text-decoration: none; }
.legal-toc a:hover { color: var(--accent); }
.legal-doc section { margin-top: clamp(36px, 5vw, 52px); scroll-margin-top: 24px; }
.legal-doc h2 {
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem);
  max-width: none;
  letter-spacing: -.015em;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.legal-doc h3 { margin: 24px 0 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.legal-doc section p,
.legal-doc section ul { margin: 12px 0 0; color: var(--text-secondary); }
.legal-doc section ul { padding-inline-start: 1.3em; }
.legal-doc section li { margin-top: 6px; }
.legal-doc section li::marker { color: var(--accent); }
.legal-doc strong { color: var(--text-soft); font-weight: 500; }
.legal-doc a:not(.toc-link) { color: var(--accent-soft); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.legal-doc a:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 4px; }
.table-scroll { margin-top: 14px; overflow-x: auto; border: 1px solid var(--card-border); border-radius: 16px; }
.legal-doc table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.legal-doc th, .legal-doc td { padding: 12px 16px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--card-border); }
.legal-doc tr:last-child td { border-bottom: 0; }
.legal-doc th { color: var(--text-soft); font-weight: 500; background: rgba(255, 255, 255, .03); }
.legal-doc td { color: var(--text-secondary); }
/* Narrow screens: each row becomes a small card — its first cell as the
   title and the second beneath it — instead of a table scrolled sideways. */
@media (max-width: 599px) {
  .legal-doc thead { display: none; }
  .legal-doc tr, .legal-doc td { display: block; }
  .legal-doc tr { padding: 14px 16px; border-bottom: 1px solid var(--card-border); }
  .legal-doc tr:last-child { border-bottom: 0; }
  .legal-doc td { padding: 0; border: 0; }
  .legal-doc td:first-child { color: var(--text-soft); font-weight: 500; }
  .legal-doc td + td { margin-top: 4px; }
}

/* ---------- right-to-left (Hebrew) ----------
   Layout already uses logical properties, so the page mirrors on its own.
   Latin tracking looks broken on Hebrew letters, and an email address is
   always written left to right. */
html[lang="he"] .eyebrow { letter-spacing: .04em; }
html[lang="he"] h1, html[lang="he"] h2 { letter-spacing: 0; }
input[type="email"] { direction: ltr; }
html[dir="rtl"] input[type="email"] { text-align: right; }
