/* ═══════════════ HOME PAGE ═══════════════
   Editorial homepage layout. Colours come from tokens.css so light and
   dark themes work; dark bands reuse the header tokens (espresso in
   light mode, deep brown in dark mode) so they stay dark in both. */

/* ─── Hero ───
   Two tiers on one background: a centred title + search, then the
   word-of-the-day card between two ad slots, so both ads sit in the
   first screen without crowding the title. */
.home-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--paper) 0%, var(--marble) 100%);
}
.home-hero::before {
  content: "æ";
  position: absolute;
  right: max(3vw, 10px);
  top: -7rem;
  font-family: var(--serif);
  font-size: 26rem;
  line-height: 1;
  color: var(--ink);
  opacity: .045;
  pointer-events: none;
}
.home-hero__inner {
  position: relative;
  max-width: 1320px; /* wider than the 1180px site container, hero only */
  padding-top: var(--sp-7);
  padding-bottom: var(--sp-6);
}
.home-hero__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 54rem;
  margin: 0 auto var(--sp-6);
}
/* Same signature as .eyebrow everywhere else: brand caps with a gold rule */
.home-eyebrow,
.home-kicker {
  display: inline-block;
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--gold);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
}
.home-hero h1 {
  font-size: clamp(2.25rem, 4.2vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: var(--sp-4) 0 var(--sp-3);
  max-width: 24ch;
  text-wrap: balance;
}
.home-hero h1 em { font-style: italic; color: var(--brand); }
.home-hero__copy {
  font-size: var(--fs-lg);
  color: var(--muted);
  max-width: 36rem;
  margin: 0 0 var(--sp-5);
}

.home-search {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  max-width: 44rem;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-md);
  overflow: hidden;
  text-align: left;
}
.home-search:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent), var(--sh-md); }
.home-search label {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-left: var(--sp-4);
  min-width: 0;
  color: var(--brand);
}
.home-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 1rem .5rem;
  font: inherit;
  font-size: var(--fs-md);
  outline: 0;
}
.home-search input::placeholder { color: var(--faint); }
.home-search button {
  border: 0;
  border-left: 1px solid var(--ink);
  background: var(--ink);
  color: var(--marble);
  padding: 0 var(--sp-5);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-sm) var(--ease);
}
.home-search button:hover { background: var(--brand); color: #fff; }
.home-hero__quick { font-size: var(--fs-sm); color: var(--faint); margin: var(--sp-3) 0 0; }
.home-hero__quick a { color: var(--brand); font-weight: 600; }

/* Small-caps label used on the word-of-the-day card */
.home-aside__label {
  font-size: .7rem;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 var(--sp-4);
  font-weight: 600;
}

/* ─── Word of the day band (inside the hero): ad | card | ad ─── */
.home-quick {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
}
.home-quick__grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: var(--sp-5);
  align-items: stretch;
}
.home-quick .ad { margin: 0; }
.home-wotd {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 252px; /* matches the 300×250 slots beside it */
  padding: var(--sp-5) 10rem var(--sp-5) var(--sp-6);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: var(--r);
  text-decoration: none;
  transition: border-color var(--dur-sm) var(--ease);
}
.home-wotd:hover { text-decoration: none; color: var(--ink); border-color: var(--gold); }
.home-wotd .home-aside__label { color: var(--brand); margin-bottom: var(--sp-2); }
.home-wotd h2 { font-size: 2.25rem; line-height: 1.1; color: var(--ink); margin: 0; }
.home-wotd__pron { font-family: var(--serif); font-style: italic; color: var(--brand); margin: .25rem 0 0; }
.home-wotd__def { font-size: var(--fs-sm); color: var(--muted); max-width: 30rem; margin: var(--sp-3) 0 var(--sp-4); }
.home-wotd__link {
  display: inline-flex;
  gap: .5rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  padding-bottom: .25rem;
  transition: border-color var(--dur-sm) var(--ease);
}
.home-wotd:hover .home-wotd__link { border-color: var(--brand); }
.home-wotd__letter {
  position: absolute;
  z-index: 1;
  right: var(--sp-6);
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  width: 6.75rem;
  height: 7.75rem;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 4.5rem;
  font-weight: 700;
  color: var(--brand);
}

