/* ==========================================================================
   First impression (docs/UNDERSTAND_FIRST_IMPRESSION_IMPLEMENTATION.md)
   --------------------------------------------------------------------------
   Built only on the tokens of app.css (paper, ink, one orange point). Sections:
   A. Chrome additions   D. Divisions & paths   G. Onboarding
   B. Hero               E. Explore & search    H. Sign-up & combobox
   C. Exercise demo      F. Subject cards       I. Dashboard additions
   ========================================================================== */

/* A. Chrome additions ------------------------------------------------------ */
.btn svg { width: 1em; height: 1em; flex: none; }
.searchbox .btn { min-height: 3rem; }
.show-sm { display: none; }
@media (max-width: 720px) {
  .show-sm { display: block; }
}
.nav a.nav-icon { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; }
@media (max-width: 720px) { .nav a.nav-icon.hide-sm { display: none; } }
.nav-icon svg { width: 1.15rem; height: 1.15rem; }

.site-footer { padding-block: var(--sp-7); }
.footer-grid { display: grid !important; gap: var(--sp-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.footer-about p { margin: var(--sp-2) 0 0; max-width: 18rem; }
.footer-grid nav { display: grid; gap: var(--sp-2); align-content: start; }
.footer-title { font: 700 var(--fs-xs)/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin: 0 0 var(--sp-1); }
.footer-grid a { padding-block: 0.15rem; }

.crumbs { margin-bottom: var(--sp-4); font-size: var(--fs-sm); }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 0.35rem; align-items: center; color: var(--text-3); }
.crumbs li { margin: 0; display: inline-flex; align-items: center; gap: 0.35rem; }
.crumbs li + li::before { content: "›"; color: var(--text-3); }
[dir="rtl"] .crumbs li + li::before { content: "‹"; }
.crumbs a { color: var(--text-2); text-decoration: none; padding-block: 0.2rem; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }

/* The brand's point, as the full stop of the promise (docs/BRAND_GUIDE.md: orange is only ever the point). */
.brand-stop { color: var(--accent); }

/* B. Hero ------------------------------------------------------------------ */
.hero2 { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5.5rem); }
.hero2-grid { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .hero2-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.hero2 h1 { font-size: var(--fs-3xl); letter-spacing: -0.035em; line-height: 1.02; margin-bottom: var(--sp-4); }
.hero2 .lead { max-width: 34rem; margin-bottom: var(--sp-5); }
.hero2-actions { gap: var(--sp-3); }
.hero2-note { margin: var(--sp-4) 0 0; font-size: var(--fs-sm); color: var(--text-3); max-width: 30rem; }
@media (max-width: 480px) {
  .hero2-actions .btn { width: 100%; }
}

/* C. Exercise demo --------------------------------------------------------- */
.ex-demo {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.ex-demo-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ex-demo-source { font-size: var(--fs-xs); color: var(--text-2); font-weight: 600; text-decoration: none; }
.ex-demo-source:hover { text-decoration: underline; }
.ex-demo-body { padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.ex-demo-prompt { font-size: var(--fs-base); }
.ex-demo-prompt p { margin-bottom: var(--sp-2); }
.ex-demo-question { display: flex; gap: var(--sp-2); align-items: baseline; font-weight: 600; margin: var(--sp-3) 0; }
.ex-demo-q { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--text); color: var(--bg); font: 700 0.75rem/1 var(--font-mono); }
.ex-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.ex-step { margin: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg); font-size: var(--fs-sm); }
.ex-step .prose { font-size: var(--fs-sm); line-height: 1.6; }
.ex-step .prose p { margin-bottom: var(--sp-2); }
.ex-step-label { display: block; font: 700 0.7rem/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); margin-bottom: var(--sp-2); }
.ex-step--wrong { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); background: var(--bad-soft); }
.ex-step--wrong .ex-step-label { color: var(--bad); }
.ex-step-answer { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-2); }
.ex-answer { font: 700 1.05rem/1 var(--font-mono); padding: 0.3rem 0.6rem; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border); text-decoration: line-through; text-decoration-color: var(--bad); }
.ex-verdict { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--bad); font-weight: 700; font-size: var(--fs-xs); }
.ex-step--hint { border-color: color-mix(in srgb, var(--info) 25%, var(--border)); background: var(--info-soft); }
.ex-step--hint .ex-step-label { color: var(--info); }
.ex-step--solution { border-color: color-mix(in srgb, var(--ok) 30%, var(--border)); background: var(--ok-soft); }
.ex-step--solution .ex-step-label { color: var(--ok); }
.ex-step.is-new { animation: step-in 320ms var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } }
.ex-demo-foot { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-5) var(--sp-4); }
.ex-demo-count { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--text-3); }
.ex-demo .katex { font-size: 1.05em; }

