/* School of Immigration, by Vinay Hari: the 3D home experience */

/* The hero line and the loader wordmark use Sora 800. The document's own font link (which tools/build.mjs rewrites for
   Hindi) asks for 400, 600 and 700, so the one extra weight is requested here. */
@import url("https://fonts.googleapis.com/css2?family=Sora:wght@800&display=swap");

:root {
  --crimson: #8E1B2A;
  --crimson-deep: #5E0F1B;
  --gold: #C9A227;
  --gold-hi: #E6C76A;
  --white: #FFFFFF;
  --cream: #F7F1E6;
  --cream-2: #EDE2CF;
  --ink: #2A1F1A;
  --ink-soft: #5B4A42;
  /* the shared chrome (chrome.css: header, pills, footer, phone bar) reads these too */
  --line: #EADFC8;
  --muted: #6B5B52;
  --max: 1080px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font-en: "Sora", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hi: "Hind", "Noto Sans Devanagari", system-ui, sans-serif;
  --header-h: 64px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  /* the rounded join between the stage and the sections, and between the coloured blocks */
  --join: 48px;
  --hero-ink: #7A1626;
}
@media (max-width: 840px) { :root { --join: 24px; } }

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-en);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}
html[lang="hi"] body { font-family: var(--font-hi); font-size: 18px; }
/* The loader's lockup stays in the English display face in both languages (the header's does the same in chrome.css) */
.loader .wm, .loader .by { font-family: var(--font-en); }
html[lang="hi"] .card .ln { font-size: 17px; }
html[lang="hi"] .card h2.ln { font-size: 25px; }

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; border-radius: 999px; }

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

/* Loader: the ring fills as the assets arrive (it starts a quarter full, so it never looks stuck), holds for a
   moment at full, then the cream lifts in 0.3 s while the lockup shrinks away. */
.loader {
  position: fixed; inset: 0; z-index: 60;
  background: var(--cream);
  display: grid; place-items: center; text-align: center;
  transition: opacity .3s ease-out, visibility .3s;
}
.loader > div { transition: transform .3s ease-in, opacity .25s ease-in; }
.loader[data-done="1"] { opacity: 0; visibility: hidden; pointer-events: none; }
.loader[data-done="1"] > div { transform: translateY(-16px) scale(.9); opacity: 0; }
.loader .wm { font-weight: 800; font-size: clamp(28px, 4.4vw, 46px); letter-spacing: -.025em; color: var(--crimson); margin: 0; line-height: 1.1; }
.loader .by { margin: 8px 0 28px; color: var(--ink-soft); font-size: 14px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.loader .ring { width: 64px; height: 64px; display: block; margin: 0 auto; }
.loader .ring circle { fill: none; stroke-width: 5; transform: rotate(-90deg); transform-origin: 50% 50%; }
.loader .ring .track { stroke: rgba(142, 27, 42, .12); }
.loader .ring .base { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 37.7 150.8; }
.loader .ring .bar { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 150.8; stroke-dashoffset: 150.8; transition: stroke-dashoffset .3s var(--ease-out); }

/* The header, nav, EN / हिंदी toggle, Apply pill, hamburger and sheet come from chrome.css (the layout's own component).
   The home adds one control, the music toggle; experience.js toggles body.past-hero once the stage has scrolled past. */
.hdr-music { width: 40px; height: 40px; padding: 0; border-radius: 999px; border: 1px solid currentColor; background: transparent; display: inline-grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .1s, color .1s, border-color .1s, transform .1s; }
.hdr-music:active { transform: scale(.92); }
.hdr-music svg { width: 18px; height: 18px; }
.hdr-music .on-wave { opacity: 0; transition: opacity .1s; }
.hdr-music[aria-pressed="true"] { background: var(--gold); color: var(--crimson-deep); border-color: var(--gold-hi); }
.hdr-music[aria-pressed="true"] .on-wave { opacity: 1; }
.hdr-music[aria-pressed="true"] .off-x { opacity: 0; }

/* Stage */
/* The stage leaves as a card: the track's bottom corners are rounded over the first section's cream (overflow: clip
   keeps the sticky stage working, which overflow: hidden would not). */
.track { position: relative; height: 320vh; border-radius: 0 0 var(--join) var(--join); overflow: clip; }
body.is-fallback .track { height: 100vh; min-height: 640px; }
.stage {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden;
  background: var(--crimson-deep);
}
.stage canvas { display: block; width: 100%; height: 100%; }
.stage .fallback-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }
body.is-fallback .stage .fallback-img { display: block; }
body.is-fallback .stage canvas { display: none; }
.vignette {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse 70% 62% at 50% 52%, rgba(94, 15, 27, 0) 40%, rgba(94, 15, 27, .55) 78%, rgba(60, 8, 16, .85) 100%);
}
body.is-fallback .vignette { opacity: .6; }

