:root {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #e8e8e5;
  --glow-a: rgba(255, 255, 255, 0.95);
  --glow-b: rgba(138, 31, 61, 0.1);
  --glow-c: rgba(183, 119, 18, 0.12);
  --ink: #1d2a2e;
  --muted: #55626a;
  --rule: rgba(29, 42, 46, 0.22);
  --accent: #8a1f3d;
  --cluster-1: #8a1f3d;
  --cluster-2: #b77712;
  --cluster-3: #1f6a50;
  --dot-alpha: 0.5;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14181a;
  --glow-a: rgba(70, 82, 86, 0.5);
  --glow-b: rgba(239, 127, 157, 0.1);
  --glow-c: rgba(233, 177, 93, 0.08);
  --ink: #e9e8e3;
  --muted: #a4aeb1;
  --rule: rgba(233, 232, 227, 0.22);
  --accent: #f08ba6;
  --cluster-1: #ef7f9d;
  --cluster-2: #e9b15d;
  --cluster-3: #63c19b;
  --dot-alpha: 0.6;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 0.9375rem/1.7 var(--mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Soft, slowly moving gradient behind the whole page. */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  inset: -30vmax;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(45vmax 45vmax at 28% 26%, var(--glow-a), transparent 70%),
    radial-gradient(40vmax 40vmax at 72% 34%, var(--glow-b), transparent 70%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(42vmax 42vmax at 66% 72%, var(--glow-a), transparent 70%),
    radial-gradient(38vmax 38vmax at 30% 70%, var(--glow-c), transparent 70%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to { transform: translate3d(9vmax, 7vmax, 0) rotate(8deg); }
}

@keyframes drift-b {
  to { transform: translate3d(-8vmax, -9vmax, 0) rotate(-6deg); }
}

a { color: inherit; }

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

.skip-link {
  position: absolute;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

.theme-toggle {
  display: none;
  position: absolute;
  z-index: 5;
  top: 0.75rem;
  right: 0.75rem;
  min-height: 2.5rem;
  padding: 0 0.875rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: border-color 0.2s;
}

.js .theme-toggle { display: block; }
.theme-toggle:hover { border-color: var(--ink); }

/* ---------- First screen ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: 3.5rem 1.25rem 1.25rem;
  text-align: center;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__card {
  position: relative;
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 34rem;
}

.portrait {
  display: block;
  width: clamp(8.5rem, 24vh, 11.5rem);
  height: auto;
  aspect-ratio: 1;
  margin: 0 auto 1.75rem;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--rule), 0 18px 40px -18px rgba(29, 42, 46, 0.55);
}

h1 {
  margin: 0;
  font-size: clamp(1.625rem, 5vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.role {
  margin: 0.4rem 0 0;
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 300;
  line-height: 1.4;
}

.study {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-wrap: balance;
}

.links {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 5vw, 2rem);
  margin: 2rem 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  min-width: 3.75rem;
  padding: 0.25rem;
  font-size: 0.6875rem;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
}

.links svg { width: 1.375rem; height: 1.375rem; }

.links a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.contact {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.contact a {
  display: inline-block;
  padding: 0.5rem 0.25rem;
}

.contact a[href] {
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.contact a[href]:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.hero__foot {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding-top: 1.5rem;
}

.scroll-cue {
  padding: 0.625rem 1rem;
  font-size: 0.75rem;
  text-decoration: none;
}

.scroll-cue:hover { color: var(--accent); }
.scroll-cue span { display: inline-block; animation: nudge 2.2s ease-in-out infinite; }

@keyframes nudge {
  50% { transform: translateY(3px); }
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: 1.4;
}

/* Entrance: only when scripts are running, so the page is never left blank. */
.js .hero__card > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.js .hero__card > :nth-child(2) { animation-delay: 0.08s; }
.js .hero__card > :nth-child(3) { animation-delay: 0.14s; }
.js .hero__card > :nth-child(4) { animation-delay: 0.2s; }
.js .hero__card > :nth-child(5) { animation-delay: 0.28s; }
.js .hero__card > :nth-child(6) { animation-delay: 0.36s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
}

/* ---------- Resume ---------- */

.resume {
  width: min(100%, 52rem);
  margin: 0 auto;
  padding: 4rem 1.25rem 2rem;
  scroll-margin-top: 0;
}

.resume__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 3rem;
}

.resume__title {
  margin: 0;
  font-size: clamp(1.625rem, 5vw, 2.125rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.download svg { width: 1rem; height: 1rem; }

.download:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px var(--accent);
}

.block { margin-bottom: 3.25rem; }

h2 {
  margin: 0 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.entry { margin-bottom: 2.25rem; }
.entry:last-child { margin-bottom: 0; }
.entry--compact { margin-bottom: 1.25rem; }

.entry__head,
.entry__sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 1.5rem;
}

.entry__sub p,
.entry__head p { margin: 0; }

h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
}

h3 a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

h3 a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.entry__meta,
.stack {
  color: var(--muted);
  font-size: 0.8125rem;
}

.stack { margin: 0.1rem 0 0; }

.entry ul {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.entry li {
  position: relative;
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.entry li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 0.15rem;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.skills { margin: 0; }

.skills > div {
  display: grid;
  grid-template-columns: 13.5rem 1fr;
  gap: 0.1rem 1.5rem;
  padding: 0.4rem 0;
}

dt { font-size: 0.875rem; font-weight: 700; }
dd { margin: 0; font-size: 0.875rem; }

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  width: min(100%, 52rem);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.footer p { margin: 0; }
.footer a { text-underline-offset: 3px; }
.footer a:hover { color: var(--accent); }

@media (max-width: 40rem) {
  .skills > div { grid-template-columns: 1fr; padding: 0.55rem 0; }
  .entry__meta { width: 100%; }
  .entry__sub .entry__meta { margin-top: 0; }
  .resume { padding-top: 3rem; }
}

@media (max-height: 34rem) {
  .portrait { width: 6.5rem; margin-bottom: 1rem; }
  .links { margin: 1rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  body::before, body::after, .theme-toggle, .hero__canvas, .hero__foot, .download { display: none; }
  .hero { min-height: 0; }
  .js .reveal { opacity: 1; transform: none; }
}
