/* Ilm Nuri — shared styles (home page + level test) */
:root {
  --ink: #1b1d22;
  --paper: #f7f4ee;
  --white: #fff;
  --lapis: #2f4fa8;
  --saffron: #f2b84b;
  --text-2: #4a4d55;
  --text-3: #6b6e76;
  --muted: #9a9890;
  --sand: #e4ded2;
  --line: rgba(27, 29, 34, .08);
  --line-2: rgba(27, 29, 34, .15);
  --card-border: #efeae0;
  --track: #e9e4da;
  --dashed: #c9c4b8;
  --field-dark: #2a2c33;

  --font-body: Onest, system-ui, sans-serif;
  --font-display: Unbounded, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --gutter: clamp(16px, 5vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lapis); }
a:hover { color: var(--ink); }

button { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--lapis); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.mono { font: 500 12px var(--font-mono); color: var(--text-3); letter-spacing: 0; }

/* ---------- Header ---------- */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: clamp(14px, 3vw, 22px) var(--gutter);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-logo { display: block; height: 40px; width: auto; flex: none; }
.brand-name { font: 600 19px var(--font-display); letter-spacing: -.02em; }

.header-actions { display: flex; align-items: center; gap: clamp(10px, 2vw, 16px); flex-wrap: wrap; }

