/* Shared stylesheet for the crawlable content pages (/how-it-works/, /science/*,
   /guides/*, /vocabulary/*). Same candy-bright palette as the homepage - the
   variables below mirror site/index.html's :root, which in turn mirrors
   app/lib/theme.dart. Keep the three in sync.

   Deliberate constraints: no build step, no external dependency, no JavaScript.
   Everything on these pages has to work with scripting off, because that is the
   state a crawler and a slow phone both see. Interactivity is <details>/<summary>
   and <audio controls>, which the browser gives us for free. */

@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/varela-round-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: 'Varela Round';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/varela-round-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #E8F6FF;
  --paper-deep: #CDEAFB;
  --card: #FFFFFF;
  --ink: #2B2140;
  --ink-soft: #6B5E8C;
  --navy: #3A2E6B;
  --sunshine: #FFC61A;
  --sunshine-dark: #E09B00;
  --star-gold: #FFE14D;
  --correct: #2ED573;
  --sky: #2BB3FF;
  --purple: #A97BF2;
  --terracotta: #FF8A3D;
  --bubblegum: #FF5FA2;
  --plum: #B84A78;
  --wobble-a: 255px 25px 225px 25px / 25px 225px 25px 255px;
  --wobble-b: 25px 225px 25px 255px / 255px 25px 225px 25px;
  --ink-shadow: 5px 6px 0 rgba(43, 33, 64, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: 'Varela Round', 'Arial Rounded MT Bold', sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

.wrap { width: min(880px, calc(100% - 36px)); margin-inline: auto; }

a { color: var(--navy); }
a:hover { color: var(--plum); }
a:focus-visible, summary:focus-visible, audio:focus-visible {
  outline: 3px solid var(--sunshine-dark);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 20;
  background: var(--sunshine);
  color: var(--ink);
  padding: 10px 18px;
  border: 3px solid var(--ink);
  border-radius: 0 0 14px 14px;
  text-decoration: none;
  font-weight: bold;
}
.skip-link:focus { inset-inline-start: 12px; }

/* ---------- header + nav ---------- */

header.site {
  background: var(--card);
  border-bottom: 3px solid var(--ink);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 10px 22px;
  flex-wrap: wrap;
  padding: 12px 0;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--navy);
  text-decoration: none;
  margin-inline-end: auto;
}
.logo img { display: block; width: 52px; height: 52px; flex: 0 0 auto; }
.logo small { font-size: 0.72rem; color: var(--ink-soft); }
.nav-menu > nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
header.site nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 4px 2px;
  border-bottom: 3px solid transparent;
}
header.site nav a:hover,
header.site nav a[aria-current="page"] {
  border-bottom-color: var(--sunshine);
  color: var(--navy);
}
.nav-menu { position: relative; }
.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}
.nav-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  list-style: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.menu-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 3px;
  background: var(--ink);
}
.menu-icon { position: relative; }
.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  inset-inline-start: 0;
}
.menu-icon::before { top: -7px; }
.menu-icon::after { top: 7px; }
.nav-toggle:checked + .nav-button .menu-icon { background: transparent; }
.nav-toggle:checked + .nav-button .menu-icon::before { top: 0; transform: rotate(45deg); }
.nav-toggle:checked + .nav-button .menu-icon::after { top: 0; transform: rotate(-45deg); }
@media (max-width: 640px) {
  .header-inner { flex-wrap: nowrap; padding-inline: 16px; }
  .logo img { width: 44px; height: 44px; }
  .nav-button { display: flex; }
  .nav-menu > nav {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    inset-inline-end: 0;
    z-index: 11;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: min(240px, calc(100vw - 48px));
    padding: 8px;
    background: var(--card);
    border: 3px solid var(--ink);
    border-radius: 16px;
    box-shadow: var(--ink-shadow);
  }
  .nav-toggle:checked ~ nav { display: flex; }
  header.site nav a { padding: 9px 12px; border-bottom: 3px solid transparent; border-radius: 12px; }
}

/* ---------- breadcrumbs ---------- */

.crumbs {
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding: 18px 0 0;
}
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li::after { content: '‹'; margin-inline-start: 6px; color: var(--ink-soft); }
.crumbs li:last-child::after { content: ''; }
.crumbs a { color: var(--ink-soft); }

/* ---------- typography ---------- */

main { padding-bottom: 56px; }

