:root {
  /* preloader (night) */
  --night: #0a0a0b;
  --cream: #f3efe6;
  /* page (dark, over the background video) */
  --bg: #0d0d11;
  --fg: #f4f7f8;
  --muted: rgba(236, 246, 248, 0.74);
  --faint: rgba(236, 246, 248, 0.5);
  --logo-size: min(42vw, 230px);

  --font: "Geist", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Geist", system-ui, sans-serif;

  --gap: clamp(12px, 2.2svh, 28px);
  --portrait: clamp(118px, 20svh, 240px);
  --social: clamp(46px, 6.4svh, 58px);
  --link-h: clamp(48px, 6.6svh, 64px);
  --radius: 22px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* No text highlighting: tapping, long-pressing or dragging won't select anything */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Images and logos can't be dragged out of the page either */
img,
svg,
video { -webkit-user-drag: none; user-drag: none; }

/* liquidGL anchors its canvas to <body> and sizes it to the body, so the
   glass scrolls with the page */
body { position: relative; }

/* Never scroll sideways. liquidGL sizes its canvas and shadow layers in px
   (e.g. to the window width, which includes the scrollbar), which can
   nudge them past the right edge. `clip` hides that without
   turning the page into a separate scroll container. */
html { overflow-x: hidden; }
@supports (overflow: clip) {
  html,
  body { overflow-x: clip; }
}

/* Lenis (smooth scrolling) recommended styles */
html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* No visible scrollbar */
html { scrollbar-width: none; }
html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; width: 0; height: 0; }

body.is-loading { overflow: hidden; }

a { color: inherit; text-decoration: none; }

/* ═════════════ PRELOADER ═════════════ */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
}

.gate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--night);
  will-change: transform;
  backface-visibility: hidden;
}

.gate::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.8) 30%, rgba(255, 255, 255, 0.8) 70%, transparent);
  box-shadow: 0 0 18px 2px rgba(255, 255, 255, 0.3);
  transition: opacity 0.45s ease-out;
}

.gate--left  { clip-path: inset(0 calc(50% - 0.5px) 0 0); }
.gate--right { clip-path: inset(0 0 0 calc(50% - 0.5px)); }
.gate--left::after  { left: calc(50% - 3px); }
.gate--right::after { left: calc(50% + 1px); }
.preloader.is-opening .gate::after { opacity: 1; }

.gate__logo {
  width: var(--logo-size);
  height: var(--logo-size);
  color: var(--cream);
  opacity: 0;
  will-change: transform, opacity, filter;
}

.slash {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  transform: scaleY(0);
  transform-origin: 50% 0;
  background: linear-gradient(to bottom, transparent, #fff 18%, #fff 82%, transparent);
  box-shadow:
    0 0 6px 1px rgba(255, 255, 255, 0.9),
    0 0 28px 4px rgba(255, 255, 255, 0.45),
    0 0 80px 10px rgba(180, 200, 255, 0.25);
  z-index: 2;
  pointer-events: none;
}

.flare {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(ellipse 18% 60% at 50% 50%, rgba(255, 255, 255, 0.9), transparent 70%),
    radial-gradient(ellipse 45% 90% at 50% 50%, rgba(170, 190, 255, 0.35), transparent 70%);
  pointer-events: none;
}

/* ═════════════ BACKDROP (refracted by the glass) ═════════════ */

.page {
  position: relative;
  min-height: 100svh;
}

.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

.bg::after {
  /* dims the video's brightest highlights so light text stays readable */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(8, 8, 12, 0.55), rgba(8, 8, 12, 0.35) 40%, rgba(8, 8, 12, 0.5));
}

/* Sized and centred by js/backdrop.js to cover the screen (see there why
   not object-fit). The 100% values only apply until the first frame. */
.bg__video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  max-width: none;
}

/* Particle ring (assets/top.mp4) around the AA logo.
   Sits outside .stage so its additive blend reaches the backdrop video.
   Position and size are set by js/ring.js. */