/* Narrower screens: the card takes the full row, the two ads sit side by side below it */
@media (max-width: 1100px) {
  .home-quick__grid { grid-template-columns: 1fr 1fr; }
  .home-wotd { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 680px) {
  .home-hero::before { font-size: 15rem; top: -3rem; right: -1.5rem; }
  .home-hero__inner { padding-top: var(--sp-5); padding-bottom: var(--sp-5); }
  .home-hero__intro { margin-bottom: var(--sp-5); }
  .home-hero h1 { font-size: 2.25rem; max-width: none; }
  .home-hero__copy { font-size: var(--fs-base); }
  .home-search { grid-template-columns: 1fr; }
  .home-search button { border-left: 0; border-top: 1px solid var(--ink); padding: .85rem; }
  .home-quick { padding-top: var(--sp-5); }
  .home-quick__grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .home-wotd { min-height: 0; padding: var(--sp-5); }
  .home-wotd h2 { font-size: 1.9rem; }
  .home-wotd__letter { display: none; }
  .home-quick .ad:last-child { display: none; } /* one ad is enough on a phone */
}

/* ─── Shared section furniture ─── */
.home-section { padding: var(--sp-8) 0; }
.home-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-4);
  border-bottom: 2px solid var(--gold);
}
.home-section__head h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: .6rem 0 0;
}
.home-section__head p { max-width: 32rem; color: var(--muted); margin: 0; }
.home-section__foot { margin: var(--sp-5) 0 0; text-align: right; }
.home-action {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--brand);
  padding-bottom: .25rem;
  white-space: nowrap;
}
.home-action:hover { color: var(--brand); text-decoration: none; }

/* ─── Browse by origin ─── */
.home-origins { background: var(--paper); }
.origin-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.origin-row {
  display: grid;
  grid-template-columns: 4.5rem 1.1fr 1.6fr auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-5) 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: padding var(--dur-md) var(--ease), background var(--dur-md) var(--ease);
}
.origin-row:hover {
  padding-left: var(--sp-3);
  padding-right: var(--sp-3);
  background: var(--marble);
  text-decoration: none;
  color: inherit;
}
.origin-row__glyph { font-family: var(--serif); font-size: 2rem; font-weight: 700; color: var(--brand); }
.origin-row__name { font-family: var(--serif); font-size: var(--fs-xl); font-weight: 700; color: var(--ink); }
.origin-row__desc { font-size: var(--fs-sm); color: var(--muted); }
.origin-row__count { font-size: var(--fs-xs); font-weight: 600; color: var(--faint); white-space: nowrap; }

/* ─── Recent etymologies ─── */
.home-recent { border-top: 1px solid var(--border); }
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: var(--sp-5); }
.filter-bar button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: .5rem .85rem;
  border-radius: var(--r-full);
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-sm) var(--ease);
}
.filter-bar button:hover,
.filter-bar button.is-active { background: var(--ink); border-color: var(--ink); color: var(--marble); }
.word-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  list-style: none;
  margin: 0;
  padding: 0;
}
.word-card {
  background: var(--marble);
  padding: var(--sp-6);
  min-height: 17rem;
  display: flex;
  flex-direction: column;
  transition: background var(--dur-sm) var(--ease);
}
.word-card:hover { background: var(--paper); }
.word-card[hidden] { display: none; }
.word-card__top {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  color: var(--faint);
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}
.word-card h3 { font-size: 1.85rem; line-height: 1.1; margin: 0 0 var(--sp-3); letter-spacing: -0.01em; }
.word-card h3 a { color: var(--ink); }
.word-card h3 a:hover { color: var(--brand); text-decoration: none; }
.word-card p { font-family: var(--sans); color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-normal); margin: 0 0 var(--sp-5); }
.word-card__link {
  margin-top: auto;
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  color: var(--brand);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: gap var(--dur-sm) var(--ease);
}
.word-card__link:hover { gap: .85rem; text-decoration: none; }

