/* =========================================================================
   Aditya Venkataraman — interactive hero
   Alpine-ice palette: luminous cold field, charcoal type, one warm accent.
   ========================================================================= */

:root {
  /* ice field */
  --ice-100: #eff5f8;
  --ice-200: #dee9ef;
  --ice-300: #c7dae2;
  --ice-400: #a9c6d2;
  --ice-500: #7ba4b6;

  /* ink */
  --ink: #16232b;
  --ink-soft: #46606c;
  --ink-faint: #7d949e;

  /* the one warm note — climbing-jacket amber */
  --warm: #e8a73c;
  --warm-deep: #b5761a;

  /* per-theme glow hues, all held slightly muted so the field stays cold */
  --glow: transparent;

  --portrait-w: clamp(232px, 38vw, 452px);

  /* shared eye anchor — both portraits are registered to this point.
     --eye-gap is half the inter-ocular distance (as % of portrait width);
     it matches adit2, which is the face shown whenever the emoji are up. */
  --eye-x: 50%;
  --eye-y: 41%;
  --eye-gap: 11%;

  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 72% 8%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 46%),
    radial-gradient(80% 60% at 50% 120%, var(--ice-400) 0%, rgba(169, 198, 210, 0) 55%),
    linear-gradient(178deg, var(--ice-100) 0%, var(--ice-200) 46%, var(--ice-300) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---- decorative contour field ------------------------------------------- */
.contours {
  position: fixed;
  inset: -6% -4% 0 -4%;
  width: 108%;
  height: 106%;
  color: var(--ice-500);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}

/* ---- layout ----------------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2vw, 1.1rem);
  padding: clamp(2rem, 6vw, 3.5rem) 1.25rem 1rem;
  text-align: center;
}

/* ---- name --------------------------------------------------------------- */
.name {
  margin: 0;
  font-family: "Bricolage Grotesque", "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: clamp(1.55rem, 8vw, 7rem);
  line-height: 0.84;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--ink);
  /* let the portrait crowd up into the name (scales with the name itself) */
  margin-bottom: -6rem;
  margin-bottom: -1.7lh;
  transition: color 0.35s var(--ease-out);
}
.name__line { display: block; }
.name__line + .name__line { color: #223541; }

/* ---- portrait --------------------------------------------------------------- */
.portrait {
  position: relative;
  z-index: 2;
  width: var(--portrait-w);
  margin: 0;
  aspect-ratio: 776 / 1000;
  will-change: transform;
}

/* cold cast pooled beneath him so he is planted, not floating */
.portrait__shadow {
  position: absolute;
  left: 50%;
  bottom: -4%;
  width: 78%;
  height: 12%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 50%, rgba(22, 35, 43, 0.30) 0%, rgba(22, 35, 43, 0) 70%);
  filter: blur(3px);
}

.portrait__glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 108%;
  height: 108%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 46%, var(--glow) 0%, rgba(0, 0, 0, 0) 60%);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
  mix-blend-mode: multiply;
}
.portrait.is-active .portrait__glow { opacity: 0.7; }

.portrait__media {
  position: absolute;
  inset: 0;
}

.portrait__img {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 28px rgba(22, 35, 43, 0.26));
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 82%, transparent 99%);
}
/* every pose is pre-registered to the same eye anchor, so swapping is a
   pure crossfade. adit1 base / adit2 topic / adit3 look-left / adit4 look-right */
.portrait__img--alt,
.portrait__img--left,
.portrait__img--right {
  opacity: 0;
  transition: opacity 0.16s ease;
}

/* gaze: cursor left / right of the figure — only while no topic is engaged */
.portrait[data-gaze="left"]:not(.is-active) .portrait__img--base,
.portrait[data-gaze="right"]:not(.is-active) .portrait__img--base { opacity: 0; }
.portrait[data-gaze="left"]:not(.is-active) .portrait__img--left { opacity: 1; }
.portrait[data-gaze="right"]:not(.is-active) .portrait__img--right { opacity: 1; }

/* topic hover / pin wins over gaze */
.portrait.is-active .portrait__img--base,
.portrait.is-active .portrait__img--left,
.portrait.is-active .portrait__img--right { opacity: 0; }
.portrait.is-active .portrait__img--alt { opacity: 1; }