/* Radius of the centre-out reveal (registered so it can be animated) */
@property --ring-r {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  pointer-events: none;
  transform: rotate(180deg);
  --ring-r: 0px;
  /* 1) a circle that grows from the ring's centre (50% / 51.1% inside the turned box)
     2) soft fade at the bottom on screen (the box is turned 180°, so "to bottom" here is screen-up)
     Both masks apply together. */
  -webkit-mask-image:
    radial-gradient(circle at 50% 51.1%, #000 var(--ring-r), transparent calc(var(--ring-r) + 70px)),
    linear-gradient(to bottom, transparent 0%, #000 30%);
  mask-image:
    radial-gradient(circle at 50% 51.1%, #000 var(--ring-r), transparent calc(var(--ring-r) + 70px)),
    linear-gradient(to bottom, transparent 0%, #000 30%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  mix-blend-mode: screen;
  opacity: 0;
  /* starts as the AA logo begins to grow (~1.24s after the preloader) */
  transition:
    opacity 0.4s linear 1.24s,
    --ring-r 1.8s cubic-bezier(0.33, 0, 0.2, 1) 1.24s;
}
/* Two copies of the clip, crossfaded by js/ring.js so it loops seamlessly */
.ring__clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  mix-blend-mode: screen;
}
@supports (mix-blend-mode: plus-lighter) {
  .ring,
  .ring__clip { mix-blend-mode: plus-lighter; } /* "add" */
}
body.is-bg-in .ring { opacity: 1; --ring-r: 520px; }

/* Fine film grain over everything (kept out of the glass snapshot) */
.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ═════════════ STAGE ═════════════ */

/* Normal-flow stage: centred on tall screens, scrolls when content is longer */
.stage {
  position: relative;
  z-index: 10;
  min-height: 100svh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.col {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding:
    max(env(safe-area-inset-top), clamp(12px, 2svh, 20px))
    16px
    max(env(safe-area-inset-bottom), clamp(12px, 2svh, 20px));
}

/* Content always sits above the glass canvas */
.glass > * { position: relative; z-index: 3; }

/* liquidGL sets pointer-events:none on each lens, so the content inside
   takes the taps instead (they still bubble up to the <a>). */
.glass > * { pointer-events: auto; }

.hit {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: grid;
  place-items: center;
}

.glass {
  position: relative;
  z-index: 5;
  background-color: rgba(255, 255, 255, 0.04);
}

/* Used only when liquidGL isn't running */
body.glass-off .glass {
  background-color: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* ─── Profile ─── */

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.portrait {
  position: relative;
  height: var(--portrait);
  margin-bottom: clamp(10px, 1.6svh, 16px);
}

/* AA logo behind the cutout: sized/placed to sit behind the head
   (circle ≈ 86% of the photo width, centred ~35% down) */
.portrait__bg {
  position: absolute;
  left: 0;
  top: -8%;
  width: 100%;
  height: auto;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, -130%, 0);
  transform-origin: 50% 50%;
}

/* Drops in from the top, lands in place, then swells a little */
body.is-bg-in .portrait__bg {
  animation: bg-drop 1.9s forwards;
}

@keyframes bg-drop {
  0% {
    opacity: 0;
    transform: translate3d(0, -130%, 0) scale(1);
    animation-timing-function: cubic-bezier(0.3, 0, 0.15, 1); /* fast fall, soft landing */
  }
  20% { opacity: 1; }
  55% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    animation-timing-function: linear;
  }
  65% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); /* gentle expand */
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1.07);
  }
}

.portrait__img {
  position: relative;
  z-index: 1;
  display: block;
  height: 100%;
  width: auto;
  filter: drop-shadow(0 18px 28px rgba(70, 40, 110, 0.18));
}

.name,
.bio,
.org,
.section__label,
.footer {
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}

.name {
  margin: 0;
  color: var(--fg);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.45rem, 3.7svh, 1.85rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.bio {
  margin: 8px 0 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.org {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.org__link {
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.3s;
}
.org__link:hover { opacity: 0.7; }

/* Devanagari "मुं": scaled so its headline (shirorekha) sits exactly on the
   cap height of "BAI". Geist cap height = 0.71em, Noto Sans Devanagari
   headline = 0.63em, so 0.71 / 0.63 ≈ 1.127. Baseline stays shared. */
.deva {
  font-family: "Noto Sans Devanagari", var(--font);
  font-size: 1.127em;
  line-height: 1;
  margin-right: 0.02em;
}
.org__link:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 3px; }

/* ─── Sections ─── */

.section { display: flex; flex-direction: column; gap: 10px; }

.section__label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}

.section__label::before,
.section__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.22), transparent);
}
.section__label::before { transform: scaleX(-1); }

/* ─── Icons ─── */

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon .fill,
.icon.fill { fill: currentColor; stroke: none; }

/* ─── Socials ─── */

.socials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.social {
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--social);
  border-radius: 16px;
}

.social .hit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 6px;
  transition: opacity 0.8s var(--ease-out), transform 0.5s var(--ease-out);
}
.social:active .hit { transform: scale(0.94); }

/* ─── Others ─── */