/* ─── How a word travels (dark band) ─── */
.home-learn { background: var(--band-bg); color: var(--band-fg); }
.home-learn .home-kicker { color: var(--band-accent); border-bottom-color: var(--band-accent); }
.home-learn .home-section__head h2 { color: var(--band-fg); }
.home-learn .home-section__head p { color: var(--band-muted); }
.home-learn__grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--sp-8);
  align-items: start;
}
.journey {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: var(--sp-5) 0 0;
  padding: 0;
  list-style: none;
  position: relative;
}
.journey::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 8%;
  right: 8%;
  height: 1px;
  background: var(--band-muted);
  opacity: .5;
}
.journey li { position: relative; padding-right: var(--sp-4); }
.journey__node {
  width: 31px;
  height: 31px;
  border-radius: 50%;
  border: 1px solid var(--band-accent);
  background: var(--band-bg);
  display: grid;
  place-items: center;
  font-size: .65rem;
  font-weight: 700;
  color: var(--band-accent);
  margin-bottom: var(--sp-4);
  position: relative;
  z-index: 1;
}
.journey strong { display: block; font-family: var(--serif); font-size: var(--fs-lg); font-weight: 700; color: var(--band-fg); }
.journey__desc { display: block; font-size: var(--fs-xs); color: var(--band-muted); margin-top: .25rem; }

.home-quiz {
  background: var(--header-hover);
  border-top: 3px solid var(--band-accent);
  border-radius: 0 0 var(--r) var(--r);
  padding: var(--sp-6);
}
.home-quiz__label {
  margin: 0;
  font-size: .7rem;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--band-accent);
  font-weight: 700;
}
.home-quiz h3 { font-size: var(--fs-xl); line-height: 1.3; color: var(--band-fg); margin: var(--sp-3) 0 var(--sp-5); }
.home-quiz__options { display: grid; gap: .6rem; }
.home-quiz__option {
  border: 1px solid var(--band-muted);
  background: transparent;
  color: var(--band-fg);
  text-align: left;
  padding: .75rem .9rem;
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: border-color var(--dur-sm) var(--ease);
}
.home-quiz__option:hover { border-color: var(--band-accent); }
.home-quiz__option:disabled { cursor: default; }
.home-quiz__option.is-correct { background: var(--band-accent); border-color: var(--band-accent); color: #fff; font-weight: 600; }
.home-quiz__option.is-wrong { opacity: .45; }
.home-quiz__feedback { min-height: 1.4rem; font-size: var(--fs-sm); margin: var(--sp-4) 0 0; color: var(--band-muted); }
.home-quiz__more {
  display: inline-block;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--band-fg);
  border-bottom: 1px solid var(--band-muted);
  padding-bottom: .2rem;
}
.home-quiz__more:hover { border-color: var(--band-accent); color: var(--band-fg); text-decoration: none; }

