/* =========================================================
   Template 8: "Signature Contrast" (dark + light mixed on one page)
   Same design as Template 6 (loads css/template-6.css first).
   Any element with class .flip (and inner-page .page-hero / #why) uses the
   OPPOSITE token set to the page. The page opens light, so those blocks are
   dark; the theme toggle swaps the whole mix. Never nest .flip inside .flip.
   ========================================================= */

/* ---- Dark token set: page in dark mode, or a flipped block in light mode ---- */
:root,
[data-theme="dark"],
[data-theme="light"] .flip,
[data-theme="light"] .page-hero,
[data-theme="light"] #why {
  --bg: #050d24;
  --bg-2: #08132f;
  --surface: #0b1838;
  --surface-2: #0f1f47;
  --border: rgba(140, 170, 255, 0.12);
  --border-strong: rgba(140, 170, 255, 0.24);
  --heading: #ffffff;
  --text: #cdd6ec;
  --muted: #8f9bbb;
  --blue: #7aa2ff;
  --logo-cap: #ffffff;
  --logo-ink: #ffffff;
  --header-bg: rgba(5, 13, 36, 0.86);
  --card-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.75);
  --glow-orange: 0 12px 30px -8px rgba(255, 132, 18, 0.6);
  --glow-blue: 0 24px 50px -24px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 132, 18, 0.35);
  --tint: rgba(140, 170, 255, 0.08);
  --tint-orange: rgba(255, 132, 18, 0.14);
  --card-bg: linear-gradient(160deg, rgba(20, 40, 92, 0.75), rgba(11, 24, 56, 0.9));
  --stars: 1;
  color-scheme: dark;
}
/* ---- Light token set: page in light mode, or a flipped block in dark mode ---- */
html[data-theme="light"],
[data-theme="dark"] .flip,
[data-theme="dark"] .page-hero,
[data-theme="dark"] #why {
  --bg: #ffffff;
  --bg-2: #f3f6fc;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #e4e9f3;
  --border-strong: #cfd8ea;
  --heading: #0a2350;
  --text: #3a4663;
  --muted: #65718c;
  --blue: #1f4aa8;
  --logo-cap: #0a2350;
  --logo-ink: #0a2350;
  --header-bg: rgba(255, 255, 255, 0.9);
  --card-shadow: 0 16px 36px -22px rgba(10, 35, 80, 0.22);
  --glow-orange: 0 12px 26px -10px rgba(255, 132, 18, 0.5);
  --glow-blue: 0 22px 44px -22px rgba(10, 35, 80, 0.32);
  --tint: #eef2fa;
  --tint-orange: #fff2e4;
  --card-bg: #ffffff;
  --stars: 0;
  color-scheme: light;
}
.flip, .page-hero, #why { background-color: var(--bg); color: var(--text); }

