/* ============================================================
   ספרדית לדוברי עברית — גיליון סגנון משותף
   השראה: אריחי אזולז'ו ספרדיים — כחול קובלט, אוכרה של שמש
   ============================================================ */

:root {
  --ink:         #17233b;
  --paper:       #fbf9f4;
  --card:        #ffffff;
  --azulejo:     #1f5aa6;
  --header-bg:   #1f5aa6;
  --azulejo-dark:#17457f;
  --tile-tint:   #e9f0f9;
  --ochre:       #e0a220;
  --ochre-soft:  #f6ead0;
  --rojo:        #c0392b;
  --line:        #e6e0d3;
  --muted:       #5d6472;

  --serif: 'Frank Ruhl Libre', Georgia, 'Times New Roman', serif;
  --sans:  'Assistant', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --wrap: 760px;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  /* עדין: מרקם אריחים ברקע */
  background-image:
    linear-gradient(0deg, rgba(31,90,166,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,90,166,0.025) 1px, transparent 1px);
  background-size: 26px 26px;
  line-height: 1.75;
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- כותרת עליונה ---------- */
.site-header {
  background: var(--header-bg);
  color: #fff;
  border-bottom: 4px solid var(--ochre);
}
.site-header .bar {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.2px;
}
.brand span { color: var(--ochre); }
.site-nav {
  display: flex;
  gap: 18px;
  font-size: 0.98rem;
}
.site-nav a {
  color: #dbe6f5;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--ochre);
}

/* ---------- מעטפת ראשית ---------- */
main {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 34px 20px 60px;
}

/* ---------- פירורי לחם + תג שיעור ---------- */
.crumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
}
.crumbs a { color: var(--azulejo); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

.lesson-head {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 8px;
}
.tile {
  flex: 0 0 auto;
  width: 62px;
  height: 62px;
  background: var(--azulejo);
  color: #fff;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.35),
              inset 0 0 0 4px var(--azulejo);
}
.tile.small { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 9px; }

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.25;
  margin: 0;
}
.subtitle {
  color: var(--muted);
  margin: 4px 0 30px;
  font-size: 1.05rem;
}

h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  margin: 40px 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
h2 .eyebrow {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ochre);
  text-transform: uppercase;
  margin-bottom: 2px;
}
h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 26px 0 6px;
}

p { margin: 12px 0; }
ul, ol { margin: 12px 0; padding-inline-start: 24px; }
li { margin: 6px 0; }

a { color: var(--azulejo-dark); }

/* ---------- מילים בספרדית (LTR מבודד) ---------- */
.es {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 600;
  color: var(--azulejo-dark);
}
.pron { color: var(--muted); }           /* תעתיק הגייה בעברית */
.rojo { color: var(--rojo); font-weight: 700; }

/* ---------- קופסאות תוכן ---------- */
.box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 18px 0;
}
.note {
  background: var(--tile-tint);
  border: 1px solid #cfe0f2;
  border-inline-start: 5px solid var(--azulejo);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
}
.note strong { color: var(--azulejo-dark); }
.tip {
  background: var(--ochre-soft);
  border: 1px solid #ecd7a6;
  border-inline-start: 5px solid var(--ochre);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
}

/* ---------- טבלת אוצר מילים ---------- */
.vocab {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.vocab th {
  background: var(--azulejo);
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  padding: 10px 14px;
  text-align: start;
  font-size: 0.95rem;
}
.vocab td {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.vocab tr:nth-child(even) td { background: var(--tile-tint); }
.vocab td.es-cell {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  font-weight: 600;
  color: var(--azulejo-dark);
  white-space: nowrap;
}
.vocab td.pron-cell {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- תרגילים ---------- */
.exercise { counter-reset: q; }
.exercise ol { list-style: none; padding-inline-start: 0; }
.exercise > ol > li {
  counter-increment: q;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px 14px 18px;
  margin: 12px 0;
  position: relative;
  padding-inline-start: 52px;
}
.exercise > ol > li::before {
  content: counter(q);
  position: absolute;
  inset-inline-start: 14px;
  top: 13px;
  width: 26px; height: 26px;
  background: var(--tile-tint);
  color: var(--azulejo-dark);
  border-radius: 7px;
  font-weight: 700;
  font-size: 0.9rem;
  display: grid; place-items: center;
}
.answer {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--ochre-soft);
  border-radius: 8px;
  font-size: 0.97rem;
}
.answer::before { content: "תשובה: "; font-weight: 700; color: var(--azulejo-dark); }
.exercise.reveal .answer { display: block; }

.reveal-btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--azulejo);
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  margin-top: 6px;
}
.reveal-btn:hover { background: var(--azulejo-dark); }
.reveal-btn:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

/* ---------- ניווט בין שיעורים ---------- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 2px solid var(--line);
}
.lesson-nav a {
  text-decoration: none;
  color: var(--azulejo-dark);
  font-weight: 700;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.lesson-nav a:hover { border-color: var(--azulejo); background: var(--tile-tint); }
.lesson-nav .spacer { flex: 1; }

/* ---------- רשימת שיעורים (עמוד הבית) ---------- */
.intro-lead {
  font-size: 1.12rem;
  color: var(--ink);
}
.lesson-list { list-style: none; padding: 0; margin: 28px 0 0; }
.lesson-list li { margin: 0 0 14px; }
.lesson-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.lesson-card:hover {
  border-color: var(--azulejo);
  transform: translateX(-4px);
  box-shadow: 0 6px 18px rgba(31,90,166,0.10);
}
.lesson-card .lc-body { flex: 1; }
.lesson-card .lc-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--azulejo-dark);
}
.lesson-card .lc-desc { color: var(--muted); font-size: 0.98rem; margin-top: 2px; }
.lesson-card.soon { opacity: 0.6; cursor: default; pointer-events: none; }
.lesson-card.soon .lc-title::after {
  content: "בקרוב";
  font-family: var(--sans);
  font-size: 0.7rem;
  background: var(--ochre-soft);
  color: var(--ochre);
  padding: 2px 8px;
  border-radius: 20px;
  margin-inline-start: 8px;
  vertical-align: middle;
}
.section-label {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ochre);
  margin: 34px 0 6px;
}