/* ─── A–Z ─── */
.home-alpha { padding: var(--sp-7) 0; border-bottom: 1px solid var(--border); }
.home-alpha__inner { display: grid; grid-template-columns: 220px 1fr; gap: var(--sp-6); align-items: center; }
.home-alpha h2 { font-size: 1.75rem; margin: 0; }
.alphabet {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-right: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.alphabet a,
.alphabet span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--serif);
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--muted);
}
.alphabet a:hover { background: var(--brand); color: #fff; text-decoration: none; }
.alphabet span { color: var(--faint); opacity: .45; }

/* ─── Responsive ─── */
@media (max-width: 980px) {
  .word-cards { grid-template-columns: repeat(2, 1fr); }
  .home-learn__grid { grid-template-columns: 1fr; gap: var(--sp-7); }
  .home-alpha__inner { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .home-section { padding: var(--sp-7) 0; }
  .home-section__head { align-items: flex-start; flex-direction: column; margin-bottom: var(--sp-5); }
  .home-section__foot { text-align: left; }
  .origin-row { grid-template-columns: 2.75rem 1fr auto; gap: var(--sp-3); padding: var(--sp-4) 0; }
  .origin-row__glyph { font-size: 1.6rem; }
  .origin-row__name { font-size: var(--fs-lg); }
  .origin-row__desc, .origin-row__count { grid-column: 2 / -1; }
  .word-cards { grid-template-columns: 1fr; }
  .word-card { min-height: 0; padding: var(--sp-5); }
  .journey { grid-template-columns: 1fr; }
  .journey::before { left: 15px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .journey li { display: grid; grid-template-columns: 31px 1fr; gap: var(--sp-4); padding: 0 0 var(--sp-5); align-items: start; }
  .journey__node { margin: 0; }
  .home-quiz { padding: var(--sp-5); }
  .alphabet { grid-template-columns: repeat(7, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .home-hero *, .origin-row, .word-card, .word-card__link { transition: none !important; }
}

/* ─── A word in motion: one real word's journey as a timeline ───
   The view only picks words with two or more stages, and keeps glosses short,
   so sparse entries never reach this layout. Forms and glosses are optional
   per step; a step with only a language name still reads well. */
.home-motion {
  padding: var(--sp-7) 0;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}
.home-motion__grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2.2fr);
  gap: var(--sp-8);
  align-items: center;
}
.home-motion__intro h2 {
  margin: var(--sp-3) 0 0;
  font-size: clamp(2.25rem, 3.6vw, 3rem);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.home-motion__intro h2 a { color: var(--ink); text-decoration: none; }
.home-motion__intro h2 a:hover { color: var(--brand); }
.home-motion__pron { margin: .35rem 0 0; font-family: var(--serif); font-style: italic; color: var(--brand); }
.home-motion__blurb { margin: var(--sp-4) 0 var(--sp-4); font-size: var(--fs-sm); color: var(--muted); line-height: var(--lh-normal); }

.motion-line {
  display: grid;
  grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}
.motion-line__step {
  position: relative;
  padding: 0 var(--sp-4) 0 0;
  min-width: 0;
}
/* Connector from this dot to the next one */
.motion-line__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 26px;
  right: 8px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), var(--border));
}
.motion-line__dot {
  display: block;
  width: 19px;
  height: 19px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--paper);
}
.motion-line__step.is-today .motion-line__dot {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.motion-line__lang {
  display: block;
  margin-top: var(--sp-4);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--faint);
}
.motion-line__step.is-today .motion-line__lang { color: var(--brand); }
.motion-line__form {
  display: block;
  margin-top: .35rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.motion-line__gloss {
  display: block;
  margin-top: .3rem;
  font-size: var(--fs-xs);
  color: var(--muted);
  line-height: 1.4;
}

/* Tablets: intro above the timeline. Phones: the timeline turns vertical. */
@media (max-width: 980px) {
  .home-motion__grid { grid-template-columns: 1fr; gap: var(--sp-6); }
}
@media (max-width: 640px) {
  .home-motion { padding: var(--sp-6) 0; }
  .motion-line { grid-template-columns: 1fr; }
  .motion-line__step { padding: 0 0 var(--sp-5) 36px; }
  .motion-line__step:last-child { padding-bottom: 0; }
  .motion-line__dot { position: absolute; left: 0; top: 1px; }
  .motion-line__step:not(:last-child)::after {
    top: 26px; bottom: 4px; left: 9px; right: auto;
    width: 1px; height: auto;
    background: linear-gradient(180deg, var(--gold), var(--border));
  }
  .motion-line__lang { margin-top: 0; }
}