/* Scroll cue: a small drawn mouse on a cream pill (a chevron alone on touch screens). experience.js holds it back
   until he has landed (data-hide); the pill itself is gone within the first 48 px of scroll. */
.scroll-hint {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 4;
  pointer-events: none; transition: opacity .2s;
}
.scroll-hint .cue {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 13px 8px; border-radius: 999px;
  background: var(--cream); color: var(--ink);
  box-shadow: 0 6px 18px rgba(42, 31, 26, .18);
}
.cue-mouse { position: relative; display: block; width: 20px; height: 30px; border: 2.5px solid currentColor; border-radius: 12px; }
.cue-mouse i { position: absolute; left: 50%; top: 5px; width: 4px; height: 6px; margin-left: -2px; border-radius: 2px; background: var(--crimson); animation: cueDot 1.3s var(--ease-out) infinite; }
.cue-arrow { display: block; width: 10px; height: 7px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cueDot { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(8px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }
@keyframes cueNudge { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@media (hover: none) {
  .scroll-hint .cue { padding: 12px 13px; }
  .cue-mouse { display: none; }
  .cue-arrow { width: 16px; height: 11px; animation: cueNudge 1.3s ease-in-out infinite; }
}
.scroll-hint[data-hide="1"], body.is-fallback .scroll-hint { opacity: 0; }
@keyframes cueOut { to { opacity: 0; transform: translateY(8px); } }
@supports (animation-timeline: scroll()) {
  .scroll-hint .cue { animation: cueOut linear both; animation-timeline: scroll(root); animation-range: 6px 48px; }
}

/* One line at load: what this site is. Dark crimson on the white wall, in the left 45% of a wide screen (he sits right
   of centre), and at the top under the header on a phone (he is centred lower down). One tilted gold label under it,
   the only thing off the grid. experience.js fades the whole block out by 20% of the scroll. */
.hero-line {
  position: absolute; z-index: 4; margin: 0;
  left: clamp(16px, 5vw, 72px); top: calc(var(--header-h) + clamp(24px, 7vh, 72px));
  max-width: calc(45vw - clamp(16px, 5vw, 72px));
  font-family: var(--font-en); font-weight: 800; font-size: clamp(40px, 6vw, 84px); line-height: 1.02; letter-spacing: -.03em;
  color: var(--hero-ink); text-shadow: none; text-wrap: balance;
  pointer-events: none; will-change: opacity;
}
.hero-line::after {
  content: "by Vinay Hari"; display: block; width: -moz-fit-content; width: fit-content;
  margin: clamp(12px, 1.6vw, 22px) 0 0 4px; padding: .55em .9em .5em;
  font-family: var(--font-en); font-weight: 700; font-size: clamp(12px, 1.15vw, 16px); line-height: 1; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  color: var(--crimson-deep); background: var(--gold); border-radius: 6px;
  transform: rotate(-4deg); transform-origin: 0 50%;
}
html[lang="hi"] .hero-line { font-family: var(--font-hi); letter-spacing: 0; line-height: 1.16; font-size: clamp(38px, 5.4vw, 76px); }
.hero-line[data-hide="1"], body.is-fallback .hero-line { opacity: 0; }

/* Mentor card */
.card {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  padding: 18px 20px 16px;
  border-radius: 18px;
  background: rgba(255, 252, 246, .94);
  color: var(--ink);
  border: 1px solid rgba(201, 162, 39, .55);
  box-shadow: 0 18px 50px rgba(40, 6, 12, .35), inset 0 0 0 1px rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  /* experience.js places it with the translate property; scale is its own property, so the card grows from the
     side nearest him without sliding. It leaves a little faster than it arrives. */
  opacity: 0; scale: .9; transform-origin: 0 38%;
  transition: opacity .18s ease-in, scale .18s ease-in;
  will-change: translate, scale, opacity;
}
.card[data-show="1"] { opacity: 1; scale: 1; transition: opacity .3s var(--ease-out), scale .46s cubic-bezier(.3, 1.45, .55, 1); }
body.is-fallback .card { opacity: 1; scale: 1; position: absolute; left: var(--gutter); right: auto; bottom: 88px; top: auto; translate: none; transform: none; }
/* Lines appear one by one: an untyped line takes no space, so the card grows as it types */
.card .ln { display: none; margin: 0; font-size: 16px; line-height: 1.45; color: var(--ink); }
.card .ln[data-on="1"] { display: block; }
.card h2.ln { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; color: var(--crimson); line-height: 1.2; }
.card .ln .cur { display: inline-block; width: 2px; height: 1em; background: var(--gold); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2, start) infinite; }
.card .ln:not([data-typing="1"]) .cur { display: none; }
@keyframes blink { to { visibility: hidden; } }
.card .cta { margin-top: 14px; opacity: 0; transform: translateY(6px); transition: opacity .4s var(--ease-out), transform .4s var(--ease-out); }
.card .cta[data-on="1"], body.is-fallback .card .cta { opacity: 1; transform: none; }
.card .cta .btn { width: 100%; }

/* The plane's layer (flight.js): a transparent canvas fixed over the page. Above the sections and the stage, under the
   header (50), the phone sheet (49) and the phone bar (48). It never takes a click. */
.flight { position: fixed; inset: 0; z-index: 40; pointer-events: none; overflow: hidden; }
.flight[hidden], body.is-fallback .flight { display: none; }
.flight canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .flight { display: none; } }

/* Sections */
/* Every coloured block ends in the same rounded corner as the stage; the colour that shows in the corners is the
   next block's (a hard shadow of the block's own shape, one corner lower). */
.sec { position: relative; padding: clamp(64px, 10vh, 120px) clamp(16px, 5vw, 48px) calc(clamp(64px, 10vh, 120px) + var(--join) / 2); background: var(--cream); border-radius: 0 0 var(--join) var(--join); box-shadow: 0 var(--join) 0 var(--cream-2); }
.sec--alt { background: var(--cream-2); box-shadow: 0 var(--join) 0 var(--cream); }
.sec + .sec { padding-top: calc(clamp(64px, 10vh, 120px) + var(--join) / 2); }
.wrap { max-width: 1040px; margin: 0 auto; }
.kick { font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--crimson); margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
html[lang="hi"] .kick { font-family: var(--font-hi); letter-spacing: .06em; font-size: 14px; }
.kick::before { content: ""; width: 26px; height: 2px; background: var(--gold); }
.sec h2 { font-size: clamp(30px, 5vw, 56px); line-height: 1.08; letter-spacing: -.025em; font-weight: 700; color: var(--crimson); margin: 0 0 18px; max-width: 18ch; }
html[lang="hi"] .sec h2 { letter-spacing: 0; line-height: 1.22; }
.lead { font-size: clamp(19px, 2.3vw, 26px); line-height: 1.4; color: var(--ink); margin: 0 0 28px; max-width: 30ch; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 32px; padding: 0; list-style: none; }
.facts li { background: var(--white); border: 1px solid rgba(201, 162, 39, .35); border-radius: 16px; padding: 16px 18px; }
.facts b { display: block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; margin-bottom: 6px; }
html[lang="hi"] .facts b { letter-spacing: .02em; font-size: 14px; }
.facts span { font-size: 20px; font-weight: 700; color: var(--crimson); line-height: 1.2; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.tiles li { background: var(--white); border-radius: 20px; padding: 22px 20px 24px; border: 1px solid rgba(201, 162, 39, .35); min-height: 190px; display: flex; flex-direction: column; }
.tiles .n { font-size: 44px; line-height: 1; font-weight: 700; color: var(--gold); margin-bottom: 14px; }
.tiles h3 { font-size: 20px; margin: 0 0 8px; line-height: 1.2; color: var(--crimson); }
.tiles p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }

.fee-note { font-size: 14px; color: var(--ink-soft); margin: 18px 0 0; }

.rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rules li { background: var(--white); border-left: 4px solid var(--gold); border-radius: 12px; padding: 14px 18px; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.45; }

.sec--apply { text-align: center; box-shadow: 0 var(--join) 0 var(--crimson); }
.sec--apply h2, .sec--apply .lead { margin-left: auto; margin-right: auto; }
.sec--apply .btns { justify-content: center; }

/* The phone bar (chrome.css .sticky) stays below the screen until the story is done and the sections arrive */
.sticky { transform: translateY(110%); transition: transform .4s var(--ease-out); }
body.story-done .sticky { transform: none; }

@media (max-width: 768px) {
  .hdr-music { width: 36px; height: 36px; }
  .card { padding: 14px 16px 14px; width: calc(100vw - 2 * var(--gutter)); transform-origin: 50% 0; }
  .card .ln { font-size: 15px; }
  .card h2.ln { font-size: 20px; }
  /* The bottom bar carries Apply and WhatsApp on phones: the sections do not repeat them */
  body.story-done .sec .btns { display: none; }
  .hero-line { left: var(--gutter); right: var(--gutter); top: calc(var(--header-h) + 16px); max-width: none; font-size: clamp(34px, 10.6vw, 52px); }
  html[lang="hi"] .hero-line { font-size: clamp(31px, 9.6vw, 48px); }
  .card .cta { margin-top: 10px; }
  .card .cta .btn { min-height: 44px; }
  body.is-fallback .card { bottom: 96px; }
  .facts { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tiles li { min-height: 0; padding: 18px 16px 20px; }
  .tiles .n { font-size: 34px; }
  .tiles h3 { font-size: 17px; }
  .sec, .sec + .sec { padding: 56px 16px calc(56px + var(--join) / 2); }
  .sec + .sec { padding-top: calc(56px + var(--join) / 2); }
  .scroll-hint { bottom: 20px; }
}
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .cue-mouse i, .cue-arrow, .card .ln .cur { animation: none; }
  .card, .sticky, .loader, .loader > div, .hero-line, .hdr-music { transition: none; }
}