/* Cards follow whichever token set they sit in */
.course-card, .feature, .review, .t6-step:not(.t6-step--hl), .t6-tag, .t6-planet { background: var(--card-bg); }
.t6-planet, .t6-tag { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.course-card:hover, .feature:hover, .review:hover { border-color: var(--accent); box-shadow: var(--glow-orange); }
.review__role { color: var(--muted); }

/* ---------- Hero: a rounded panel in the opposite theme ---------- */
.t8-hero {
  border-radius: 0 0 56px 56px; padding-bottom: 130px;
  background:
    radial-gradient(circle at 78% 42%, rgba(31, 74, 168, calc(0.12 + 0.33 * var(--stars))), transparent 38%),
    radial-gradient(circle at 92% 8%, var(--tint-orange), transparent 30%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}
.t8-stars {
  position: absolute; inset: 0; pointer-events: none; opacity: calc(0.55 * var(--stars));
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff, transparent 60%),
    radial-gradient(1px 1px at 28% 68%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 46% 14%, #ffd3a6, transparent 60%),
    radial-gradient(1px 1px at 58% 84%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 72% 10%, #fff, transparent 60%),
    radial-gradient(1px 1px at 86% 62%, #ffd3a6, transparent 60%),
    radial-gradient(1px 1px at 94% 30%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 6% 80%, #fff, transparent 60%),
    radial-gradient(1px 1px at 38% 40%, #fff, transparent 60%);
}
.t8-hero .t6-orbit__core {
  background: radial-gradient(circle at 35% 30%, var(--surface-2), var(--bg-2) 75%);
  box-shadow: 0 0 0 16px var(--tint), 0 0 80px -10px rgba(47, 110, 255, calc(0.15 + 0.4 * var(--stars)));
}
.t8-hero .t6-orbit__ring--inner { border-color: rgba(255, 132, 18, 0.3); }

/* ---------- Orange ribbon crossing the dark/light boundary ---------- */
.t8-ribbon {
  position: relative; z-index: 3; width: 104%; margin: -34px -2% 0;
  transform: rotate(-1.6deg); background: var(--accent); color: #061029;
  box-shadow: 0 20px 40px -20px rgba(255, 132, 18, 0.6);
}
.t8-ribbon .t6-marquee__track span::after { color: #061029; }
/* The tilted ribbon is wider than the screen on purpose: clip it so the page never gets wider than the phone
   (clip, unlike hidden, doesn't create a scroll box, so sticky elements inside keep working). */
main { overflow-x: clip; }

/* ---------- Rounded panels for the flipped sections ---------- */
.t8-panel,
#why { margin-inline: clamp(10px, 2vw, 24px); border-radius: 48px; }
.t6-journey.t8-panel {
  background: radial-gradient(ellipse at 50% 0, var(--tint-orange), transparent 55%), var(--bg);
}
.t8-projects.t8-panel { margin-bottom: 40px; }

/* ---------- New-institute sections: admissions note, projects, what to expect ---------- */
.t8-open { display: inline-flex; align-items: center; gap: 12px; margin-left: 5px; }
.t8-open i { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2); }
.t8-projects__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.t8-project {
  display: grid; gap: 10px; align-content: start; padding: 28px 24px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--card-bg); color: var(--text);
}
.t8-project:hover { border-color: var(--accent); box-shadow: var(--glow-orange); }
.t8-project__icon { width: 56px; height: 56px; padding: 11px; border-radius: 16px; background: var(--tint); }
.t8-project__icon svg { width: 100%; height: 100%; }
.t8-project small { color: var(--accent); font-weight: 600; font-size: 13px; }
.t8-project h3 { font-size: 20px; }
.t8-project p { color: var(--muted); font-size: 14.5px; }
.t8-expect { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .t8-projects__grid, .t8-expect { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .t8-projects__grid { grid-template-columns: 1fr; } .t8-hero .t6-proof-sep { display: none; } }
.t8-panel .carousel__btn { background: var(--surface-2); }

/* "Succeed" step is orange in both mixes so it stands out on either panel */
.t6-step--hl {
  background: linear-gradient(150deg, #ff8412, #e0600a); border: 0; box-shadow: 0 30px 60px -30px rgba(255, 132, 18, 0.7);
  --heading: #ffffff; --text: #fff4e8; --muted: #ffe2c4; --border: rgba(255, 255, 255, 0.3); --border-strong: rgba(255, 255, 255, 0.6);
}
.t6-step--hl h3::after,
.t6-step--hl .t6-step__list li::before { color: #061029; }

/* ---------- Inner pages: hero + #why flip ---------- */
.page-hero { border-radius: 0 0 48px 48px; border-bottom: 0; }
.page-hero::before { border-color: var(--border-strong); }
.page-hero__icon, .hero__orb { background: radial-gradient(circle at 35% 30%, var(--surface-2), var(--bg-2) 75%); }
#why { padding-block: 80px; }

@media (max-width: 640px) {
  .t8-hero { border-radius: 0 0 32px 32px; padding-bottom: 100px; }
  .t8-panel, #why { border-radius: 30px; margin-inline: 8px; }
  .page-hero { border-radius: 0 0 30px 30px; }
}

/* Stats band follows its surroundings (it sits next to flipped panels, so a navy band would merge with them) */
.stats-band { padding-bottom: 60px; }
.stats { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--card-shadow); }
.stat b { color: var(--heading); }
.stat span { color: var(--muted); }
.stat + .stat { border-color: var(--border); }

/* FAQ plus/minus: drawn with two bars instead of a "+" character, so it sits exactly in the middle of the circle */
.faq summary::after {
  content: ""; color: var(--heading);
  background: linear-gradient(currentColor, currentColor) center no-repeat, linear-gradient(currentColor, currentColor) center no-repeat var(--tint);
  background-size: 12px 2px, 2px 12px;
}
.faq[open] summary::after {
  color: #fff; transform: none;
  background: linear-gradient(currentColor, currentColor) center no-repeat, linear-gradient(currentColor, currentColor) center no-repeat var(--accent);
  background-size: 12px 2px, 2px 0;
}

/* Social icons: official logo shapes (js/layout.js) in each brand's own colours */
.socials .social { width: 40px; height: 40px; }
.socials .social svg { width: 20px; height: 20px; }
.socials .social--youtube, .socials .social--youtube:hover { background: #fff; color: #f00; }
.socials .social--youtube svg { width: 25px; height: 25px; }
.socials .social--linkedin, .socials .social--linkedin:hover { background: #0a66c2; }
.socials .social--instagram, .socials .social--instagram:hover {
  background:
    radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}
.socials .social--x, .socials .social--x:hover { background: #000; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); }
.socials .social--x svg { width: 18px; height: 18px; }
.socials .social--telegram, .socials .social--telegram:hover { background: #26a5e4; }

/* =========================================================
   Motion (html.motion is set by js/motion.js, never for reduced-motion visitors)
   ========================================================= */
/* Kept light for PageSpeed: looping animations use only transform/opacity, and hero text is visible at first paint. */

/* Scroll progress line: CSS only (browsers without scroll timelines just don't show it) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .header::before {
      content: ""; position: absolute; inset: auto 0 -1px; height: 3px; pointer-events: none;
      background: linear-gradient(90deg, #ff8412, #ffb15c); transform-origin: 0 50%;
      animation: t8-progress linear both; animation-timeline: scroll(root);
    }
  }
}
@keyframes t8-progress { from { transform: scaleX(0); } }

/* Scroll-in: cards grow slightly, side columns slide from their own side */
.motion .reveal { transition-duration: 0.9s; }
.motion .reveal:not(.in):is(.course-card, .course-tile, .feature, .t8-project, .t6-step, .contact-card, .member) { transform: translateY(34px) scale(0.95); }
.motion .reveal:not(.in):is(.why__intro, .split__media) { transform: translateX(-44px); }
.motion .reveal:not(.in):is(.split__text, .map) { transform: translateX(44px); }
.motion .reveal:not(.in).cta { transform: translateY(30px) scale(0.97); }

/* Heroes: the text rises line by line. Transform only and no JS, so it never delays the first paint. */
.t6-hero__content.reveal, .page-hero__inner.reveal { opacity: 1; transform: none; }
.t6-hero__content > *, .page-hero__inner > :not(.page-hero__icon) { animation: t8-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) both; }
.t6-hero__content > :nth-child(2), .page-hero__inner > :nth-child(2):not(.page-hero__icon) { animation-delay: 0.06s; }
.t6-hero__content > :nth-child(3), .page-hero__inner > :nth-child(3):not(.page-hero__icon) { animation-delay: 0.12s; }
.t6-hero__content > :nth-child(4) { animation-delay: 0.18s; }
.t6-hero__content > :nth-child(5) { animation-delay: 0.24s; }
@keyframes t8-rise { from { transform: translateY(26px); } }

/* Hero: depth that follows the mouse */
.motion .t6-orbit > * { transition: translate 0.5s ease-out; }
.motion .t6-orbit__core { translate: calc(var(--px, 0) * 18px) calc(var(--py, 0) * 18px); }
.motion .t6-orbit__track { translate: calc(var(--px, 0) * -14px) calc(var(--py, 0) * -14px); }
.motion .t6-tag { translate: calc(var(--px, 0) * 34px) calc(var(--py, 0) * 34px); }

/* "Admissions open" dot */
.t8-open i { position: relative; }
.motion .t8-open i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #22c55e; animation: t8-ping 2s ease-out infinite; }
@keyframes t8-ping { from { opacity: 0.55; } to { opacity: 0; transform: scale(3); } }

/* Cards: lift, plus a soft glow under the mouse */
:is(.course-card, .feature, .t8-project, .t6-step, .contact-card, .member) { position: relative; }
.t8-project, .t6-step { transition: opacity 0.9s var(--ease), transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s; }
.motion :is(.t8-project, .t6-step).reveal { transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.motion :is(.t8-project, .t6-step):hover { transform: translateY(-6px); }
.motion :is(.course-card, .course-tile, .feature, .t8-project, .t6-step, .contact-card, .member)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.35s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 132, 18, 0.13), transparent 70%);
}
@media (hover: hover) {
  .motion :is(.course-card, .course-tile, .feature, .t8-project, .t6-step, .contact-card, .member):hover::after { opacity: 1; }
}
.course-card__icon, .feature__icon, .t8-project__icon { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.motion :is(.course-card:hover .course-card__icon, .course-tile:hover .course-card__icon, .feature:hover .feature__icon, .contact-card:hover .feature__icon, .t8-project:hover .t8-project__icon) { transform: scale(1.1) rotate(-5deg); }

/* Buttons: a light sweep on hover and a small press */
.btn--primary { position: relative; overflow: hidden; }
.motion .btn--primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.4), transparent); transform: skewX(-18deg);
}
.motion .btn--primary:hover::after { left: 125%; transition: left 0.7s ease; }
.motion .btn:active { transform: scale(0.97); }

/* FAQ: the vertical bar of the plus shrinks to leave a minus */
.faq { transition: border-color 0.3s; }
.faq summary::after { transition: background-color 0.3s, background-size 0.3s, color 0.3s; }
.faq[open].closing summary::after { background-size: 12px 2px, 2px 12px; background-color: var(--tint); color: var(--heading); }
.faq[open].closing { border-color: var(--border); }
.motion .faq[open]:not(.closing) > :not(summary) { animation: t8-faq 0.4s ease both; }
@keyframes t8-faq { from { opacity: 0; transform: translateY(-8px); } }

/* Page to page: a short cross-fade in browsers that support it (needs http, not file://) */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.3s; }
}

/* Few courses: fill the rows instead of leaving an empty slot */
@media (min-width: 981px) {
  .t6-courses .courses__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #relatedCourses { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .course-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .course-list .course-tile { grid-column: span 2; }
  .course-list .course-tile:nth-child(4):nth-last-child(2),
  .course-list .course-tile:nth-child(5):last-child { grid-column: span 3; }
}

/* Course page: project cards */
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mini { display: grid; gap: 6px; align-content: start; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-2); }
.mini small { color: var(--accent); font-weight: 600; font-size: 13px; }
.mini h3 { font-size: 17px; }
.mini p { color: var(--muted); font-size: 14.5px; }
@media (max-width: 640px) { .mini-grid { grid-template-columns: 1fr; } }

/* Experts: wide cards with the icon on the left; the last row always fills the width, whatever the number of cards */
.team { display: flex; flex-wrap: wrap; gap: 20px; }
.member {
  flex: 1 1 340px; display: grid; grid-template-columns: 84px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 20px; row-gap: 7px;
  justify-items: start; text-align: left; align-content: center; padding: 26px 24px; overflow: hidden;
  background: var(--card-bg); transition: opacity 0.9s var(--ease), transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.member:hover { border-color: var(--accent); box-shadow: var(--glow-orange); }
.member::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); transform: scaleY(0); transform-origin: 50% 100%; transition: transform 0.35s var(--ease); }
.member:hover::before { transform: scaleY(1); }
.member__avatar { grid-row: 1 / -1; align-self: center; width: 84px; height: 84px; margin: 0; border-radius: 22px; box-shadow: none; }
.t8-expert { padding: 13px; background: linear-gradient(145deg, var(--tint), transparent 130%); border: 1px solid var(--border); transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.member:nth-child(even) .t8-expert { background: linear-gradient(145deg, var(--tint-orange), transparent 130%); }
.member:hover .t8-expert { transform: scale(1.06) rotate(-4deg); }
.t8-expert svg { width: 100%; height: 100%; }
.member h4 { font-size: 19px; line-height: 1.25; align-self: end; }
.member h4 + span { padding: 3px 11px; border-radius: 999px; background: var(--tint-orange); color: #a84a00; font-size: 12.5px; font-weight: 600; }
.member p { font-size: 14.5px; line-height: 1.5; margin-top: 3px; }
.member__avatar.has-photo img { border-radius: 22px; }
@media (max-width: 980px) { .member { flex-basis: 300px; } }
@media (max-width: 640px) {
  .member { flex-basis: 100%; grid-template-columns: 68px minmax(0, 1fr); column-gap: 16px; padding: 20px 18px; }
  .member__avatar { width: 68px; height: 68px; border-radius: 18px; }
  .t8-expert { padding: 10px; }
}

/* Longer addresses: keep the contact cards and the footer icons aligned at the top */
.contact-card { align-content: start; }
.contact-list li { align-items: flex-start; }

/* Footer without the newsletter box: share the width between the four columns */
@media (min-width: 1151px) { .footer__grid:not(:has(.footer__news)) { grid-template-columns: 1.5fr 0.8fr 1.1fr 1.5fr; gap: 44px; } }

/* Contact icons: phone, email, address, hours */
.ci { display: block; width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.contact-list li > span:first-child { flex: none; padding-top: 4px; }
.contact-card .feature__icon .ci { width: 26px; height: 26px; stroke-width: 1.9; }

/* Line icons (Lucide) and technology logos (Simple Icons) */
.ui { display: block; width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature__icon .ui { width: 27px; height: 27px; stroke-width: 1.8; }
.contact-card .feature__icon { color: var(--accent); }
.contact-list .ui { width: 18px; height: 18px; color: var(--accent); }
.float-card__icon .ui { width: 22px; height: 22px; color: var(--accent); }
.cta__rocket { display: grid; place-items: center; flex: none; width: 92px; height: 92px; border-radius: 26px; background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.18); color: var(--accent); }
.cta__rocket .ui { width: 46px; height: 46px; stroke-width: 1.6; }
.meta li { display: inline-flex; align-items: center; gap: 7px; }
.meta .ui { width: 16px; height: 16px; color: var(--accent); }
.chip--lg { display: inline-flex; align-items: center; gap: 8px; }
.logo-i { flex: none; width: 17px; height: 17px; }
