/* ---------------------------------------------------------------- tokens */

:root {
  /* Deep blue-black surface, soft blue-gray ink, one electric-blue signal.
     Contrast against --bg: ink 8.9:1, heading 13.6:1, accent 5.2:1. */
  --bg:          #0b1020;
  --bg-elev:     #0d1226;
  --surface:     #141b33;
  --ink:         #94a3b8;
  --ink-dim:     #64748b;
  --heading:     #e2e8f0;

  --accent:        #5b8cff;
  --accent-strong: #4f83ff;
  --accent-bright: #82a6ff;

  --rule:        #1c2540;
  --rule-strong: #2a3556;

  --sans: "Public Sans", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --text-body:  1.0625rem;   /* 17px */
  --text-h2:    0.8125rem;    /* section eyebrow, uppercase */
  --text-h3:    1.25rem;
  --text-small: 0.8125rem;

  --leading: 1.65;

  --wrap:   1280px;
  --pad:    clamp(24px, 7vw, 96px);
  --gutter: 4rem;

  /* Semantic stacking scale. */
  --z-spot: 0;
  --z-page: 1;
  --z-skip: 10;
}

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

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

body, h1, h2, h3, p, ul, figure, figcaption { margin: 0; padding: 0; }

ul { list-style: none; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

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

/* ------------------------------------------------------------------- base */

body {
  font-family: var(--sans);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading);
  letter-spacing: 0.001em;
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(79, 131, 255, 0.10), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--heading);
}

p { text-wrap: pretty; }
p + p { margin-top: 1.05rem; }
b { color: var(--heading); font-weight: 600; }

/* Cursor spotlight. JS feeds --spot-x / --spot-y on pointermove; off on touch
   and reduced motion. */
.spotlight {
  position: fixed;
  inset: 0;
  z-index: var(--z-spot);
  pointer-events: none;
  background: radial-gradient(560px circle at var(--spot-x, -20%) var(--spot-y, -20%),
    rgba(91, 140, 255, 0.09), transparent 62%);
  transition: background 160ms linear;
}

@media (hover: none), (prefers-reduced-motion: reduce) {
  .spotlight { display: none; }
}

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

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: var(--z-skip);
  font-size: var(--text-small);
  color: var(--heading);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
}
.skip-link:focus {
  left: var(--pad);
  top: 0.75rem;
}

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

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

.page {
  position: relative;
  z-index: var(--z-page);
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

@media (min-width: 1024px) {
  .page {
    display: grid;
    grid-template-columns: 48fr 52fr;
    gap: var(--gutter);
  }
}

/* --------------------------------------------------------------- masthead */

.masthead {
  padding-block: clamp(3rem, 8vw, 5.5rem) 3rem;
}

@media (min-width: 1024px) {
  .masthead {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-block: clamp(4rem, 9vh, 6rem);
  }
}

h1 {
  font-size: clamp(2.25rem, 1.7rem + 2.6vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--heading);
  text-wrap: balance;
}

.role {
  margin-top: 0.85rem;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--heading);
}

.tagline {
  margin-top: 1rem;
  max-width: 22rem;
  color: var(--ink);
  text-wrap: pretty;
}

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

.nav {
  display: none;
  margin-top: 3.5rem;
}

@media (min-width: 1024px) {
  .nav { display: block; }
}

.nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0;
  color: var(--ink-dim);
  transition: color 180ms ease;
}

.nav-line {
  width: 28px;
  height: 1px;
  background: var(--rule-strong);
  transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1),
              background-color 220ms ease;
}

.nav-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav a:hover,
.nav a:focus-visible { color: var(--heading); }

.nav a:hover .nav-line,
.nav a:focus-visible .nav-line {
  width: 44px;
  background: var(--ink);
}

.nav a.is-active { color: var(--heading); }
.nav a.is-active .nav-line {
  width: 60px;
  background: var(--accent);
}

/* ---------------------------------------------------------------- social */

.social {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 3rem;
}

@media (min-width: 1024px) {
  .social { margin-top: 0; }
}

.social a {
  display: inline-flex;
  color: var(--ink-dim);
  transition: color 160ms ease, transform 160ms ease;
}
.social a:hover { color: var(--heading); transform: translateY(-2px); }
.social svg { width: 24px; height: 24px; }

/* --------------------------------------------------------------- sections */

.section {
  padding-block: clamp(3rem, 7vw, 4.5rem);
  scroll-margin-top: 1.5rem;
}

@media (min-width: 1024px) {
  .section { padding-block: clamp(3.5rem, 6vw, 5rem); }
  .section:first-child { padding-top: clamp(4rem, 9vh, 6rem); }
}

h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.75rem;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin-bottom: 0.6rem;
  text-wrap: balance;
}