.lang-switch {
  display: flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px;
  font-size: 13px; font-weight: 600;
}
.lang-switch button {
  padding: 5px 10px; border: 0; background: none; border-radius: 999px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lang-switch button:not([aria-pressed="true"]):hover { background: var(--track); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 17px 28px; border-radius: 999px; font-weight: 600; font-size: 16px;
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-sm { padding: 12px 20px; font-size: 14px; }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: var(--lapis); color: #fff; }
.btn-blue { background: var(--lapis); color: #fff; }
.btn-blue:hover { background: var(--ink); color: #fff; }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--paper); }
.btn-saffron { background: var(--saffron); color: var(--ink); font-weight: 700; }
.btn-saffron:hover { background: #e6a935; color: var(--ink); }

/* ---------- Home: hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  padding: 72px var(--gutter) 64px; max-width: 1280px; margin: 0 auto;
}
.hero h1 {
  margin: 0 0 20px; font: 600 clamp(40px, 5.4vw, 68px)/1.02 var(--font-display);
  letter-spacing: -.04em; text-wrap: balance;
}
/* Headline lockup: "Ilm -" on its own line (the hyphen drawn as a saffron bar),
   then the rest, with the key word in blue on a saffron highlighter stroke. */
.h1-lead { display: block; white-space: nowrap; }
.h1-dash {
  display: inline-block; width: .5em; height: .13em; margin-left: 0; vertical-align: .17em;
  border-radius: .07em; background: var(--saffron); color: transparent; overflow: hidden; line-height: 0;
}
.hero h1 em {
  font-style: normal; color: var(--lapis); white-space: nowrap; padding: 0 .04em; margin: 0 -.04em;
  background: linear-gradient(transparent 60%, color-mix(in srgb, var(--saffron) 60%, transparent) 60%, color-mix(in srgb, var(--saffron) 60%, transparent) 84%, transparent 84%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hero p {
  margin: 0 0 36px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.55; color: var(--text-2);
  max-width: 500px; text-wrap: pretty;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-media { position: relative; height: 460px; }
.hero-photo {
  position: absolute; inset: 0 0 0 40px; border-radius: 220px 220px 24px 24px;
  overflow: hidden; background: var(--sand);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo .credit {
  position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: #fff;
  background: rgba(0, 0, 0, .45); padding: 3px 8px; border-radius: 6px; text-decoration: none;
}
.hero-badge {
  position: absolute; left: 0; bottom: 36px; background: #fff; border-radius: 18px;
  padding: 18px 20px; box-shadow: 0 12px 32px rgba(27, 29, 34, .12);
  display: flex; gap: 14px; align-items: center; max-width: 340px;
  border: 0; text-align: left; cursor: pointer; font: inherit; color: var(--ink);
}
.hero-badge > span { transition: opacity .3s, transform .3s; }
.hero-badge.is-leaving > span { opacity: 0; transform: translateY(6px); }
.hero-badge-text { min-width: 0; }
.hero-badge-dots { display: flex; gap: 4px; margin-top: 8px; }
.hero-badge-dots i { width: 5px; height: 5px; border-radius: 50%; background: #dcd6ca; transition: background .3s, width .3s; }
.hero-badge-dots i.on { width: 14px; border-radius: 3px; background: var(--lapis); }
@media (prefers-reduced-motion: reduce) { .hero-badge > span, .hero-badge-dots i { transition: none; } }
.hero-badge-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--saffron); color: var(--ink); flex: none;
  display: flex; align-items: center; justify-content: center; font: 700 15px var(--font-display);
}
.hero-badge-icon.is-blue { background: var(--lapis); color: #fff; }
.hero-badge-icon.is-dark { background: var(--ink); color: var(--saffron); }
.hero-badge strong { display: block; font-weight: 600; font-size: 15px; }
.hero-badge small { display: block; font-size: 13px; color: var(--text-3); }

/* ---------- Home: courses ---------- */
.section { max-width: 1280px; margin: 0 auto; }
.courses { padding: 24px var(--gutter) 72px; }
.courses-head {
  display: flex; justify-content: space-between; align-items: end; gap: 16px 24px;
  flex-wrap: wrap; margin-bottom: 28px;
}
.h2 { margin: 0; font: 600 clamp(28px, 3.2vw, 38px)/1.1 var(--font-display); letter-spacing: -.03em; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 500; }
.filters button {
  padding: 9px 16px; background: #fff; border: 0; border-radius: 999px; cursor: pointer;
  font-weight: 500;
}
.filters button:hover { background: var(--track); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.course-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.course {
  --c-bg: #fff; --c-fg: var(--ink); --c-tag: var(--text-3); --c-desc: var(--text-2);
  --c-arrow-bg: var(--paper); --c-arrow-fg: var(--ink);
  background: var(--c-bg); color: var(--c-fg); border-radius: 22px; padding: 24px;
  display: flex; flex-direction: column; gap: 10px; min-height: 190px;
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.course:hover { color: var(--c-fg); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(27, 29, 34, .08); }
.course[hidden] { display: none; }
.course-tag { font: 500 11px var(--font-mono); color: var(--c-tag); }
.course-title { font: 600 22px/1.15 var(--font-display); }
.course-desc { font-size: 14px; color: var(--c-desc); line-height: 1.5; }
.course-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.course-foot span:first-child { font-weight: 600; font-size: 14px; }
.course-arrow {
  width: 36px; height: 36px; border-radius: 50%; background: var(--c-arrow-bg); color: var(--c-arrow-fg);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.course--blue { --c-bg: var(--lapis); --c-fg: #fff; --c-tag: rgba(255,255,255,.75); --c-desc: rgba(255,255,255,.85); --c-arrow-bg: var(--saffron); --c-arrow-fg: var(--ink); }
.course--saffron { --c-bg: var(--saffron); --c-tag: #5a4110; --c-desc: #3b2c0c; --c-arrow-bg: var(--ink); --c-arrow-fg: #fff; }
.course--dark { --c-bg: var(--ink); --c-fg: #fff; --c-tag: rgba(255,255,255,.75); --c-desc: rgba(255,255,255,.85); --c-arrow-bg: var(--saffron); --c-arrow-fg: var(--ink); }

.course--quiz {
  background: none; border: 1.5px dashed var(--dashed); justify-content: center;
}
.course--quiz:hover { transform: none; box-shadow: none; }
.course--quiz .course-title { font-size: 18px; line-height: 1.25; }
.course--quiz .btn { margin-top: 6px; align-self: start; padding: 10px 16px; font-size: 14px; }

/* ---------- Home: why Ilm Nuri ---------- */
.why { padding: 0 var(--gutter) 72px; }
.why .h2 { margin-bottom: 28px; }
.why-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.why-card { background: #fff; border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.why-num { font: 500 12px var(--font-mono); color: var(--text-3); }
.why-card h3 { margin: 8px 0 0; font: 600 20px/1.2 var(--font-display); letter-spacing: -.02em; }
.why-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.why-card--accent { background: var(--lapis); color: #fff; }
.why-card--accent .why-num { color: rgba(255, 255, 255, .75); }
.why-card--accent p { color: rgba(255, 255, 255, .85); }
.why-card--accent .btn { margin-top: auto; align-self: start; padding: 12px 20px; font-size: 14px; }

/* ---------- Home: trial lesson form ---------- */
.trial {
  margin: 0 var(--gutter) 56px; background: var(--ink); color: var(--paper); border-radius: 28px;
  padding: clamp(24px, 4vw, 44px); display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px;
  align-items: center; scroll-margin-top: 24px;
}
@media (min-width: 1392px) { .trial { margin-left: auto; margin-right: auto; max-width: 1168px; } }
.trial h3 { margin: 0 0 12px; font: 600 clamp(26px, 2.6vw, 32px)/1.12 var(--font-display); letter-spacing: -.03em; }
.trial p { margin: 0; font-size: 16px; line-height: 1.55; color: #c9c6bf; }
.trial-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trial-form input, .trial-form select {
  padding: 16px 18px; border-radius: 14px; background: var(--field-dark); color: var(--paper);
  border: 0; font: inherit; font-size: 15px; width: 100%; min-width: 0;
}
.trial-form input::placeholder { color: var(--muted); }
.trial-form select {
  appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.trial-form select:invalid { color: var(--muted); }
.trial-form option { color: var(--ink); background: #fff; }
.trial-form button { border-radius: 14px; padding: 16px 18px; font-size: 15px; border: 0; }
.trial-thanks { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; font-size: 16px; line-height: 1.5; }
.trial-thanks[hidden] { display: none; }
.check {
  width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--saffron); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px;
}

/* ---------- Home: location ---------- */
.location { padding: 0 var(--gutter) 64px; display: grid; grid-template-columns: 360px 1fr; gap: 20px; }
.location-card { background: #fff; border-radius: 22px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.location-card .h2 { font-size: 30px; }
.location-card .value { font-size: 15px; margin-top: 6px; }
.location-card .value-lg { font-weight: 600; font-size: 17px; margin-top: 6px; }
.location-card .note { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.location-card .value a { color: inherit; text-decoration: none; }
.phones { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.location-card .phones { flex-direction: column; }
.location-card .btn { margin-top: auto; padding: 14px 20px; font-size: 15px; }
.map { border-radius: 22px; overflow: hidden; min-height: 400px; background: var(--sand); }
.map iframe { width: 100%; height: 100%; min-height: 400px; border: 0; display: block; }

/* ---------- Home: socials ---------- */
.socials {
  padding: 0 var(--gutter) 48px; display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap;
}
.socials-title { font: 600 24px/1.15 var(--font-display); letter-spacing: -.02em; margin: 0; }
.socials-sub { font-size: 15px; color: var(--text-2); margin: 6px 0 0; }
.social-list { display: flex; gap: 10px; flex-wrap: wrap; }
.social {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 12px; background: #fff;
  border-radius: 999px; text-decoration: none; color: var(--ink); transition: box-shadow .15s;
}
.social:hover { color: var(--ink); box-shadow: 0 6px 18px rgba(27, 29, 34, .1); }
.social-icon {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.social-icon svg { width: 18px; height: 18px; fill: #fff; display: block; }
.social-name { display: block; font-weight: 600; font-size: 14px; }
.social-handle { display: block; font-size: 12px; color: var(--text-3); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); font-size: 14px; color: var(--text-3);
}
.site-footer .section { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 24px var(--gutter) 32px; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer .brand--footer { color: var(--ink); width: 100%; }
.site-footer .brand--footer .brand-logo { height: 32px; }
.site-footer .brand--footer .brand-name { font-size: 16px; }

/* ---------- Home: responsive ---------- */
@media (max-width: 1100px) {
  .course-grid { grid-template-columns: repeat(3, 1fr); }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 48px; }
  .hero-media { height: clamp(320px, 70vw, 460px); }
  .trial { grid-template-columns: 1fr; gap: 24px; }
  .location { grid-template-columns: 1fr; }
  .location-card .btn { margin-top: 4px; }
}
@media (max-width: 760px) {
  .course-grid { grid-template-columns: repeat(2, 1fr); }
  .why-grid { grid-template-columns: 1fr; }
}
/* ---------- Level test ---------- */
.lt { min-height: 100vh; display: flex; flex-direction: column; }
.lt-intro {
  max-width: 1180px; width: 100%; margin: 0 auto; padding: clamp(40px, 7vw, 80px) var(--gutter);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(28px, 5vw, 56px); align-items: start;
}
.pill-note {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; font-size: 13px; font-weight: 500;
}
.pill-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); }
.lt-intro h1 {
  margin: 24px 0 18px; font: 600 clamp(40px, 5.5vw, 60px)/1.04 var(--font-display);
  letter-spacing: -.04em; text-wrap: balance;
}
.lt-intro h1 span { color: var(--lapis); }
.lt-lead { margin: 0 0 32px; font-size: clamp(16px, 2vw, 18px); line-height: 1.55; color: var(--text-2); max-width: 460px; text-wrap: pretty; }
.lt-stats { display: flex; gap: clamp(20px, 4vw, 28px); flex-wrap: wrap; }
.lt-stats strong { display: block; font: 600 26px var(--font-display); }
.lt-stats span { display: block; font-size: 13px; color: var(--text-3); margin-top: 4px; }

.lt-panel { background: #fff; border-radius: 24px; padding: clamp(18px, 3vw, 28px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 10px; }
.subject {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; cursor: pointer;
  border: 2px solid var(--card-border); background: #fff; text-align: left;
}
.subject:hover { border-color: #d9d3c6; }
.subject[aria-checked="true"] { border-color: var(--lapis); background: #f3f5fc; }
.subject-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font: 700 13px var(--font-display);
}
.subject[aria-checked="true"] .subject-icon { background: var(--lapis); color: #fff; }
.subject-name { display: block; font-weight: 600; font-size: 15px; }
.subject-desc { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.lt-panel > .btn { margin-top: 8px; width: 100%; }

.lt-quiz { max-width: 760px; width: 100%; margin: 0 auto; padding: clamp(32px, 6vw, 64px) var(--gutter); }
.lt-quiz-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.lt-quiz-head span:last-child { font-family: var(--font-mono); color: var(--text-3); }
.progress { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress div { height: 6px; border-radius: 3px; background: var(--lapis); transition: width .3s; }
.lt-quiz .mono { display: block; margin-top: clamp(24px, 5vw, 40px); }
.lt-quiz h2 {
  margin: 12px 0 28px; font: 600 clamp(24px, 3.4vw, 34px)/1.25 var(--font-display);
  letter-spacing: -.02em; text-wrap: pretty;
}
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: clamp(14px, 2.5vw, 18px) clamp(14px, 2.5vw, 20px); min-height: 44px; border-radius: 18px; cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid var(--card-border);
}
.option:hover { border-color: #d9d3c6; }
.option[aria-checked="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.option-key {
  width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--paper); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font: 600 13px var(--font-mono);
}
.option[aria-checked="true"] .option-key { background: var(--saffron); }
.option-label { font-size: clamp(15px, 2vw, 17px); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.lt-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 36px; }
.lt-nav .btn { padding: 14px 22px; font-size: 15px; }
.lt-nav .btn-blue:disabled { background: var(--track); color: var(--muted); cursor: not-allowed; }

.lt-result {
  max-width: 1080px; width: 100%; margin: 0 auto; padding: clamp(40px, 7vw, 72px) var(--gutter);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: clamp(16px, 3vw, 24px); align-items: stretch;
}
.result-card {
  background: var(--lapis); color: #fff; border-radius: 28px; padding: clamp(22px, 4vw, 36px);
  min-width: 0; display: flex; flex-direction: column; gap: 14px;
}
.result-card .mono { color: #fff; opacity: .8; }
.result-level { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.result-level strong { font: 700 clamp(72px, 10vw, 112px)/1 var(--font-display); letter-spacing: -.04em; color: var(--saffron); }
.result-level span { font-size: 18px; font-weight: 600; }
.result-desc { font-size: 16px; line-height: 1.55; opacity: .9; max-width: 440px; margin: 0; }
.result-meta {
  margin-top: auto; display: flex; flex-wrap: wrap; gap: 20px 28px; padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .2);
}
.result-meta strong { display: block; font: 600 24px var(--font-display); }
.result-meta .course-rec { font-size: clamp(18px, 2.5vw, 24px); line-height: 1.2; }
.result-meta span { display: block; font-size: 13px; opacity: .75; margin-top: 4px; }
.result-meta > div { min-width: 0; }

.signup-card { background: #fff; border-radius: 28px; padding: clamp(22px, 4vw, 36px); min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.signup-card h3 { margin: 0; font: 600 clamp(22px, 3vw, 26px)/1.15 var(--font-display); letter-spacing: -.02em; }
.signup-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.signup-card form { display: flex; flex-direction: column; gap: 14px; }
.signup-card input {
  padding: 16px 18px; border-radius: 14px; border: 1px solid rgba(27, 29, 34, .12); background: var(--paper);
  font: inherit; font-size: 16px; width: 100%;
}
.signup-card input:focus { outline: 2px solid var(--lapis); outline-offset: 1px; }
.signup-card .btn { width: 100%; }
.signup-card .restart { margin-top: auto; padding: 14px; font-size: 15px; }

/* ---------- Form feedback ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { margin: 0; grid-column: 1 / -1; font-size: 14px; line-height: 1.45; font-weight: 500; }
.trial .form-error { color: var(--saffron); }
.signup-card .form-error { color: #b42318; }
.trial-form [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--saffron); }
.signup-card [aria-invalid="true"] { border-color: #b42318; box-shadow: inset 0 0 0 1px #b42318; }
button:disabled.btn-saffron { opacity: .7; cursor: progress; }

/* ---------- Header extras ---------- */
.home-link { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
.home-link:hover { color: var(--lapis); }
.mobile-cta { display: none; }

/* ---------- Phones (≤ 640px) ---------- */
@media (max-width: 640px) {
  html { scroll-padding-top: 76px; }
  body { -webkit-tap-highlight-color: transparent; }
  .btn:active, .course:active, .subject:active, .option:active, .filters button:active { transform: scale(.98); }

  /* Header: one compact row that stays on top */
  .site-header {
    position: sticky; top: 0; z-index: 30; flex-wrap: nowrap; gap: 10px; padding: 10px 16px;
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  }
  .brand { gap: 8px; min-width: 0; }
  .brand-logo { height: 30px; }
  .brand-name { font-size: 16px; white-space: nowrap; }
  .header-actions { flex-wrap: nowrap; gap: 8px; }
  .site-header .btn-sm { display: none; } /* replaced by .mobile-cta */
  .lang-switch { font-size: 12px; padding: 2px; }
  .lang-switch button { padding: 6px 9px; min-height: 32px; }
  .home-link {
    width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 1px solid var(--line-2);
    display: flex; align-items: center; justify-content: center; font-size: 0; flex: none;
  }
  .home-link::before { content: "←"; font-size: 17px; font-weight: 600; }

  /* Pinned trial-lesson button */
  .mobile-cta {
    display: flex; position: fixed; z-index: 40; left: 16px; right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom)); padding: 15px 20px;
    box-shadow: 0 10px 28px rgba(47, 79, 168, .35);
    transform: translateY(calc(100% + 24px)); opacity: 0; pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
  }
  .mobile-cta.is-visible { transform: none; opacity: 1; pointer-events: auto; }
  .site-footer .section { padding-bottom: 96px; }

  /* Hero */
  .hero { gap: 28px; padding: 28px 16px 40px; }
  .hero h1 { font-size: clamp(34px, 11.4vw, 50px); line-height: 1.06; margin-bottom: 16px; text-wrap: initial; }
  .hero p { margin-bottom: 24px; font-size: 16px; }
  .hero-ctas { gap: 10px; }
  .hero-ctas .btn { flex: 1 1 100%; padding: 15px 22px; font-size: 15px; }
  .hero-media { height: clamp(280px, 82vw, 380px); }
  .hero-photo { inset: 0 0 0 12px; border-radius: 999px 999px 20px 20px; }
  .hero-photo .credit { display: none; } /* would sit under the badge; Unsplash doesn't require it */
  .hero-badge { left: 0; right: 20px; bottom: 16px; padding: 12px 14px; gap: 12px; border-radius: 16px; max-width: none; }
  .hero-badge-icon { width: 40px; height: 40px; font-size: 13px; }
  .hero-badge strong { font-size: 14px; line-height: 1.3; }
  .hero-badge small { font-size: 12px; }
  .hero-badge-dots { margin-top: 6px; }

  /* Section rhythm */
  .h2 { font-size: 26px; }
  .courses { padding: 8px 0 48px; }
  .courses-head { padding: 0 16px; margin-bottom: 16px; gap: 14px; }
  .why { padding: 0 16px 48px; }
  .why .h2 { margin-bottom: 16px; }

  /* Filters: one swipeable row */
  .filters {
    flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 2px 16px 4px;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; white-space: nowrap; padding: 9px 14px; }

  /* Course cards: compact two-column tiles */
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 16px; }
  .course { padding: 16px; border-radius: 18px; gap: 6px; min-height: 150px; }
  .course-tag { font-size: 10px; }
  .course-title { font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
  .course-desc { font-size: 12.5px; line-height: 1.45; }
  .course-foot { padding-top: 6px; }
  .course-foot span:first-child { display: none; }
  .course-foot { justify-content: flex-end; }
  .course-arrow { width: 30px; height: 30px; font-size: 14px; }
  .course--dark { grid-column: 1 / -1; min-height: 0; } /* 13th card: full width so no gap is left */
  .course--quiz { grid-column: 1 / -1; min-height: 0; padding: 18px; }
  .course--quiz .course-title { font-size: 17px; }

  /* Why cards: tighter, number beside the title */
  .why-grid { gap: 10px; }
  .why-card { padding: 18px 18px 20px; border-radius: 18px; gap: 6px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; }
  .why-num { grid-row: 1; }
  .why-card h3 { margin: 0; font-size: 17px; }
  .why-card p, .why-card .btn { grid-column: 1 / -1; }
  .why-card p { font-size: 14px; }
  .why-card--accent .btn { margin-top: 8px; justify-self: start; }

  /* Trial form */
  .trial { margin: 0 16px 40px; padding: 22px; border-radius: 22px; gap: 18px; }
  .trial h3 { font-size: 24px; }
  .trial p { font-size: 15px; }
  .trial-form { grid-template-columns: 1fr; gap: 10px; }
  .trial-form input, .trial-form select, .signup-card input { font-size: 16px; } /* 16px stops iOS zooming on focus */

  /* Location, socials, footer */
  .location { padding: 0 16px 40px; gap: 12px; }
  .location-card { padding: 22px; gap: 14px; border-radius: 20px; }
  .location-card .h2 { font-size: 24px; }
  .map, .map iframe { min-height: 260px; }
  .map { border-radius: 20px; }
  .socials { padding: 0 16px 40px; gap: 16px; }
  .socials-title { font-size: 21px; }
  .social-list { width: 100%; flex-direction: column; }
  .social { width: 100%; }
  .social-handle { overflow-wrap: anywhere; }
  .site-footer .section { padding-left: 16px; padding-right: 16px; font-size: 13px; flex-direction: column; align-items: flex-start; }

  /* Level test: intro */
  .lt-intro { padding: 24px 16px 32px; gap: 24px; }
  .lt-intro h1 { font-size: clamp(34px, 10vw, 42px); margin: 16px 0 12px; }
  .lt-lead { margin-bottom: 20px; font-size: 15px; }
  .lt-stats { gap: 24px; }
  .lt-stats strong { font-size: 22px; }
  .lt-panel { padding: 16px; border-radius: 22px; gap: 12px; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .subject { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 14px; min-height: 96px; }
  .subject-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
  .subject-name { font-size: 14px; line-height: 1.25; }
  .subject-desc { font-size: 11.5px; }
  .lt-panel > .btn {
    position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 4px;
    box-shadow: 0 10px 26px rgba(27, 29, 34, .25);
  }

  /* Level test: quiz */
  .lt-quiz { padding: 20px 16px 0; }
  .lt-quiz .mono { margin-top: 24px; }
  .lt-quiz h2 { font-size: clamp(21px, 6.2vw, 26px); margin: 10px 0 20px; }
  .options { gap: 10px; }
  .option { padding: 14px; border-radius: 16px; gap: 12px; min-height: 56px; }
  .option-label { font-size: 16px; }
  .lt-nav {
    position: sticky; bottom: 0; z-index: 5; margin: 24px -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--paper) 75%, color-mix(in srgb, var(--paper) 0%, transparent));
  }
  .lt-nav .btn { flex: 1; padding: 15px 16px; }
  .lt-nav .btn-outline { flex: 0 0 auto; }

  /* Level test: result */
  .lt-result { padding: 24px 16px 40px; gap: 12px; }
  .result-card, .signup-card { padding: 22px; border-radius: 22px; }
  .result-level strong { font-size: 72px; }
  .result-meta { gap: 16px 24px; }
}

@media (max-width: 360px) {
  .brand-name { display: none; }
  .course-grid { grid-template-columns: 1fr; }
  .course { min-height: 0; }
}

[hidden] { display: none !important; }
