/* ==========================================================================
   Beyond STEM — styles
   Colors, fonts and radii live in :root — change them there.
   ========================================================================== */
:root {
  --navy: #141f45;
  --navy-2: #1d2a5a;
  --blue: #2f5bff;
  --blue-soft: #dbe4ff;
  --yellow: #ffc93c;
  --yellow-soft: #ffe8ad;
  --green: #1a8a3c;
  --green-dark: #136b2e;
  --green-soft: #d6f2de;
  --gray-soft: #e6e9f1;
  --bg: #ffffff;
  --bg-tint: #f3f6fd;
  --text: #141f45;
  --muted: #5a6382;
  --line: #e3e8f4;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 1px 2px rgba(20, 31, 69, .06), 0 8px 24px rgba(20, 31, 69, .06);
  --container: 1180px;
  --header-h: 72px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0; }
address { font-style: normal; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }

.icon {
  width: 1.15em; height: 1.15em; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  padding: .85em 1.4em;
  font: 700 15px/1 var(--font-body);
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .15s, background-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
/* Primary = "text us" (green, like a sent text bubble) */
.btn--primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn--soft { background: var(--blue-soft); color: var(--blue); }
.btn--outline { border-color: var(--navy); color: var(--navy); background: #fff; }
/* Hover effects only on devices with a real pointer (no sticky hover on phones) */
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); }
  .btn--primary:hover { background: #1c9642; }
  .btn--outline:hover { background: var(--bg-tint); }
}
.btn--sm { padding: .7em 1.1em; font-size: 14px; border-radius: 999px; box-shadow: none; }
.btn--lg { padding: 1.05em 1.6em; font-size: 17px; }
.btn--block { width: 100%; }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header__inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.logo__mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--blue); color: #fff; font-size: 22px;
}
.logo__text { display: flex; flex-direction: column; line-height: 1.1; }
.logo__text strong { font: 800 18px/1.1 var(--font-display); white-space: nowrap; }
.logo__text small { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 26px; }
.nav a { text-decoration: none; font-size: 14px; font-weight: 600; color: var(--navy); }
.nav a:hover { color: var(--blue); }

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 64px;
  background:
    radial-gradient(circle, rgba(47, 91, 255, .12) 1px, transparent 1.4px) 0 0 / 22px 22px,
    var(--bg-tint);
  border-bottom: 1px solid var(--line);
}
.hero__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding: 0; list-style: none; }
.tags li {
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
}
.hero__title {
  font: 800 clamp(42px, 6vw, 68px)/0.98 var(--font-display);
  letter-spacing: -0.035em;
}
.hero__title span { color: var(--blue); }
.hero__lead { margin: 22px 0 28px; font-size: 18px; color: var(--muted); max-width: 30em; }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.badge-free {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .75em 1.1em;
  font: 800 17px/1 var(--font-display);
  background: var(--yellow); border-radius: 12px;
  transform: rotate(-3deg);
  box-shadow: 0 4px 0 #e0a910;
}
.hero__call, .hero__hint, .lbl-short { display: none; }
.hero__hint { margin: -2px 0 4px; font-size: 13px; color: var(--muted); text-align: center; }
.hero__alt { margin-top: 16px; font-size: 14px; color: var(--muted); }
.hero__alt a { color: var(--blue); font-weight: 600; text-decoration: none; cursor: pointer; }
.hero__loc { display: flex; align-items: flex-start; gap: 6px; margin-top: 18px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.hero__loc .icon { margin-top: 1px; color: var(--blue); }
.hero__loc a { color: var(--blue); }

.hero__media { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.media--wide { grid-column: 1 / -1; aspect-ratio: 16 / 9; }

/* Photo slots: the <img> covers the placeholder; if the file is missing the img is removed */
.media {
  position: relative; overflow: hidden;
  min-height: 150px; aspect-ratio: 4 / 3;
  border-radius: var(--radius);
}
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.media__ph {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; text-align: center;
  font-size: 12px; font-weight: 600;
  border: 2px dashed currentColor; border-radius: inherit; opacity: .85;
}
.media__ph .icon { width: 34px; height: 34px; stroke-width: 1.6; }
.media--blue { background: var(--blue-soft); color: var(--blue); }
.media--yellow { background: var(--yellow-soft); color: #8a5b00; }
.media--green { background: var(--green-soft); color: var(--green-dark); }
.media--gray { background: var(--gray-soft); color: var(--navy); }

/* ---------- Sections ---------- */
.section { padding: 72px 0 32px; }
.section--tight { padding-top: 40px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 8px;
}
.eyebrow--yellow { color: var(--yellow); }
.section__title { font: 800 clamp(30px, 4vw, 40px)/1.1 var(--font-display); letter-spacing: -0.03em; margin-bottom: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* Features */
.feature { padding: 24px 20px; background: var(--bg-tint); border-radius: var(--radius); }
.feature h3 { font-size: 17px; margin: 16px 0 8px; }
.feature p { font-size: 14px; color: var(--muted); }
.feature__icon {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; color: #fff; font-size: 22px;
}
.feature__icon--blue { background: var(--blue); }
.feature__icon--green { background: var(--green); }
.feature__icon--yellow { background: var(--yellow); color: var(--navy); }
.feature__icon--navy { background: var(--navy); }

/* Approach (Russian math & engineering rigor) */
.approach { padding: 56px 0 16px; }
.approach__inner {
  display: grid; grid-template-columns: 6fr 5fr; gap: 40px; align-items: center;
  padding: 44px;
  color: #fff; background: var(--navy); border-radius: var(--radius-lg);
  background-image: radial-gradient(circle, rgba(255, 255, 255, .07) 1px, transparent 1.4px);
  background-size: 22px 22px;
}
.approach__title { font: 800 clamp(26px, 3.2vw, 36px)/1.12 var(--font-display); letter-spacing: -0.025em; }
.approach__lead { margin-top: 16px; font-size: 16px; color: rgba(255, 255, 255, .78); }
.approach__list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.approach__list li {
  display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start;
  padding: 16px 18px; background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius);
}
.approach__icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  font-size: 18px; color: var(--navy); background: var(--yellow); border-radius: 10px;
}
.approach__list h3 { margin: 2px 0 4px; font-size: 16px; }
.approach__list p { font-size: 14px; color: rgba(255, 255, 255, .75); }

/* Teachers */
.teachers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.teacher { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.teacher__photo { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; }
/* Square photos cropped to 4:3, keeping the face in frame */
.teacher__photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.teacher__photo .icon { width: 56px; height: 56px; stroke-width: 1.6; }
.teacher__body { padding: 24px 28px 28px; }
.teacher h3 { font: 800 26px/1.1 var(--font-display); letter-spacing: -0.02em; }
.teacher__role { margin: 6px 0 14px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
.teacher__bio { font-size: 15px; color: var(--muted); }
.teacher__facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.teacher__facts li { padding: 6px 12px; font-size: 13px; font-weight: 600; background: var(--bg-tint); border-radius: 999px; }

/* Pricing + contact */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { padding: 32px; border-radius: var(--radius-lg); }
.card--dark { background: var(--navy); color: #fff; }
.card--light { display: flex; flex-direction: column; background: var(--bg-tint); }
.card__title { font: 800 clamp(26px, 3vw, 32px)/1.1 var(--font-display); letter-spacing: -0.03em; margin-bottom: 24px; }

.price {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 18px 4px; border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.price strong { font: 800 22px/1 var(--font-display); white-space: nowrap; }
.price small { font: 500 13px var(--font-body); opacity: .75; }
.price--free {
  align-items: center; padding: 18px 16px; margin-bottom: 4px;
  background: var(--yellow); color: var(--navy); border-radius: 12px; border: 0;
}
.price--free span { font-weight: 700; }
.price--free strong { font-size: 28px; }
.price__tag {
  display: inline-block; margin-left: 8px; padding: 3px 8px;
  font: 700 10px/1.2 var(--font-body); font-style: normal;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--navy); background: var(--yellow); border-radius: 999px;
  vertical-align: 2px;
}
.price__note { margin: 18px 0 22px; font-size: 13px; opacity: .8; }

.contacts { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 14px; }
.contact { display: flex; align-items: center; gap: 14px; min-height: 48px; text-decoration: none; cursor: pointer; }
.contact small { display: block; font-size: 12px; color: var(--muted); }
.contact strong { font-size: 16px; }
@media (hover: hover) { .contact:hover strong { color: var(--blue); } }
.contact__icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; font-size: 20px; }
.contact__icon--green { background: var(--green-soft); color: var(--green); }
.contact__icon--blue { background: var(--blue-soft); color: var(--blue); }
.card--light .btn--block { margin-top: auto; }

/* Location */
.location {
  display: grid; grid-template-columns: 5fr 7fr; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.location__info { padding: 32px; }
.location__info address { margin-bottom: 24px; font-size: 16px; line-height: 1.6; }
.location__map { min-height: 340px; background: var(--bg-tint); }
.location__map iframe { display: block; width: 100%; height: 100%; min-height: 340px; border: 0; }

/* Footer */
.footer { margin-top: 64px; padding: 28px 0; background: var(--navy); color: rgba(255, 255, 255, .8); font-size: 13px; }
.footer strong { color: #fff; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Legal pages (privacy.html) */
.legal { padding: 48px 0 24px; }
.legal__inner { max-width: 720px; }
.legal__title { font: 800 clamp(34px, 5vw, 46px)/1.05 var(--font-display); letter-spacing: -0.03em; }
.legal__date { margin: 10px 0 28px; font-size: 14px; color: var(--muted); }
.legal h2 { margin: 32px 0 10px; font: 800 22px/1.2 var(--font-display); letter-spacing: -0.01em; }
.legal p { margin-bottom: 12px; color: #333c5c; }
.legal a { color: var(--blue); font-weight: 600; }
.legal__contact { margin-top: 4px; line-height: 1.7; }
/* Pages without the sticky booking bar don't need extra space under the footer */
.footer.footer--plain { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

/* Desktop "text us" panel */
.text-dialog {
  width: min(440px, calc(100% - 32px)); padding: 32px 28px 26px;
  border: 0; border-radius: var(--radius-lg);
  color: var(--text); background: #fff;
  box-shadow: 0 24px 64px rgba(20, 31, 69, .28);
}
.text-dialog::backdrop { background: rgba(20, 31, 69, .55); }
.text-dialog__close {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center; width: 36px; height: 36px;
  font-size: 20px; color: var(--muted); background: var(--bg-tint);
  border: 0; border-radius: 50%; cursor: pointer;
}
.text-dialog__title { font: 800 28px/1.1 var(--font-display); letter-spacing: -0.02em; }
.text-dialog__number {
  display: block; margin: 14px 0 20px;
  font: 800 34px/1 var(--font-display); letter-spacing: -0.01em; -webkit-user-select: all; user-select: all;
  color: var(--green); text-decoration: none;
}
.text-dialog__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.text-dialog__msg {
  margin: 6px 0 18px; padding: 12px 14px;
  font-size: 15px; background: var(--bg-tint); border-radius: 14px 14px 14px 4px;
  -webkit-user-select: all; user-select: all;
}
.text-dialog__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.text-dialog__actions .btn { flex: 1 1 auto; }
.text-dialog__actions .btn.is-done { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: none; }
.text-dialog__note { margin-top: 16px; font-size: 13px; color: var(--muted); }
.text-dialog__note a { color: var(--blue); font-weight: 600; cursor: pointer; }

/* Sticky CTA bar (phones and tablets only) */
.sticky-cta { display: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
}

/* ---------- Tablets and large phones ---------- */
@media (max-width: 860px) {
  .hero__grid, .split, .location, .approach__inner { grid-template-columns: 1fr; }
  .approach__inner { gap: 24px; padding: 32px 28px; }
  .hero { padding: 28px 0 48px; }
  .hero__grid { gap: 32px; }
  .hero__media { max-width: 560px; }
  .teachers { gap: 16px; }
  .location__map, .location__map iframe { min-height: 280px; }

  /* Always-reachable booking buttons; shown once the hero buttons scroll away */
  .sticky-cta {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: 3fr 2fr; gap: 8px;
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(20, 31, 69, .08);
    transform: translateY(110%); transition: transform .25s ease;
  }
  .sticky-cta.is-visible { transform: none; }
  /* One booking button at a time: the header button steps aside for the bar */
  .header .btn--sm { transition: opacity .2s; }
  .has-sticky-cta .header .btn--sm { opacity: 0; pointer-events: none; }
  .sticky-cta .btn { min-height: 52px; padding: 0 .6em; font-size: 16px; }
  /* Leave room so the bar never covers the end of the page */
  .footer { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ---------- Phones ---------- */
@media (max-width: 560px) {
  :root { --header-h: 60px; }
  .container { padding: 0 max(16px, env(safe-area-inset-left)); }
  .section { padding: 48px 0 8px; }
  .section--tight { padding-top: 32px; }
  .section__title { margin-bottom: 20px; }

  /* Header: logo + one clear action */
  .header__inner { gap: 12px; }
  .logo__mark { width: 36px; height: 36px; font-size: 20px; }
  .logo__text strong { font-size: 17px; }
  .logo__text small { display: none; }
  .header .btn--sm { min-height: 40px; padding: 0 14px; font-size: 14px; }

  /* Hero: headline, offer and both booking buttons fit the first screen */
  .hero { padding: 20px 0 36px; }
  .hero__grid { gap: 28px; }
  .tags { gap: 6px; margin-bottom: 16px; }
  .tags li { padding: 5px 10px; font-size: 11px; }
  .hero__title { font-size: clamp(36px, 11.2vw, 46px); }
  .hero__lead { margin: 14px 0 18px; font-size: 16.5px; }
  .hero__actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero__actions .btn { width: 100%; min-height: 56px; padding-block: 0; }
  .badge-free { order: -1; align-self: flex-start; margin-bottom: 6px; padding: .6em .95em; font-size: 16px; }
  .hero__call { display: inline-flex; }
  .hero__hint { display: block; }
  .hero__alt { display: none; }
  .hero__loc { margin-top: 14px; }
  .hero__media { gap: 8px; }
  .hero__media .media--wide { aspect-ratio: 16 / 10; }
  .hero__media .media:not(.media--wide) { min-height: 0; aspect-ratio: 1 / 1; }

  /* Location: big tap target for directions */
  .location__info { padding: 22px 20px 20px; }
  .location__info .btn { width: 100%; min-height: 52px; }
  .location__map, .location__map iframe { min-height: 240px; }

  /* Programs: compact rows, icon beside text */
  .grid-4 { grid-template-columns: 1fr; gap: 10px; }
  .feature { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 16px; }
  .feature h3 { margin: 2px 0 4px; font-size: 16px; }

  /* Approach */
  .approach { padding-top: 40px; }
  .approach__inner { padding: 26px 18px 18px; border-radius: 20px; }
  .approach__title { font-size: 25px; }
  .approach__lead { font-size: 15px; }
  .approach__list li { padding: 14px; gap: 12px; }

  /* Teachers */
  .teachers { grid-template-columns: 1fr; }
  .teacher__photo { aspect-ratio: 5 / 4; }
  .teacher__body { padding: 18px 18px 22px; }
  .teacher h3 { font-size: 23px; }
  .teacher__facts li { font-size: 12.5px; }

  /* Pricing + contact */
  .card { padding: 24px 18px; }
  .price { padding: 16px 2px; }
  .price span { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .price__tag { margin-left: 0; }
  .price--free { padding: 14px 14px; }
  .card--dark .btn, .card--light .btn--block { width: 100%; min-height: 56px; padding-block: 0; }
  .contacts { gap: 10px; margin-bottom: 24px; }

  .footer { margin-top: 40px; }
  .footer__inner { flex-direction: column; gap: 12px; text-align: center; }
}

/* ---------- Small phones (iPhone SE 1st gen, compact Androids) ---------- */
@media (max-width: 374px) {
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .tags li:last-child { display: none; }
  .hero__lead { font-size: 16px; }
  .btn--lg { font-size: 16px; }
  .sticky-cta .btn { font-size: 15px; }
}

/* ---------- Phones in landscape: keep the bar slim ---------- */
@media (max-height: 500px) and (orientation: landscape) {
  .sticky-cta .btn { min-height: 44px; }
  .footer { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .sticky-cta { transition: none; }
}