.others {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ─── Footer ─── */

.footer {
  margin-top: clamp(8px, 2svh, 20px);
  padding-top: clamp(18px, 3svh, 26px);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.footer__logo {
  width: 28px;
  height: 28px;
  color: var(--fg);
  opacity: 0.85;
}

.footer__copy {
  margin: 0;
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.01em;
}

/* Share: a small liquidGL glass pill, like the other buttons */
.footer__top {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: color 0.3s;
}
.footer__top-in {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: 0.78rem;
  font-weight: 500;
}
.footer__top svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s var(--ease-out);
}
.footer__top:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
@media (hover: hover) {
  .footer__top:hover { color: var(--fg); }
  .footer__top:hover svg { transform: translateY(-2px); }
}

/* ─── Contact ─── */

.contact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

button.social {
  font: inherit;
  color: inherit;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

button.social:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }

.social.is-copied .social__name { color: #6ff0a8; }
.social.is-copied .brand { animation: pop 0.45s var(--ease-out); }
@keyframes pop {
  40% { transform: scale(1.25); }
}

.toast {
  position: fixed;
  left: 50%;
  top: max(env(safe-area-inset-top), 14px);
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(28, 25, 22, 0.88);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.brand {
  flex: none;
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 6px;
}

/* Soft light halo around the cutout, fading in as the AA logo swells,
   so the figure separates from the logo behind it */
body.is-bg-in .portrait__img {
  animation: portrait-glow 0.9s cubic-bezier(0.22, 1, 0.36, 1) 1.2s both;
}

@keyframes portrait-glow {
  from {
    filter: drop-shadow(0 0 0 rgba(255, 252, 255, 0)) drop-shadow(0 0 0 rgba(235, 225, 255, 0))
      drop-shadow(0 18px 28px rgba(70, 40, 110, 0.18));
  }
  to {
    filter: drop-shadow(0 0 6px rgba(255, 252, 255, 0.85)) drop-shadow(0 0 18px rgba(235, 225, 255, 0.55))
      drop-shadow(0 18px 28px rgba(70, 40, 110, 0.18));
  }
}

/* Socials: the PNG's own shape and corners, never cropped */
.socials .brand { border-radius: 0; }

.social__name {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ─── Links ─── */

.links { display: flex; flex-direction: column; gap: 10px; }

.link {
  display: block;
  height: var(--link-h);
  border-radius: var(--radius);
}

.link__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  transition: opacity 0.8s var(--ease-out), transform 0.5s var(--ease-out);
}

.link:active .link__inner { transform: scale(0.97); }

.link__icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.12);
}
a.link[aria-disabled="true"] { cursor: default; }
.link__icon .icon { width: 20px; height: 20px; }
/* AA logo in white (Portfolio link) */
.link__logo { width: 20px; height: 20px; color: #fff; fill: currentColor; }
.link__logo--sparkle { width: 24px; height: 24px; } /* augment.ing sparkle, a touch larger */
.link__logo--photo { width: 23px; height: 24px; } /* Extra Clicks: white strokes keep their red accents */
.link__logo--camera { width: 21px; height: 21px; } /* My Charmera camera */
/* 3Defying mark: an outline drawing, so it's stroked in white rather than filled */
.link__mark {
  width: 24px;
  height: 19px;
  fill: none;
  stroke: #fff;
  stroke-width: 40;
  stroke-linecap: round;
  stroke-miterlimit: 10;
  overflow: visible;
}

.link__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.link__title { font-weight: 600; font-size: 0.98rem; letter-spacing: 0.005em; }

.link__sub {
  max-width: 100%;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Same footprint as the icon on the left, so the text sits dead centre */
.link__arrow {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 11px;
  color: var(--faint);
  transition: opacity 0.4s, transform 0.35s var(--ease-out), color 0.35s;
}

@media (hover: hover) {
  .link:hover .link__arrow { transform: translate(3px, -3px); color: var(--fg); }
  .social:hover .brand { transform: scale(1.08); }
  .brand { transition: transform 0.35s var(--ease-out); }
}

a:focus-visible { outline: 2px solid var(--fg); outline-offset: 4px; }

/* ═════════════ ENTRANCE ═════════════ */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s var(--ease-out), transform 0.9s var(--ease-out);
}

body.is-in .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .gate__logo { opacity: 1; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .portrait__bg, body.is-bg-in .portrait__bg { opacity: 1; transform: none; animation: none; }
  body.is-bg-in .portrait__img { animation-duration: 0.01s; animation-delay: 0s; }
  .ring { transition: none; }
}