.section > p { max-width: 46ch; }
#skills > p { max-width: 52ch; }

/* ------------------------------------------------------------------ about */

.resume { margin-top: 1.6rem; }

.resume-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--accent);
}
.resume-link .arrow {
  display: inline-flex;
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.resume-link:hover { color: var(--accent-bright); }
.resume-link:hover .arrow { transform: translate(3px, -3px); }

/* ---------------------------------------------------------------- entries */

.entries { display: flex; flex-direction: column; gap: 2.5rem; }

.entry, .role {
  padding: 1.4rem 1.4rem 1.6rem;
  margin: -1.4rem -1.4rem -1.6rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: opacity 220ms ease, border-color 220ms ease, background-color 220ms ease;
}

/* Hover-dimming across grouped entries. */
@media (hover: hover) {
  .entries:hover .entry,
  .entries:hover .role { opacity: 0.45; }
  .entries:hover .entry:hover,
  .entries:hover .role:hover {
    opacity: 1;
    border-color: var(--rule);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
  }
}

.entry--lead h3 {
  font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.6rem);
}

.finding {
  margin-top: 1.05rem;
  color: var(--heading);
}

.entry p + p { margin-top: 1.05rem; }

/* ------------------------------------------------------------------- pills */

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.pills li {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--accent-bright);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  line-height: 1.2;
}

.repo {
  display: inline-flex;
  margin-top: 1rem;
  color: var(--ink-dim);
  transition: color 160ms ease, transform 160ms ease;
}
.repo:hover { color: var(--heading); transform: translateY(-2px); }

/* ------------------------------------------------------------------ figure */

.figure { margin: 1.6rem 0 0.4rem; }

.figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

figcaption {
  margin-top: 0.85rem;
  font-size: var(--text-small);
  line-height: 1.55;
  color: var(--ink-dim);
  text-wrap: pretty;
}

/* --------------------------------------------------------- effect plot */
/*
   Effect estimate on a zero-anchored axis running 0 to +0.5 xGD.
   lower bound 0.192 -> 38.4%, estimate 0.292 -> 58.4%, upper 0.392 -> 78.4%.
   The plot is aria-hidden; the finding sentence carries every value in text.
*/
.plot {
  --axis-y: 1.45rem;
  --mark-y: 2.7rem;
  position: relative;
  height: 4.6rem;
  padding: 0.4rem 0.2rem 0;
}
.plot::after {
  content: "";
  position: absolute;
  left: 0.2rem; right: 0.2rem;
  bottom: var(--axis-y);
  height: 1px;
  background: var(--rule-strong);
}
.plot::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  bottom: var(--axis-y);
  width: 1px;
  height: calc(100% - var(--axis-y));
  background: var(--rule-strong);
}
.plot-interval {
  position: absolute;
  left: 38.4%;
  width: 40%;
  bottom: calc(var(--mark-y) - 1px);
  height: 2px;
  background: var(--accent);
}
.plot-interval::before,
.plot-interval::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 10px;
  background: var(--accent);
}
.plot-interval::before { left: 0; }
.plot-interval::after  { right: 0; }
.plot-point {
  position: absolute;
  left: 58.4%;
  bottom: calc(var(--mark-y) - 5px);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  outline: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px rgba(91, 140, 255, 0.6);
  transform: translateX(-50%);
}
.plot-value {
  position: absolute;
  left: 58.4%;
  bottom: calc(var(--mark-y) + 0.7rem);
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: var(--text-small);
  font-weight: 500;
  color: var(--accent-bright);
  white-space: nowrap;
}
.plot-axis {
  position: absolute;
  left: 0.2rem; right: 0.2rem;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}

/* --------------------------------------------------------------- roles */

@media (min-width: 640px) {
  .role {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 1.5rem;
  }
}

.role-period {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1.5;
  margin-top: 0.35rem;
}

.role-title {
  font-size: var(--text-small);
  color: var(--ink);
  margin-bottom: 0.85rem;
}
.sep::before {
  content: "\00b7";
  margin: 0 0.5em;
  color: var(--rule-strong);
}

/* ------------------------------------------------------------ credentials */

.credentials {
  display: flex;
  flex-direction: column;
}
.credentials li {
  color: var(--heading);
  padding-block: 0.7rem;
}
.credentials li + li { border-top: 1px solid var(--rule); }

.note {
  font-size: var(--text-small);
  color: var(--ink-dim);
}

/* --------------------------------------------------------- narrow break */

@media (max-width: 480px) {
  :root {
    --text-body: 1rem;
    --text-h3:   1.15rem;
  }
  .entry, .role {
    padding-inline: 1rem;
    margin-inline: -1rem;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .entries:hover .entry,
  .entries:hover .role { opacity: 1; }
}
