/* ==========================================================================
   learn2phoenix.github.io — Anubhav Gupta
   Hand-written, no build step. Dark-first.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:          #0b0c0f;
  --bg-elev:     #121419;
  --surface:     #171a20;
  --surface-2:   #1e222a;
  --border:      #262b35;
  --border-soft: #1c2028;

  /* Ink */
  --text:        #e9ebef;
  --text-dim:    #a4abb8;
  --text-faint:  #808998;

  /* Accent */
  --accent:      #f0a63c;
  --accent-dim:  #b97d28;
  --accent-wash: rgba(240, 166, 60, 0.12);

  /* Plate that white paper-figures sit on */
  --plate:       #f4f4f2;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 68rem;
  --radius: 14px;
  --radius-sm: 8px;

  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);

  color-scheme: dark;
}

/* --------------------------------------------------------------- reset -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
}

p { margin: 0 0 1rem; }
ul { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--text);
  text-decoration-color: var(--text-faint);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color .16s ease, text-decoration-color .16s ease;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: .7rem 1.1rem;
  background: var(--accent);
  color: #14100a;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: #14100a; }

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

/* -------------------------------------------------------------- layout -- */

.wrap {
  width: min(100% - 2.5rem, var(--measure));
  margin-inline: auto;
}

.section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid var(--border-soft);
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(1.75rem, 3vw, 2.75rem);
}

.section-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

/* ----------------------------------------------------------------- nav -- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 12, 15, .82);                          /* fallback: --bg @ 82% */
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease;
}
.nav[data-scrolled="true"] { border-bottom-color: var(--border-soft); }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 4.25rem;
}

.nav__brand {
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.nav__brand:hover { color: var(--accent); }

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(.75rem, 2.5vw, 1.75rem);
  font-size: .88rem;
}

.nav__links a {
  text-decoration: none;
  color: var(--text-dim);
  position: relative;
  padding-block: .35rem;
  white-space: nowrap;
}
.nav__links a:hover { color: var(--text); }

.nav__links a[aria-current="true"] { color: var(--text); }
.nav__links a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -.1rem;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
}

.nav__cv {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text) !important;
  background: var(--surface);
}
.nav__cv:hover { border-color: var(--accent); color: var(--accent) !important; }
.nav__cv::after { display: none !important; }

/* Hide the middle links on small screens; brand + CV survive. */
@media (max-width: 42rem) {
  .nav__links .nav__scrollspy { display: none; }
}

/* ---------------------------------------------------------------- hero -- */

.hero {
  position: relative;
  isolation: isolate;
  padding-block: clamp(4rem, 12vw, 8.5rem) clamp(3.5rem, 8vw, 6rem);
  overflow: hidden;
}

