:root {
  --bg: #050505;
  --ink: #ededed;
  --ink-strong: #ffffff;
  --ink-dim: #a3a3a3;
  --gray: #666666;
  --hair: #1a1a1a;
  --nav-bg: rgba(5, 5, 5, 0.75);
  --nav-border-scrolled: #2a2a2a;

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;

  --nav-h: 72px;
  --edge: clamp(20px, 5vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="light"] {
  --bg: #fdfdfc;
  --ink: #0a0a0a;
  --ink-strong: #000000;
  --ink-dim: #454545;
  --gray: #6b6b6b;
  --hair: #e4e4e2;
  --nav-bg: rgba(253, 253, 252, 0.75);
  --nav-border-scrolled: #d8d8d6;
}

@media (max-width: 560px) {
  :root { --nav-h: 60px; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Smoothly animate the theme swap; more specific rules below that
   already declare `transition` list these same properties themselves
   so this fallback isn't silently overridden for those elements. */
*, *::before, *::after {
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease), fill 0.4s var(--ease);
}

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

.top-sentinel {
  display: block;
  position: absolute;
  top: 0;
  width: 1px;
  height: 1px;
}
::selection { background: var(--ink); color: var(--bg); }

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), background-color 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--edge);
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
  transition: border-color 0.3s ease, background-color 0.4s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--nav-border-scrolled); }

.nav__mark {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.nav__links {
  display: flex;
  gap: 36px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.nav__links a {
  position: relative;
  color: var(--ink-dim);
  padding: 4px 0;
  transition: color 0.2s ease;
}
.nav__links a:hover { color: var(--ink); }

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 0;
  height: 1px;
  background: var(--ink);
  transition: width 0.25s var(--ease);
}
.nav__links a:hover::after { width: 100%; }

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: -8px;
}
.nav__toggle span {
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  display: block;
  transition: transform 0.25s var(--ease), opacity 0.2s ease, background-color 0.4s var(--ease);
}
.nav__toggle[aria-expanded="true"] span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--hair);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.3s var(--ease), background-color 0.4s var(--ease), color 0.4s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink); }

.theme-toggle__icon {
  position: absolute;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}

.theme-toggle__icon--sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle__icon--moon { opacity: 1; transform: rotate(0deg) scale(1); }

:root[data-theme="light"] .theme-toggle__icon--sun { opacity: 1; transform: rotate(0deg) scale(1); }
:root[data-theme="light"] .theme-toggle__icon--moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle__icon { transition: opacity 0.01ms; }
}

@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }

  .nav__links.is-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--hair);
    padding: 12px var(--edge) 28px;
    gap: 4px;
    max-height: calc(100vh - var(--nav-h));
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
  }

  .nav__links.is-open a {
    padding: 14px 0;
    font-size: 15px;
    border-top: 1px solid var(--hair);
  }
  .nav__links.is-open a:first-child { border-top: none; }
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 24px) var(--edge) 48px;
}

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-dim);
  letter-spacing: 0.03em;
  margin-bottom: 28px;
}

.hero__title {
  font-family: var(--sans);
  font-weight: 900;
  font-size: clamp(2.8rem, 9vw, 7.4rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: 36px;
}

.hero__title .line {
  display: block;
  overflow: hidden;
}

.hero__title .word {
  display: inline-block;
  transform: translateY(110%);
  animation: riseIn 0.9s var(--ease) forwards;
}

.line--1 .word:nth-child(1) { animation-delay: 0.05s; }
.line--1 .word:nth-child(2) { animation-delay: 0.14s; }
.line--2 .word:nth-child(1) { animation-delay: 0.22s; }
.line--2 .word:nth-child(2) { animation-delay: 0.3s; }

@keyframes riseIn {
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__title .word { animation: none; transform: none; }
}

.hero__desc {
  max-width: 620px;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--ink-dim);
  line-height: 1.65;
  margin-bottom: 40px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 15px 28px;
  border-radius: 0;
  display: inline-block;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn--solid {
  background: var(--ink);
  color: var(--bg);
}
.btn--solid:hover { transform: translateY(-2px); background: var(--ink-strong); }

.btn--ghost {
  border: 1px solid var(--hair);
  color: var(--ink);
}
.btn--ghost:hover { border-color: var(--ink); transform: translateY(-2px); }

.marquee {
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  overflow: hidden;
  padding: 22px 0;
}

.marquee__track {
  display: flex;
  width: max-content;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--gray);
  will-change: transform;
}

