/* ── home dashboard ──────────────────────────────────────────── */
#homeSection { display: none; }
#homeSection.active { display: block; }
.home-hero {
  display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center;
  padding: 24px 26px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-sm);
}
.home-ring { position: relative; width: 120px; height: 120px; }
.home-ring svg { transform: rotate(-90deg); }
.home-ring-track { stroke: var(--surface-2); }
.home-ring-fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.home-ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.home-ring-label b { font-size: 1.7em; line-height: 1; }
.home-ring-label span { color: var(--muted); font-size: .78em; margin-top: 3px; }
.home-hero h1 { font-size: 1.6em; }
.home-hero p { margin: 4px 0 14px; color: var(--muted); }
.home-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.home-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .88em; font-weight: 600;
}
.home-chip.streak { background: var(--warn-soft); color: var(--warn-text); }

/* ── landing (guests): what the site is, beside a picture of a lesson ── */
.landing {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center;
  padding: 40px 8px 32px; isolation: isolate;
}
.landing-deco { position: absolute; z-index: -1; color: var(--primary); opacity: .1; pointer-events: none; }
.landing-deco.book { width: 64px; top: 0; right: 30%; }
.landing-deco.globe { width: 76px; bottom: 0; right: 0; }
.landing-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.landing-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: 600; font-size: .92em;
}
.landing-badge svg { width: 16px; height: 16px; color: var(--primary-text); }
.landing h1 { font-size: clamp(2.3em, 5vw, 4em); line-height: 1.1; letter-spacing: -.02em; margin: 0 0 22px; font-weight: 700; }
.landing-grad {
  background: linear-gradient(100deg, var(--primary-text), var(--primary) 45%, var(--warn-text));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing-lead { font-size: 1.15em; line-height: 1.6; color: var(--muted); margin: 0 0 28px; max-width: 40em; }
.landing-lead mark { background: none; color: var(--primary-text); font-weight: 600; }
.landing-lead mark.alt { color: var(--warn-text); }
.landing-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.landing-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 28px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 1.08em; font-weight: 600; text-decoration: none; transition: background .15s, border-color .15s;
}
.landing-btn:hover { border-color: var(--primary-border); background: var(--surface-2); }
.landing-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.landing-btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.landing-btn svg { width: 20px; height: 20px; }
.landing-login { margin: 14px 0 0; color: var(--muted); font-size: .95em; }
.landing-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 10px; color: var(--text-2); }
.landing-points li { display: flex; align-items: flex-start; gap: 10px; }
.landing-points svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--success-text); }