/* method */
.method { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.method li { margin: 0; padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); display: grid; gap: var(--sp-1); align-content: start; }
.method-n { font-size: var(--fs-xs); font-weight: 700; color: var(--accent-text); }
.method strong { font-family: var(--font-display); font-size: var(--fs-md); letter-spacing: -0.01em; }
.method span:last-child { color: var(--text-2); font-size: var(--fs-sm); }

/* D. Divisions & paths ----------------------------------------------------- */
.division-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.division-card {
  position: relative;
  display: grid; align-content: start; gap: var(--sp-2);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.division-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.division-card:focus-within { box-shadow: var(--focus); }
.division-card h3 { font-size: var(--fs-lg); margin: var(--sp-2) 0 0; }
.division-card h3 a { text-decoration: none; }
.division-card p { color: var(--text-2); font-size: var(--fs-sm); margin: 0; }
.division-card.is-quiet { background: transparent; }
.division-icon { display: inline-grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: var(--r-md); background: var(--surface-2); color: var(--text); }
.division-icon svg { width: 1.35rem; height: 1.35rem; }
.division-count { font-size: var(--fs-xs) !important; color: var(--text-3) !important; margin-top: var(--sp-2) !important; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stretched:focus-visible { outline: none; }
.chip-list { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.chip-list li { margin: 0; }
.chip { display: inline-block; padding: 0.2rem 0.6rem; border-radius: var(--r-pill); border: 1px solid var(--border); font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); background: var(--bg); }
.band-foot { margin: var(--sp-5) 0 0; }

.facts { display: grid; gap: var(--sp-3); grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.facts div { padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.facts dd { margin: 0; font-size: var(--fs-xl); font-weight: 700; order: -1; }
.facts div { display: flex; flex-direction: column; }
.facts dt { font-size: var(--fs-sm); color: var(--text-2); }
.trust-grid { display: grid; gap: var(--sp-6); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .trust-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } }
.promises { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.promises li { margin: 0; display: flex; gap: var(--sp-3); align-items: flex-start; }
.promises svg { flex: none; width: 1.2rem; height: 1.2rem; margin-top: 0.2rem; color: var(--ok); }

/* E. Explore & search ------------------------------------------------------ */
.explore-head { max-width: 44rem; margin-bottom: var(--sp-6); }
.explore-head h1 { margin-bottom: var(--sp-2); }
.explore-head p { color: var(--text-2); font-size: var(--fs-md); margin: 0; }
.explore-division + .explore-division { margin-top: var(--sp-7); }
.explore-division-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.explore-division-head h2 { margin: 0; font-size: var(--fs-xl); display: inline-flex; align-items: center; gap: var(--sp-3); }
.explore-division-head h2 svg { width: 1.4rem; height: 1.4rem; color: var(--text-2); }
.explore-division-head a { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.path-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.path-card {
  position: relative;
  display: grid; gap: var(--sp-1); align-content: start;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-decoration: none;
  min-height: 5.5rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.path-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.path-card:focus-within { box-shadow: var(--focus); }
.path-card .path-kicker { font: 700 0.7rem/1.2 var(--font-mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.path-card h3 { font-size: var(--fs-md); margin: 0; }
.path-card h3 a { text-decoration: none; }
.path-card p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.path-card .path-go { position: absolute; inset-inline-end: var(--sp-4); top: var(--sp-4); color: var(--text-3); }
.path-card .path-go svg { width: 1.1rem; height: 1.1rem; }
[dir="rtl"] .path-card .path-go svg { transform: scaleX(-1); }
.path-subjects { margin: var(--sp-2) 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.path-subjects li { margin: 0; }
.empty-state {
  padding: var(--sp-6);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  text-align: center;
  color: var(--text-2);
}
.empty-state h2, .empty-state h3 { color: var(--text); font-size: var(--fs-md); }
.empty-state p { max-width: 32rem; margin-inline: auto; }

.follow-bar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}
.follow-bar p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); }

.searchbox { display: flex; gap: var(--sp-2); max-width: 40rem; }
.searchbox input { flex: 1; min-width: 0; min-height: 3rem; padding: 0.7rem 1rem; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: 1.05rem; }
.searchbox input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.search-group + .search-group { margin-top: var(--sp-6); }
.search-group h2 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
.hits { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.hits li { margin: 0; }
.hit { display: grid; gap: 0.15rem; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); text-decoration: none; }
.hit:hover { border-color: var(--border-strong); }
.hit strong { font-weight: 650; }
.hit span { font-size: var(--fs-xs); color: var(--text-3); }

/* F. Subject cards --------------------------------------------------------- */
.subject-list { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.subject {
  position: relative;
  display: grid; gap: var(--sp-2); align-content: start;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.subject:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.subject:has(input:focus-visible) { box-shadow: var(--focus); }
.subject-pick { display: flex; gap: var(--sp-3); align-items: flex-start; cursor: pointer; }
.subject-pick input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--accent); flex: none; }
.subject h3 { font-size: var(--fs-md); margin: 0; }
.subject p { margin: 0; color: var(--text-2); font-size: var(--fs-sm); }
.subject-facts { font-size: var(--fs-xs) !important; color: var(--text-3) !important; }
.subject-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-1); }
.subject-actions form { display: contents; }
.is-followed { display: inline-flex; align-items: center; gap: 0.25rem; font-size: var(--fs-xs); font-weight: 700; color: var(--ok); }
.is-followed svg { width: 0.9rem; height: 0.9rem; }

/* G. Onboarding ------------------------------------------------------------ */
.journey-setup { max-width: 52rem; margin-inline: auto; padding-block: var(--sp-7) var(--sp-8); }
.setup-progress { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-5); list-style: none; padding: 0; }
.setup-progress li { margin: 0; flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.setup-progress li.is-done { background: var(--accent); }
.journey-setup h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.journey-setup .lead { margin-bottom: var(--sp-6); }
.option-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.option {
  position: relative;
  display: grid; gap: var(--sp-2); align-content: start;
  padding: var(--sp-5);
  min-height: 9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.option:hover { border-color: var(--text-3); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.option:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
.option strong { font-family: var(--font-display); font-size: var(--fs-md); }
.option span { color: var(--text-2); font-size: var(--fs-sm); }
.option .division-icon { margin-bottom: var(--sp-1); }
.option.is-suggested { border-color: var(--accent); }
.option[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
.option-tag { position: absolute; inset-inline-end: var(--sp-4); top: var(--sp-4); }
.setup-foot { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; margin-top: var(--sp-6); }
.setup-foot .skip { font-size: var(--fs-sm); color: var(--text-2); background: none; border: 0; padding: var(--sp-2); cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; font: inherit; font-size: var(--fs-sm); }

/* H. Sign-up & combobox ---------------------------------------------------- */
.auth-card--wide { max-width: 30rem; }
.tip {
  display: flex; gap: var(--sp-3);
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.tip svg { flex: none; width: 1.05rem; height: 1.05rem; color: var(--accent-text); margin-top: 0.1rem; }
.tip strong { display: block; color: var(--text); font-size: var(--fs-sm); margin-bottom: 0.15rem; }
.tip p { margin: 0; }
.field-optional { font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); margin-inline-start: 0.35rem; }
.why { font-size: var(--fs-xs); color: var(--text-3); margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); }

.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px);
  max-height: min(18rem, 50vh); overflow-y: auto;
  margin: 0; padding: var(--sp-1); list-style: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg);
}
.combo-list li { margin: 0; padding: 0.6rem 0.75rem; border-radius: var(--r-sm); cursor: pointer; display: grid; gap: 0.1rem; min-height: 2.75rem; }
.combo-list li span { font-size: var(--fs-xs); color: var(--text-3); }
.combo-list li[aria-selected="true"] { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: -2px; }
.combo-list li.combo-group { cursor: default; min-height: 0; padding: 0.5rem 0.75rem 0.2rem; font: 700 0.7rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.combo-list li.combo-special { border-top: 1px solid var(--border); border-radius: 0; font-weight: 600; }
.combo-empty { padding: 0.6rem 0.75rem; color: var(--text-3); font-size: var(--fs-sm); }

/* I. Dashboard additions --------------------------------------------------- */
.my-paths { display: grid; gap: var(--sp-2); }
.my-path { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.my-path a { font-weight: 650; text-decoration: none; }
.my-path span { font-size: var(--fs-xs); color: var(--text-3); }
.welcome-card { padding: var(--sp-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.welcome-card h2 { font-size: var(--fs-xl); }
.welcome-card p { color: var(--text-2); max-width: 36rem; }
.menu-inline summary { list-style: none; cursor: pointer; }
.menu-inline summary::-webkit-details-marker { display: none; }
.link-button { background: none; border: 0; padding: 0.2rem 0; font: inherit; font-size: var(--fs-xs); color: var(--text-3); cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.link-button:hover { color: var(--bad); }

/* Arabic script needs more room between lines than Latin display type. */
[dir="rtl"] .hero2 h1, [dir="rtl"] .journey-setup h1, [dir="rtl"] .explore-head h1 { line-height: 1.3; letter-spacing: 0; }
.option-tag { position: static; justify-self: start; }
.nav-xp { white-space: nowrap; }
.subject-name { display: block; font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.subject-summary { display: block; margin-top: var(--sp-1); color: var(--text-2); font-size: var(--fs-sm); }
/* Narrow phones (320–400 px): the header keeps the essentials; XP stays one tap away on the profile. */
@media (max-width: 400px) {
  .nav-xp { display: none; }
  .site-header .container { gap: var(--sp-2); }
  .brand { font-size: 1.05rem; }
}