.marquee__group {
  display: flex;
  flex-shrink: 0;
  gap: 20px;
  padding-right: 20px;
}

.marquee__group span:nth-child(odd) { color: var(--ink-dim); }

.section {
  padding: 108px var(--edge);
  border-bottom: 1px solid var(--hair);
}

.section__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 56px;
}

.section__eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section__head h2 {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em;
}

.entries {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.entry {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
}

.entry__date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--gray);
  letter-spacing: 0.02em;
  padding-top: 4px;
}

.entry__main h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.entry__main h3 span {
  font-weight: 400;
  color: var(--ink-dim);
}

.entry__main p {
  color: var(--ink-dim);
  line-height: 1.65;
  margin-bottom: 10px;
  max-width: 680px;
}
.entry__main p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .entry { grid-template-columns: 1fr; gap: 10px; }
}

.projects {
  display: flex;
  flex-direction: column;
}

.project { border-top: 1px solid var(--hair); }
.project:last-child { border-bottom: 1px solid var(--hair); }

.project__link {
  display: grid;
  grid-template-columns: 56px 1fr 40px;
  align-items: center;
  gap: 28px;
  padding: 34px 0;
  transition: padding-left 0.35s var(--ease);
}

.project__link:hover { padding-left: 14px; }

.project__index {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--gray);
}

.project__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project__title {
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: color 0.25s ease;
}

.project__desc {
  color: var(--ink-dim);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 680px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease), opacity 0.35s var(--ease), margin-top 0.4s var(--ease), color 0.4s var(--ease);
}

.project__link:hover .project__desc,
.project__link:focus-visible .project__desc {
  max-height: 120px;
  opacity: 1;
  margin-top: 2px;
}

.project__stack {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gray);
  letter-spacing: 0.02em;
}

.project__arrow {
  font-size: 20px;
  color: var(--gray);
  justify-self: end;
  transition: transform 0.3s var(--ease), color 0.3s ease;
}

.project__link:hover .project__arrow {
  transform: translate(4px, -4px);
  color: var(--ink);
}

@media (max-width: 720px) {
  .project__link { grid-template-columns: 32px 1fr 24px; gap: 16px; padding: 24px 0; }
  .project__desc { max-height: none; opacity: 1; margin-top: 8px; overflow: visible; transition: color 0.4s var(--ease); }
}

.skills {
  display: flex;
  flex-direction: column;
}

.skills__row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--hair);
}
.skills__row:last-child { border-bottom: 1px solid var(--hair); }

.skills__label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--gray);
  text-transform: uppercase;
}

.skills__items {
  color: var(--ink-dim);
  font-size: 0.98rem;
  line-height: 1.6;
}

@media (max-width: 720px) {
  .skills__row { grid-template-columns: 1fr; gap: 6px; }
}

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline__item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-top: 1px solid var(--hair);
}
.timeline__item:last-child { border-bottom: 1px solid var(--hair); }

.timeline__date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.02em;
}

.timeline__item p {
  color: var(--ink-dim);
  line-height: 1.6;
  font-size: 0.96rem;
}

@media (max-width: 720px) {
  .timeline__item { grid-template-columns: 1fr; gap: 6px; }
}

.edu { display: flex; flex-direction: column; }

.edu__row {
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 0;
  border-top: 1px solid var(--hair);
}
.edu__row:last-child { border-bottom: 1px solid var(--hair); }