/* the lesson picture: a browser window drawn with the site's own surfaces */
.landing-demo {
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow), 0 0 0 6px var(--primary-soft); overflow: hidden; font-size: 12px; user-select: none;
}
.demo-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.demo-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); }
.demo-bar i:nth-child(2) { background: var(--warn); }
.demo-bar i:nth-child(3) { background: var(--success); }
.demo-url { flex: 1; margin-left: 8px; padding: 5px 12px; border-radius: 6px; background: var(--surface); color: var(--muted); }
.demo-body { display: grid; grid-template-columns: minmax(0, 1fr) 30%; }
.demo-main { padding: 0 0 14px; border-right: 1px solid var(--border); display: grid; gap: 9px; }
.demo-main > :not(.demo-video):not(.demo-progress) { margin: 0 14px; }
.demo-video { position: relative; aspect-ratio: 16 / 7; background: var(--surface-inverse); display: grid; place-items: center; }
.demo-scene {
  width: 58%; height: 100%; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 70%, var(--warn-soft), transparent 55%),
              radial-gradient(circle at 75% 35%, var(--primary-soft), transparent 55%), var(--surface-3);
}
.demo-play { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .85); color: #111; font-size: 13px; }
.demo-caption { position: absolute; bottom: 10px; padding: 2px 8px; border-radius: 4px; background: var(--primary); color: var(--on-primary); font-weight: 600; }
.demo-progress { height: 3px; margin: 0 14px; border-radius: 3px; background: var(--surface-3); }
.demo-progress span { display: block; width: 3%; height: 100%; border-radius: 3px; background: var(--primary); }
.demo-controls { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--muted); }
.demo-controls > span:first-child { margin-right: auto; }
.demo-controls b { color: var(--text-2); }
.demo-controls b.big { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); }
.demo-speed { margin-left: auto; }
.demo-meta { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-meta kbd { padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 3px; font-size: 10px; }
.demo-tag { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); }
.demo-ok { margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--success-soft); color: var(--success-text); }
.demo-input { padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 15px; color: var(--text); }
.demo-words { display: flex; flex-wrap: wrap; gap: 5px; }
.demo-words span { padding: 3px 9px; border-radius: 5px; background: var(--success-soft); border: 1px solid var(--success-border); color: var(--success-text); font-family: ui-monospace, monospace; font-size: 11px; }
.demo-vi { padding: 8px 10px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.demo-next { justify-self: end; padding: 5px 12px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.demo-side { padding: 12px; display: grid; align-content: start; gap: 10px; background: var(--surface-2); }
.demo-side .demo-progress { margin: 0; }
.demo-side-head { display: flex; justify-content: space-between; color: var(--muted); }
.demo-item { display: flex; gap: 8px; padding: 8px; border-radius: 8px; }
.demo-item.current { border: 1px solid var(--primary-border); background: var(--surface); }
.demo-item > div { flex: 1; display: grid; gap: 5px; }
.demo-item small { color: var(--muted); font-size: 10px; }
.demo-item em { font-style: normal; padding: 0 4px; border-radius: 3px; background: var(--primary); color: var(--on-primary); font-size: 9px; }
.demo-item i { display: block; height: 4px; border-radius: 2px; background: var(--border-strong); }
.demo-dot { flex: none; width: 10px; height: 10px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.demo-item.current .demo-dot { background: var(--primary); border-color: var(--primary); }

@media (max-width: 1100px) {
  .landing { grid-template-columns: minmax(0, 1fr); gap: 36px; padding-top: 16px; }
  .landing-deco { display: none; }
}
@media (max-width: 560px) {
  .landing-btn { flex: 1 1 100%; justify-content: center; }
  .demo-body { grid-template-columns: minmax(0, 1fr); }
  .demo-side { display: none; }
}

/* ── the landing's top bar: guests on the home page get it instead of the sidebar ── */
.site-header { display: none; }
body.on-home:not(.signed-in):not(.admin) .site-header {
  display: block; position: sticky; top: 0; z-index: 55; margin: -28px -32px 8px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
body.on-home:not(.signed-in):not(.admin) .mobile-bar { display: none; }
body.on-home:not(.signed-in):not(.admin) #homeSection { max-width: 1240px; }
.site-header-inner { display: flex; align-items: center; gap: 28px; max-width: 1240px; margin: 0 auto; padding: 14px 0; }
.site-header .app-brand { padding: 0; text-decoration: none; white-space: nowrap; }
.site-menu-btn { display: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-link:not(.app-brand) {
  padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.site-link:not(.app-brand):hover { color: var(--text); background: var(--surface-3); }
.site-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.site-btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border-strong); color: var(--text);
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.site-btn:hover { background: var(--surface-3); }
.site-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.site-btn.primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }

@media (min-width: 901px) {
  body.on-home:not(.signed-in):not(.admin) { padding-left: 32px; }
  body.on-home:not(.signed-in):not(.admin) .app-sidebar { display: none; }
}
@media (max-width: 1100px) {
  .site-nav { display: none; }
  .site-menu-btn { display: grid; }
  .site-header-inner { gap: 10px; }
}
/* phones: the sidebar still slides in from the menu button (lessons-library.css) */
@media (max-width: 900px) {
  body.on-home:not(.signed-in):not(.admin) .site-header { margin: 0 -16px 8px; padding: 0 16px; }
}
@media (max-width: 420px) {
  .site-header .app-brand { font-size: 0; gap: 0; }   /* just the mark, so both buttons fit */
  .site-header .app-brand-mark { font-size: 13.5px; }
}