/* Mosaic of teasers from every paper — decoration, not any one project. */
.mosaic {
  position: absolute;
  inset: -6% -3% -6% -3%;
  z-index: -2;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  row-gap: .5rem;
  pointer-events: none;
  /* Soft, off-centre falloff so the field never resolves into a banner. */
  -webkit-mask-image:
    radial-gradient(150% 130% at 70% 20%, #000 0%, rgba(0,0,0,.92) 50%, rgba(0,0,0,.3) 82%, transparent 100%);
  mask-image:
    radial-gradient(150% 130% at 70% 20%, #000 0%, rgba(0,0,0,.92) 50%, rgba(0,0,0,.3) 82%, transparent 100%);
}

@media (max-width: 48rem) {
  .mosaic {
    grid-template-columns: repeat(3, 1fr);
    /* Type runs full-width here, so a horizontal wash cannot separate them.
       Confine the field to a band above the type instead. */
    -webkit-mask-image:
      radial-gradient(160% 34% at 58% 0%, #000 0%, rgba(0,0,0,.75) 52%, transparent 98%);
    mask-image:
      radial-gradient(160% 34% at 58% 0%, #000 0%, rgba(0,0,0,.75) 52%, transparent 98%);
  }
  .hero {
    /* extra headroom so the band is visible above the eyebrow */
    padding-block: 7rem clamp(3.5rem, 8vw, 6rem);
  }
  .hero::after {
    background: linear-gradient(180deg,
      rgba(11, 12, 15, .18) 0%,
      rgba(11, 12, 15, .42) 8%,
      rgba(11, 12, 15, .93) 19%,
      rgba(11, 12, 15, .985) 32%,
      rgb(11, 12, 15) 100%);
  }
}

.mosaic__row { overflow: hidden; }

.mosaic__track {
  display: flex;
  height: 100%;
  width: max-content;
  animation: mosaic-drift linear infinite;
  will-change: transform;
}

/* Each lane runs at its own pace so the three never line up into a block. */
.mosaic__row:nth-child(1) .mosaic__track { animation-duration: 84s; }
.mosaic__row:nth-child(2) .mosaic__track { animation-duration: 116s; }
.mosaic__row:nth-child(3) .mosaic__track { animation-duration: 98s; }

/* Tiles carry their own gutter rather than the track using `gap`: with a gap
   the track would hold 13 gutters for 14 tiles and -50% would not line up. */
.mosaic__tile {
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 16 / 9;
  margin-right: .5rem;
  border-radius: 6px;
  overflow: hidden;
  opacity: .38;
  filter: grayscale(1) contrast(.86) blur(.5px);
}
.mosaic__tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Half the track is exactly one full set of tiles, so the wrap is invisible. */
@keyframes mosaic-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* A wash between the mosaic and the type, so contrast never depends on
   which tile happens to be lit. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Two layers: a bottom fade into the next section, and a left-to-right wash
     that keeps the type on a near-solid ground while the right side stays open.
     Literal rgba() throughout — no color-mix, so nothing to fall back from. */
  background:
    linear-gradient(180deg,
      rgba(11, 12, 15, 0) 0%,
      rgba(11, 12, 15, 0) 50%,
      rgba(11, 12, 15, .82) 86%,
      rgb(11, 12, 15) 100%),
    linear-gradient(90deg,
      rgba(11, 12, 15, .985) 0%,
      rgba(11, 12, 15, .975) 46%,
      rgba(11, 12, 15, .90) 58%,
      rgba(11, 12, 15, .45) 70%,
      rgba(11, 12, 15, .26) 82%,
      rgba(11, 12, 15, .36) 93%,
      rgba(11, 12, 15, .58) 100%);
}


.hero__eyebrow {
  width: fit-content;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.hero h1 {
  width: fit-content;
  max-width: 100%;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  margin-bottom: .9rem;
}

.hero__role {
  width: fit-content;
  max-width: 100%;
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: #c9cfda;            /* brighter than --text-dim: it sits over the mosaic */
  margin-bottom: 1.6rem;
}
.hero__role a { color: #c9cfda; }

.hero__thesis {
  font-size: clamp(1.05rem, 2.2vw, 1.28rem);
  line-height: 1.6;
  max-width: 40ch;
  color: var(--text);
  margin-bottom: 2.2rem;
}
.hero__thesis strong { font-weight: 600; color: #fff; }

/* --------------------------------------------------------------- links -- */

.social {
  width: fit-content;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.social a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 26, 32, .70);                          /* fallback: --surface @ 70% */
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font-size: .85rem;
  text-decoration: none;
  color: var(--text-dim);
}
.social a:hover {
  color: var(--text);
  border-color: var(--accent-dim);
  background: var(--accent-wash);
}
.social svg { width: 15px; height: 15px; fill: currentColor; flex: none; }

/* -------------------------------------------------------------- prose --- */

.prose { max-width: 62ch; }
.prose p { color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--text); }

.themes {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.75rem;
}
.theme {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .06em;
  padding: .35rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  background: var(--surface);
}

/* -------------------------------------------------------- publications -- */

.pubs { display: grid; gap: 1rem; }

.pub {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  padding: 1.15rem;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.pub:hover {
  border-color: var(--border);
  background: var(--surface);
}

@media (max-width: 46rem) {
  .pub { grid-template-columns: 1fr; }
}

/* The figures are white-paper; give them an explicit light plate so they
   read as deliberate rather than as glare on the dark page. */
.pub__fig {
  background: var(--plate);
  border-radius: var(--radius-sm);
  overflow: hidden;
  align-self: start;
  border: 1px solid rgba(255,255,255,.06);
}
.pub__fig img {
  width: 100%;
  height: auto;              /* the height="" attribute would otherwise win */
  aspect-ratio: 16 / 9;
  object-fit: contain;
  opacity: .88;
  transition: opacity .2s ease;
}
.pub:hover .pub__fig img { opacity: 1; }

.pub__fig--none {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-style: dashed;
  border-color: var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.pub__body { min-width: 0; }

.pub__venue {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  background: var(--accent-wash);
  border-radius: 4px;
  padding: .15rem .45rem;
  margin-bottom: .6rem;
}
.pub__venue--muted {
  color: var(--text-faint);
  border-color: var(--border);
  background: var(--surface-2);
}

.pub__title {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: .5rem;
}
.pub__title a { text-decoration: none; }
.pub__title a:hover { color: var(--accent); }

.pub__authors {
  font-size: .875rem;
  color: var(--text-dim);
  margin-bottom: .6rem;
  line-height: 1.55;
}
.pub__authors a { color: var(--text-dim); text-decoration-color: var(--border); }
.pub__authors .me { color: var(--text); font-weight: 600; }

.pub__blurb {
  font-size: .9rem;
  color: var(--text-dim);
  margin-bottom: .85rem;
}

.pub__links { display: flex; flex-wrap: wrap; gap: .4rem; }

.chip {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: .32rem .65rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-dim);
  text-decoration: none;
}
.chip:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-wash);
}

/* ---------------------------------------------------------- experience -- */

.timeline {
  display: grid;
  gap: 0;
  max-width: 56rem;
}

.role {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding-block: 1.15rem;
  border-top: 1px solid var(--border-soft);
}
.role:first-child { border-top: 0; }

.role__when {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--text-faint);
  padding-top: .2rem;
  white-space: nowrap;
}

.role__what { min-width: 0; }
.role__org { font-weight: 600; font-size: .98rem; }
.role__title { color: var(--text-dim); font-size: .9rem; }
.role__note { color: var(--text-faint); font-size: .855rem; margin-top: .3rem; }

@media (max-width: 40rem) {
  .role { grid-template-columns: 1fr; gap: .35rem; }
}

/* ---------------------------------------------------------------- news -- */

.news { max-width: 56rem; }

.news li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding-block: .7rem;
  border-top: 1px solid var(--border-soft);
  font-size: .92rem;
}
.news li:first-child { border-top: 0; }

.news time {
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--text-faint);
  padding-top: .18rem;
  white-space: nowrap;
}
.news p { margin: 0; color: var(--text-dim); }
.news strong { color: var(--text); font-weight: 600; }