.edu__school { font-weight: 700; font-size: 1.02rem; }
.edu__degree { color: var(--ink-dim); font-size: 0.95rem; }

.edu__date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--gray);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .edu__row { grid-template-columns: 1fr; gap: 4px; }
}

.cta {
  padding: 140px var(--edge);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cta__eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.cta__email {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(1.5rem, 6.5vw, 4.4rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  background-color: transparent;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: 0% 2px;
  transition: background-size 0.4s var(--ease), color 0.4s var(--ease);
  padding: 0 0 6px;
  border: none;
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  word-break: break-word;
}
.cta__email:hover,
.cta__email:focus-visible {
  background-position: left bottom;
  background-size: 100% 2px;
  color: var(--ink-dim);
}

.cta__email .cta__at,
.cta__email .cta__dot {
  color: var(--gray);
  font-weight: 500;
}

.cta__hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.02em;
  margin-top: 10px;
  margin-bottom: 40px;
  transition: color 0.2s ease;
}
.cta__hint.is-copied { color: var(--ink); }

.cta__links {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-dim);
}

.cta__links a { transition: color 0.2s ease; }
.cta__links a:hover { color: var(--ink); }

.footer {
  display: flex;
  justify-content: center;
  padding: 32px var(--edge);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gray);
}

.footer__top { transition: color 0.2s ease; }
.footer__top:hover { color: var(--ink); }

@media (max-width: 900px) {
  .section { padding: 72px var(--edge); }
  .cta { padding: 88px var(--edge); }
  .section__head { margin-bottom: 40px; }
}

@media (max-width: 720px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .btn { text-align: center; }

  .entries { gap: 40px; }

  .skills__row,
  .timeline__item,
  .edu__row {
    padding: 16px 0;
  }
}

@media (max-width: 560px) {
  html { font-size: 15px; }

  .nav { padding: 0 20px; }
  .nav__mark { font-size: 14px; }

  .hero { padding: calc(var(--nav-h) + 16px) 20px 40px; }
  .hero__title { font-size: clamp(2.3rem, 12vw, 3.4rem); margin-bottom: 28px; }
  .hero__desc { font-size: 0.98rem; margin-bottom: 32px; }

  .section { padding: 56px 20px; }
  .section__head h2 { font-size: 1.6rem; }

  .marquee__track { font-size: 12.5px; }
  .marquee__group { gap: 14px; padding-right: 14px; }

  .entry { gap: 6px; }
  .entry__date { font-size: 11.5px; }
  .entry__main h3 { font-size: 1.05rem; margin-bottom: 10px; }
  .entry__main p { font-size: 0.92rem; }

  .project__link {
    grid-template-columns: 1fr 20px;
    grid-template-areas:
      "index arrow"
      "body body";
    gap: 8px 12px;
    padding: 20px 0;
  }
  .project__index { grid-area: index; }
  .project__arrow { grid-area: arrow; }
  .project__body { grid-area: body; }
  .project__title { font-size: 1.1rem; }
  .project__desc { font-size: 0.9rem; }
  .project__link:hover { padding-left: 0; }

  .skills__label { font-size: 11px; }
  .skills__items { font-size: 0.9rem; }

  .timeline__date { font-size: 11px; }
  .timeline__item p { font-size: 0.9rem; }

  .edu__school { font-size: 0.96rem; }
  .edu__degree { font-size: 0.88rem; }
  .edu__date { font-size: 10.5px; white-space: normal; }

  .cta { padding: 64px 20px; }
  .cta__email { font-size: clamp(1.3rem, 8vw, 2rem); word-break: break-all; }
  .cta__links { gap: 20px; flex-wrap: wrap; }

  .footer { padding: 24px 20px; }
}

@media (max-width: 380px) {
  .hero__title { font-size: 2rem; }
  .cta__email { font-size: 1.15rem; }
}