/* one emoji over each eye */
.portrait__eyes {
  position: absolute;
  inset: 0;
}
.portrait__emoji {
  position: absolute;
  top: calc(var(--eye-y) + var(--emoji-dy));
  width: calc(var(--portrait-w) * 0.30);
  height: calc(var(--portrait-w) * 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--portrait-w) * var(--emoji-size));
  line-height: 1;
  /* per-theme fine-tune — emoji fonts disagree on internal centring */
  --emoji-dy: 0px;
  --emoji-size: 0.22;
  opacity: 0;
  transition:
    transform 0.26s var(--ease-spring),
    opacity 0.14s linear;
  pointer-events: none;
  user-select: none;
}
.portrait__emoji--l { left: calc(var(--eye-x) - var(--eye-gap)); }
.portrait__emoji--r { left: calc(var(--eye-x) + var(--eye-gap)); transition-delay: 0.035s; }

.portrait__emoji--l { transform: translate(-50%, -50%) scale(0.2) rotate(-24deg); }
.portrait__emoji--r { transform: translate(-50%, -50%) scale(0.2) rotate(24deg); }
.portrait.is-active .portrait__emoji { opacity: 1; }
.portrait.is-active .portrait__emoji--l { transform: translate(-50%, -50%) scale(1) rotate(-6deg); }
.portrait.is-active .portrait__emoji--r { transform: translate(-50%, -50%) scale(1) rotate(6deg); }

/* ---- the set --------------------------------------------------------------- */
.set {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: clamp(0.25rem, 1.5vw, 0.9rem);
  font-size: clamp(1.05rem, 2.9vw, 1.7rem);
}
.set__brace {
  font-weight: 500;
  font-size: 1.35em;
  color: var(--ice-500);
  line-height: 1;
}
.set__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.set__list li { display: flex; align-items: center; }
.set__list li:not(:last-child)::after {
  content: ",";
  color: var(--ink-faint);
  margin-left: 0.05rem;
}

.word {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink-soft);
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
  position: relative;
  transition: color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.word::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.28rem;
  height: 2px;
  background: var(--warm);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.24s var(--ease-out);
}
.word:hover,
.word:focus-visible,
.word[aria-pressed="true"] { color: var(--ink); }
.word:hover::after,
.word:focus-visible::after,
.word[aria-pressed="true"]::after { transform: scaleX(1); }
.word[aria-pressed="true"] { transform: translateY(-1px); }

.word:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---- hint + footer ---------------------------------------------------------- */
.hint {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.foot {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  padding: 1rem 1.25rem 1.5rem;
  font-size: 0.85rem;
}
.foot a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.foot a:hover,
.foot a:focus-visible { color: var(--ink); border-color: var(--warm); }
.foot a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---- theme tints ---------------------------------------------------------- */
.portrait[data-theme="glaciers"]     { --glow: #63b4d6; }
.portrait[data-theme="climbing"]     { --glow: #e8a73c; }
.portrait[data-theme="puzzles"]      { --glow: #8f74d6; }
.portrait[data-theme="professional"] { --glow: #4e9a76; }

.portrait[data-theme="puzzles"] .portrait__emoji {
  --emoji-dy: calc(var(--portrait-w) * 0.03);
}
.portrait[data-theme="professional"] .portrait__emoji {
  --emoji-size: 0.26;
  --emoji-dy: calc(var(--portrait-w) * 0.015);
}

/* ---- small screens ------------------------------------------------------- */
@media (max-width: 560px) {
  :root { --portrait-w: min(60vw, 280px); }
  .hero { gap: 0.75rem; padding-top: clamp(1.5rem, 8vw, 3rem); }
  /* the "burst through the name" overlap doesn't read at phone proportions —
     let the name sit clean above the portrait */
  .name { margin-bottom: 0.35rem; font-size: clamp(1.7rem, 9vw, 3rem); }

  /* set-notation punctuation is a desktop nicety; drop it and let the
     four words breathe as a centred wrap */
  .set__brace { display: none; }
  .set__list li:not(:last-child)::after { display: none; }
  .set__list { gap: 0.35rem 0.9rem; max-width: 16rem; }
  .word { padding: 0.4rem 0.6rem; }
}

/* short laptop windows — keep the whole hero above the fold */
@media (min-width: 561px) and (max-height: 820px) {
  :root { --portrait-w: clamp(220px, 43vh, 380px); }
  .name { font-size: clamp(2.1rem, 8vh, 6rem); }
  .hero { padding-top: clamp(1.25rem, 3.5vh, 2.75rem); gap: 0.5rem; }
}

/* ---- motion off --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .portrait,
  .portrait *,
  .word,
  .word::after {
    transition-duration: 0.1s !important;
  }
  /* no spring / splay — the emoji just fade in, on their eyes */
  .portrait__emoji,
  .portrait.is-active .portrait__emoji {
    transition: opacity 0.12s linear !important;
    transform: translate(-50%, -50%) scale(1) rotate(0) !important;
  }
  .contours { display: none; }
}