@media (max-width: 40rem) {
  .news li { grid-template-columns: 1fr; gap: .2rem; }
}

.news-more { border-top: 1px solid var(--border-soft); }
.news-more > summary {
  cursor: pointer;
  list-style: none;
  padding-block: .9rem;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.news-more > summary::-webkit-details-marker { display: none; }
.news-more > summary:hover { color: var(--accent); }
.news-more > summary::after { content: " \002B"; }
.news-more[open] > summary::after { content: " \2212"; }
.news-more[open] > summary { color: var(--text-dim); }
.news-more .news li:first-child { border-top: 1px solid var(--border-soft); }

/* ------------------------------------------------------------- service -- */

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}

.cols h3 {
  font-family: var(--font-mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .9rem;
}

.stack li {
  padding-block: .42rem;
  font-size: .9rem;
  color: var(--text-dim);
}
.stack li .award { color: var(--accent); }

/* -------------------------------------------------------------- footer -- */

.footer {
  border-top: 1px solid var(--border-soft);
  padding-block: 2.5rem 3.5rem;
  color: var(--text-faint);
  font-size: .83rem;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.footer a { color: var(--text-faint); }
.footer a:hover { color: var(--accent); }

/* ------------------------------------------------------------- motion --- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* Static, evenly-lit field — no cycling. */
  .mosaic__track { animation: none; }
  .mosaic__tile { opacity: .34; }
}

/* -------------------------------------------------------------- print --- */

@media print {
  :root {
    --bg: #fff; --bg-elev: #fff; --surface: #fff; --surface-2: #fff;
    --text: #111; --text-dim: #333; --text-faint: #555;
    --border: #ccc; --border-soft: #ddd; --accent: #8a5a00;
  }
  .nav, .mosaic, .social, .skip-link { display: none !important; }
  .hero::after { display: none; }
  body { background: #fff; color: #111; }
  .pub { break-inside: avoid; border: 1px solid #ddd; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .75em; color: #666; }
}