/* ---------- כותרת תחתונה ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .bar {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px 20px;
  text-align: center;
}
.site-footer .brand { color: var(--azulejo-dark); font-size: 1.1rem; }

/* ---------- רספונסיביות ---------- */
@media (max-width: 560px) {
  body { font-size: 17px; }
  h1 { font-size: 1.6rem; }
  .tile { width: 52px; height: 52px; font-size: 1.4rem; }
  .site-nav { gap: 12px; font-size: 0.9rem; }
  .vocab th, .vocab td { padding: 8px 10px; }
  .lesson-nav { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; transition: none !important; }
  .lesson-card:hover { transform: none; }
}

.spk{border:none;background:var(--tile-tint);color:var(--azulejo-dark);border-radius:50%;width:24px;height:24px;font-size:.72rem;cursor:pointer;vertical-align:middle;margin-inline-start:5px;padding:0}
.spk:hover{filter:brightness(1.1)}

/* Dark mode. This sheet carries its own palette, and until the course moved
   into pairs/ it was never in tools/verify/theme.mjs — so the links stayed
   #17457f on a dark ground, 1.4:1. Written twice on purpose: the attribute
   block for the header's switch, the media query for a dark OS, and the media
   query narrowed to :not([data-theme="light"]) so choosing light on a dark OS
   still wins. A block that only listens to the media query leaves the page
   half-dark, which is exactly how the Chinese section used to behave. */
:root[data-theme="dark"] {
  --ink:         #e8e6e1;
  --paper:       #191917;
  --card:        #222220;
  --azulejo:     #8ab4e8;
  --azulejo-dark:#a8c8f0;
  --header-bg:   #17273f;
  --tile-tint:   #1e2733;
  --ochre:       #e6b752;
  --ochre-soft:  #2c2519;
  --rojo:        #e8897d;
  --line:        #34332f;
  --muted:       #a8a49b;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
  --ink:         #e8e6e1;
  --paper:       #191917;
  --card:        #222220;
  --azulejo:     #8ab4e8;
  --azulejo-dark:#a8c8f0;
  --header-bg:   #17273f;
  --tile-tint:   #1e2733;
  --ochre:       #e6b752;
  --ochre-soft:  #2c2519;
  --rojo:        #e8897d;
  --line:        #34332f;
  --muted:       #a8a49b;
}
}

/* lf-course-toc */
/* minmax(0,1fr) and not 1fr: an `auto` minimum means the track cannot be
   narrower than its content's min-content width, so one wide vocabulary table
   inside <main> stretched the whole column — and the sidebar with it — to
   664px on a 390px screen. The table scrolls in its own box below; this is
   what lets the track ignore it. */
.course-layout{display:grid;gap:26px;align-items:start;
 grid-template-columns:minmax(0,1fr);max-width:calc(var(--wrap) + 300px);margin:0 auto;padding:0 18px}
.course-layout > main{max-width:var(--wrap);min-width:0;padding-inline:0;margin:0}
.course-toc{background:var(--card);border:1px solid var(--line);border-radius:14px;
 overflow:hidden;box-shadow:0 2px 10px rgba(24,40,74,.06)}
.course-toc .ct-h{font-weight:800;font-size:.95rem;color:var(--azulejo-dark);
 padding:13px 16px 10px;border-bottom:1px solid var(--line)}
.course-toc a{display:block;padding:10px 16px;border-bottom:1px solid var(--line);
 text-decoration:none;color:var(--ink);font-size:.9rem;line-height:1.4;
 transition:background .12s}
.course-toc a:last-child{border-bottom:none}
.course-toc a:hover{background:var(--ochre-soft)}
.course-toc a[aria-current="page"]{background:var(--azulejo);color:#fff;font-weight:700}
.course-toc a .n{display:inline-block;min-width:1.6em;font-weight:800;color:var(--ochre)}
.course-toc a[aria-current="page"] .n{color:#ffe4a8}
/* On a narrow screen the list follows the lesson instead of pushing it down.
   Someone who has just finished a lesson is exactly who wants the next one,
   so it is moved rather than hidden. */
@media (min-width:980px){
  .course-layout{grid-template-columns:266px minmax(0,1fr)}
  .course-toc{position:sticky;top:12px;max-height:calc(100vh - 24px);overflow-y:auto}
}
@media (max-width:979px){
  .course-layout > main{order:1}
  .course-toc{order:2;margin-bottom:28px}
}
/* A vocabulary table with four columns is wider than a phone, and it was
   taking the whole document sideways with it — measured before any of this
   was added: 53px over on cafe-and-restaurant, 97 on present-perfect, 294 on
   six-cases-and-adjectives. The table scrolls inside its own box now; the
   page does not. */
@media (max-width:640px){
  main table{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch}
}
