/* langs123 Home — generated by scripts/home.ts; the track index (track.ts) shares its frame, toolbar and search */
html:is([data-page="home"], [data-page="track"], [data-page="topic"]) {
  --hm-bg: #f2f2f7;
  --hm-fill: rgba(118, 118, 128, 0.12);
  --hm-sep: rgba(60, 60, 67, 0.18);
  --hm-body: #3c3c43;
  --hm-on-accent: #ffffff;
  --glass-bg: rgba(250, 250, 252, 0.92);
  --glass-border: rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
@media (prefers-color-scheme: dark) {
  html:is([data-page="home"], [data-page="track"], [data-page="topic"]):not([data-theme="light"]) {
    --hm-bg: #000000;
    --hm-fill: rgba(118, 118, 128, 0.24);
    --hm-sep: rgba(84, 84, 88, 0.6);
    --hm-body: rgba(235, 235, 245, 0.75);
    --hm-on-accent: #10131a;
    --glass-bg: rgba(40, 40, 44, 0.92);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
}
html:is([data-page="home"], [data-page="track"], [data-page="topic"])[data-theme="dark"] {
  --hm-bg: #000000;
  --hm-fill: rgba(118, 118, 128, 0.24);
  --hm-sep: rgba(84, 84, 88, 0.6);
  --hm-body: rgba(235, 235, 245, 0.75);
  --hm-on-accent: #10131a;
  --glass-bg: rgba(40, 40, 44, 0.92);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

html:is([data-page="home"], [data-page="track"], [data-page="topic"]) body { background: var(--hm-bg); color: var(--text); font: 17px/1.35 var(--font); }
html:is([data-page="home"], [data-page="track"], [data-page="topic"]) [hidden] { display: none !important; }
:where([data-page="home"], [data-page="track"]) a { color: inherit; text-decoration: none; }

.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  backdrop-filter: blur(30px) saturate(1.6);
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.hm-main { max-width: 1040px; margin: 0 auto; padding: 20px 20px 40px; }
.hm-brand { display: inline-flex; align-items: center; gap: 8px; height: 44px; margin-bottom: 12px; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.hm-brand svg { display: block; border-radius: 7px; }
.hm-title { margin: 0 0 16px; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: 0.01em; }

/* Courses: a card per language to learn, a chip per explanation language */
.hm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.hm-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 22px; background: var(--surface); }
.hm-course { display: flex; align-items: center; gap: 12px; }
.hm-flag { font-size: 30px; line-height: 1; }
.hm-name { margin: 0; flex-grow: 1; min-width: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.hm-course .badge, .hm-row .badge { --badge-pad: 0 7px; flex-shrink: 0; margin: 0; font-size: 12px; font-weight: 700; line-height: 1.6; }
.hm-label { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.hm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hm-chip { padding: 7px 12px; border-radius: 999px; font-size: 15px; background: var(--hm-fill); }
.hm-chip:hover { filter: brightness(0.94); }
.hm-chip.here { background: var(--accent); color: var(--hm-on-accent); }
.hm-chip.here:hover { filter: brightness(1.08); }
.hm-course:focus-visible, .hm-chip:focus-visible, .hm-row:focus-visible, .hm-credits:focus-visible, .hm-read summary:focus-visible,
.hm-menu a:focus-visible, .hm-close:focus-visible, .hm-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Search results: one list under the Topics heading, most relevant first. Above 860px it splits into two
   columns, the first half on the left; on phones the columns stack into one rounded list. */
.hm-heading { margin: 0 0 8px 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.hm-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.hm-rows { border-radius: 22px; background: var(--surface); overflow: hidden; }
.hm-row { position: relative; display: flex; flex-direction: column; gap: 5px; padding: 14px 16px; }
.hm-row + .hm-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--hm-sep); }
.hm-row:hover { background: var(--hm-fill); }
.hm-row-head { display: flex; align-items: center; gap: 10px; }
.hm-row-title { flex-grow: 1; min-width: 0; font-size: 17px; font-weight: 600; }
.hm-row-flag { margin-right: 6px; }
.hm-row-lang { font-weight: 400; color: var(--muted); }
.hm-row-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.35; color: var(--hm-body); }
.hm-row-text b { font-weight: 700; color: var(--text); }
.hm-empty { margin: 32px 0; text-align: center; color: var(--muted); grid-column: 1 / -1; }

/* The toolbar: glass on its controls, the content solid */
.hm-bar { position: fixed; top: 20px; right: 20px; z-index: 30; display: flex; align-items: center; gap: 10px; }
.hm-search { display: flex; align-items: center; gap: 8px; min-width: 0; width: 260px; height: 44px; margin: 0; padding: 0 16px; border-radius: 999px; color: var(--muted); font-size: 17px; transition: width 0.2s ease; }
.hm-search input { flex: 1; width: 0; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; -webkit-appearance: none; appearance: none; }
.hm-search input::placeholder { color: var(--muted); opacity: 1; }
.hm-search input::-webkit-search-cancel-button, .hm-search input::-webkit-search-decoration { -webkit-appearance: none; }
.hm-clear { display: flex; flex-shrink: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.hm-group { position: relative; display: flex; height: 44px; border-radius: 999px; color: var(--text); }
.hm-read summary { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; padding: 0 14px; border-radius: 999px; list-style: none; cursor: pointer; white-space: nowrap; }
.hm-read summary::-webkit-details-marker { display: none; }
.hm-credits { display: flex; align-items: center; justify-content: center; width: 48px; border-radius: 999px; }
.hm-close { display: none; flex-shrink: 0; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 999px; color: var(--text); cursor: pointer; }
.hm-menu { position: absolute; background: var(--surface); border: 0.5px solid var(--glass-border); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08); top: calc(100% + 12px); right: 0; display: flex; flex-direction: column; min-width: 200px; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; border-radius: 20px; }
.hm-menu a { padding: 10px 14px; border-radius: 14px; white-space: nowrap; }
.hm-menu a:hover { background: var(--hm-fill); }
.hm-menu a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.hm-searching .hm-search { width: 420px; max-width: calc(100vw - 100px); }
.hm-searching .hm-group { display: none; }
.hm-searching .hm-close { display: flex; }

/* Phones: the toolbar floats at the bottom and rises with the keyboard (home.js sets --hm-kb) */
@media (max-width: 860px) {
  .hm-main { padding: 16px 20px 120px; }
  .hm-bar { top: auto; left: 16px; right: 16px; bottom: max(30px, calc(env(safe-area-inset-bottom) + 8px)); }
  .hm-search { flex-grow: 1; width: auto; height: 48px; }
  .hm-group { height: 48px; }
  .hm-read summary { width: 52px; padding: 0; }
  .hm-read summary span { display: none; }
  .hm-credits { width: 52px; }
  .hm-menu { top: auto; bottom: calc(100% + 14px); }
  .hm-searching .hm-search { width: auto; max-width: none; }
  .hm-searching .hm-bar { bottom: max(30px, calc(var(--hm-kb, 0px) + 10px)); }
  .hm-list { display: block; }
  .hm-rows + .hm-rows .hm-row:first-child::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 0.5px; background: var(--hm-sep); }
  .hm-rows:first-child:not(:last-child) { border-radius: 22px 22px 0 0; }
  .hm-rows:last-child:not(:first-child) { border-radius: 0 0 22px 22px; }
  .hm-searching .hm-main { padding-bottom: calc(var(--hm-kb, 0px) + 110px); }
}

/* Wide and short, an unfolded phone held horizontally (1133 × 744): two columns whose gap sits on the
   fold in the middle, equal margins either side, the results in the same two columns */
@media (min-width: 900px) and (max-height: 800px) and (orientation: landscape) {
  .hm-main { max-width: none; padding-inline: 88px; }
  .hm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
  .hm-list { column-gap: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .hm-search { transition: none; }
}