h1 {
  font-size: clamp(1.85rem, 5.4vw, 2.75rem);
  line-height: 1.22;
  color: var(--navy);
  margin: 18px 0 14px;
}
h2 {
  font-size: clamp(1.35rem, 3.6vw, 1.75rem);
  line-height: 1.3;
  color: var(--navy);
  margin: 42px 0 12px;
}
h3 { font-size: 1.15rem; color: var(--navy); margin: 26px 0 8px; }
p { margin: 0 0 16px; }
.lead { font-size: 1.12rem; color: var(--ink); margin-bottom: 22px; }
ul, ol { margin: 0 0 18px; padding-inline-start: 24px; }
li { margin-bottom: 8px; }
strong { color: var(--navy); }
:lang(en) { unicode-bidi: isolate; }

.note {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--wobble-a);
  padding: 18px 22px;
  margin: 26px 0;
  box-shadow: var(--ink-shadow);
}
.note p:last-child { margin-bottom: 0; }

.caveat {
  background: var(--paper-deep);
  border-inline-start: 6px solid var(--sky);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 24px 0;
  font-size: 0.97rem;
  color: var(--ink);
}
.caveat p:last-child { margin-bottom: 0; }

.about-photo { margin: 28px 0; }
.about-photo img {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--ink);
  border-radius: var(--wobble-a);
  box-shadow: var(--ink-shadow);
}
.about-photo figcaption {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  text-align: center;
}

/* ---------- citations ---------- */

.refs { font-size: 0.95rem; }
.refs li { margin-bottom: 12px; }
.refs a { word-break: break-word; }

/* ---------- word entries ---------- */

.words { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 20px; }
@media (min-width: 720px) { .words { grid-template-columns: 1fr 1fr; } }

.word {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--wobble-a);
  box-shadow: var(--ink-shadow);
  padding: 20px 22px;
  margin: 0;
}
.words > .word:nth-child(even) { border-radius: var(--wobble-b); }

.word img {
  display: block;
  width: 132px;
  height: 132px;
  margin: 0 auto 10px;
  object-fit: contain;
}
.word-anchor {
  display: block;
  text-align: center;
  font-size: 2.1rem;
  line-height: 1.3;
  color: var(--plum);
  margin: 6px auto 12px;
}
.word h3 { margin: 0 0 2px; font-size: 1.5rem; }
.word h3 .he { display: block; font-size: 1.05rem; color: var(--ink-soft); }
.word .sense { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 10px; }
.word .example { margin-bottom: 10px; }
.word .example .en { display: block; }
.word .example .he { display: block; color: var(--ink-soft); }
.word audio { width: 100%; max-width: 320px; margin-top: 6px; }
.word .listen-label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ---------- exercises ---------- */

details {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 4px 20px;
  margin: 0 0 16px;
}
summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--navy);
  padding: 14px 0;
  list-style-position: inside;
}
details[open] summary { border-bottom: 2px dashed var(--paper-deep); margin-bottom: 12px; }
details > :last-child { margin-bottom: 14px; }

.pairs { list-style: none; padding: 0; }
.pairs li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 2px dotted var(--paper-deep);
  padding: 6px 0;
}
.pairs li:last-child { border-bottom: 0; }

/* ---------- card links ---------- */

.cards { list-style: none; padding: 0; display: grid; gap: 16px; margin: 22px 0; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.cards li { margin: 0; }
.cards a {
  display: block;
  height: 100%;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--wobble-b);
  box-shadow: var(--ink-shadow);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.16s ease;
}
.cards li:nth-child(odd) a { border-radius: var(--wobble-a); }
.cards a:hover { transform: translateY(-4px) rotate(-0.5deg); }
.cards a strong { display: block; color: var(--navy); font-size: 1.1rem; margin-bottom: 4px; }
.cards a span { color: var(--ink-soft); font-size: 0.95rem; }
@media (prefers-reduced-motion: reduce) { .cards a { transition: none; } .cards a:hover { transform: none; } }

.btn {
  display: inline-block;
  background: var(--sunshine);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 12px 26px;
  font: inherit;
  font-weight: bold;
  text-decoration: none;
  box-shadow: var(--ink-shadow);
}
.btn:hover { background: var(--star-gold); color: var(--ink); }

.btn.drawably-host {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  --drawably-stroke: var(--ink);
  --drawably-fill: var(--sunshine);
}
.btn.drawably-host:hover {
  --drawably-fill: var(--star-gold);
}

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

footer.site {
  background: var(--card);
  border-top: 3px solid var(--ink);
  padding: 22px 0 30px;
  font-size: 0.95rem;
}
footer.site .footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
footer.site p { color: var(--ink-soft); margin-bottom: 8px; }
footer.site p:last-child { margin-bottom: 0; }
