/* ---------- Tokens ---------- */
:root {
  --bg: #0b0b0b;
  --text: #ededeb;
  --text-2: #a8a8a4;
  --text-3: #6f6f6b;
  --rule: #262625;
  --rule-2: #3a3a38;
  --red: #e0322f;
  --red-hover: #c2221f;

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --container: 1200px;
  --gutter: 16px;
  --nav-h: 72px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (min-width: 768px) {
  :root { --gutter: 40px; }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.1; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
dd { margin: 0; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; transition: color .2s var(--ease); }

:focus-visible { outline: 1px solid var(--red); outline-offset: 4px; }

::selection { background: var(--red); color: #fff; }

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.accent { color: var(--red); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 200;
  background: var(--text);
  color: var(--bg);
  padding: .5rem 1rem;
}
.skip-link:focus { top: .75rem; }

/* ---------- Nav ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.site-header.is-scrolled,
.site-header.is-open { border-color: var(--rule); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
}

.nav__brand {
  flex: none;
  font-weight: 700;
  font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem);
  letter-spacing: -.035em;
  line-height: 1;
  white-space: nowrap;
}
.nav__brand span { color: var(--red); }

.nav__menu { display: flex; align-items: center; gap: clamp(1.1rem, 2.4vw, 2.25rem); }

.nav__menu a {
  position: relative;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
}
.nav__menu a:hover { color: var(--text); }
.nav__menu a.is-active { color: var(--text); }
.nav__menu a.is-active::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--red);
}

.nav__toggle {
  display: none;
  width: 44px; height: 44px;
  margin-right: -10px;
  background: none;
  border: 0;
  cursor: pointer;
  position: relative;
}

.nav__toggle-bar,
.nav__toggle-bar::before,
.nav__toggle-bar::after {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  transition: transform .3s var(--ease), background-color .2s;
}
.nav__toggle-bar { top: 21px; }
.nav__toggle-bar::before,
.nav__toggle-bar::after { content: ""; left: 0; }
.nav__toggle-bar::before { top: -6px; }
.nav__toggle-bar::after { top: 6px; }

.nav__toggle[aria-expanded="true"] .nav__toggle-bar { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 960px) {
  .nav__toggle { display: block; }

  .nav__menu {
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 0 var(--gutter) 1rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .nav__menu.is-open { visibility: visible; opacity: 1; transform: none; }
  .nav__menu li { border-top: 1px solid var(--rule); }
  .nav__menu a { display: block; padding: .95rem 0; font-size: 1.05rem; }
  .nav__menu a.is-active { color: var(--red); }
  .nav__menu a.is-active::before { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 50px;
  padding: .75rem 1.6rem;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}

.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-hover); }

.btn--ghost { border-color: var(--rule-2); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--text); }
.btn--ghost span { transition: transform .25s var(--ease); }
.btn--ghost:hover span { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero {
  padding: calc(var(--nav-h) + clamp(2.5rem, 7vw, 5.5rem)) 0 0;
}

.hero__grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 4rem;
    align-items: end;
  }
}

.hero__kicker {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 0;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-2);
}
.hero__kicker span + span::before {
  content: "/";
  margin: 0 .75rem;
  color: var(--red);
}

.hero__title {
  font-size: clamp(3.1rem, 9.5vw, 7.75rem);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: .92;
}

.hero__intro {
  max-width: 36rem;
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--text-2);
  font-size: 1.1rem;
  line-height: 1.7;
}
.hero__intro strong { color: var(--text); font-weight: 600; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2rem;
}

.portrait { margin: 0; }

.portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
  transition: filter .6s var(--ease);
}
.portrait:hover img { filter: none; }

.portrait figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: .7rem;
  border-top: 1px solid var(--rule-2);
  margin-top: .7rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-3);
}

@media (max-width: 899px) {
  .portrait { order: -1; max-width: 220px; }
}

/* Index strip */
.index {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: clamp(3.5rem, 8vw, 6rem);
  border-top: 1px solid var(--rule-2);
}

@media (min-width: 900px) {
  .index { grid-template-columns: repeat(5, 1fr); }
}

.index > div {
  padding: 1.1rem 1rem 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 900px) {
  .index > div { border-bottom: 0; }
  .index > div + div { padding-left: 1.25rem; border-left: 1px solid var(--rule); }
}

.index dt {
  margin-bottom: .35rem;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.index dd { font-size: .95rem; font-weight: 500; line-height: 1.35; }

/* ---------- Sections ---------- */
.section {
  padding: clamp(4.5rem, 10vw, 8rem) 0;
}
.section + .section { border-top: 1px solid var(--rule); }

.sec { display: grid; gap: 2.5rem; }

@media (min-width: 960px) {
  .sec { grid-template-columns: 280px minmax(0, 1fr); gap: 4rem; }
  .sec__head { position: sticky; top: calc(var(--nav-h) + 2rem); align-self: start; }
}

.sec__num {
  display: block;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--red);
  margin-bottom: 1rem;
}

.sec__label {
  margin-bottom: .5rem;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--text-3);
}

.sec__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1.02;
}

/* Rows (shared list pattern) */
.rows { border-top: 1px solid var(--rule-2); }
.rows > * { border-bottom: 1px solid var(--rule); }

/* ---------- About ---------- */
.about { max-width: 46rem; }

.about__lead {
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  line-height: 1.45;
  letter-spacing: -.015em;
  color: var(--text);
}

.about p:not(.about__lead) { color: var(--text-2); font-size: 1.05rem; }

.focus {
  display: grid;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  border-top: 1px solid var(--rule-2);
}

@media (min-width: 640px) {
  .focus { grid-template-columns: repeat(2, 1fr); }
}

.focus__item {
  padding: 1.5rem 1.5rem 1.75rem 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 640px) {
  .focus__item:nth-child(even) { padding-left: 1.5rem; border-left: 1px solid var(--rule); }
}

.focus__tag {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--red);
}

.focus__item h3 {
  margin: .6rem 0 .5rem;
  font-size: 1.2rem;
  letter-spacing: -.02em;
}

.focus__item p { color: var(--text-2); font-size: .95rem; line-height: 1.6; max-width: 30rem; }

/* ---------- Experience ---------- */
.row {
  display: grid;
  gap: .5rem;
  padding: 1.75rem 0;
}

@media (min-width: 640px) {
  .row { grid-template-columns: 130px minmax(0, 1fr); gap: 2rem; }
}

.row__meta {
  padding-top: .3rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}

.row__title { font-size: 1.3rem; letter-spacing: -.02em; }
.row__org { margin: .3rem 0 .8rem; font-size: .92rem; color: var(--text-2); }
.row__main > p:not(.row__org) { color: var(--text-2); max-width: 44rem; }

.row__list li {
  position: relative;
  padding-left: 1.2rem;
  margin-top: .4rem;
  color: var(--text-2);
  max-width: 44rem;
}
.row__list li:first-child { margin-top: 0; }
.row__list li::before {
  content: "\2014";
  position: absolute;
  left: 0;
  color: var(--text-3);
}

/* ---------- Achievements ---------- */
.award {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .4rem 1.5rem;
  align-items: baseline;
  padding: 1.5rem 0;
  transition: background-color .25s var(--ease);
}

@media (min-width: 640px) {
  .award { grid-template-columns: 130px minmax(0, 1fr) auto; gap: 2rem; }
}

.award__place {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}
.award__place--win { color: var(--red); }

.award__name { font-size: 1.2rem; letter-spacing: -.02em; }
.award__org { margin: .25rem 0 0; font-size: .9rem; color: var(--text-2); }
.award__year { font-family: var(--mono); font-size: .75rem; color: var(--text-3); }

@media (max-width: 639px) {
  .award__place { grid-column: 1; grid-row: 1; }
  .award__year { grid-column: 2; grid-row: 1; }
  .award > div { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Projects ---------- */
.project {
  display: grid;
  gap: .75rem;
  padding: 2rem 0;
}

@media (min-width: 640px) {
  .project { grid-template-columns: 130px minmax(0, 1fr); gap: 2rem; }
}

.project__num {
  padding-top: .35rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}

.project__meta {
  margin-bottom: .5rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--red);
}

.project__title {
  margin-bottom: .75rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -.03em;
}

.project__main > p:not(.project__meta):not(.project__stack):not(.project__links) {
  color: var(--text-2);
  max-width: 42rem;
}

.project__stack {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}

.project__links {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.1rem;
  font-size: .92rem;
  font-weight: 500;
}

.project__links a,
.cert__link {
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 2px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.project__links a:hover,
.cert__link:hover { color: var(--red); border-color: var(--red); }

/* ---------- Certifications ---------- */
.cert {
  display: grid;
  gap: .75rem;
  padding: 1.4rem 0;
}

@media (min-width: 640px) {
  .cert { grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; }
}

.cert__name { font-size: 1.1rem; font-weight: 500; letter-spacing: -.015em; line-height: 1.35; }
.cert__issuer { margin: .25rem 0 0; font-family: var(--mono); font-size: .75rem; color: var(--text-3); }
.cert__link { justify-self: start; font-size: .9rem; font-weight: 500; white-space: nowrap; }

/* ---------- Skills ---------- */
.skill {
  display: grid;
  gap: .4rem;
  padding: 1.4rem 0;
}

@media (min-width: 640px) {
  .skill { grid-template-columns: 180px minmax(0, 1fr); gap: 2rem; }
}

.skill dt {
  padding-top: .2rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}

.skill dd { font-size: 1.1rem; line-height: 1.6; letter-spacing: -.01em; }

/* ---------- Contact ---------- */
.section--last { border-top: 1px solid var(--rule); padding: clamp(5.5rem, 12vw, 9rem) 0; }

.contact { text-align: center; max-width: 820px; }

.contact .sec__label { margin-bottom: 1rem; }

.contact__title {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: .95;
}

.contact__sub {
  max-width: 34rem;
  margin: 1.5rem auto 0;
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: 1.7;
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .9rem;
  margin-top: 2.75rem;
}

.cbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 52px;
  padding: .75rem 1.75rem;
  border: 1px solid var(--text);
  color: var(--text);
  font-weight: 500;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.cbtn:hover { border-color: var(--red); color: var(--red); }

.cbtn--solid { background: var(--text); color: var(--bg); }
.cbtn--solid:hover { background: var(--red); border-color: var(--red); color: #fff; }

@media (max-width: 480px) {
  .contact__actions li { flex: 1 1 100%; }
  .cbtn { width: 100%; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
.site-footer a:hover { color: var(--text); }

/* ---------- Motion ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  .hero__actions .btn { flex: 1 1 auto; }
}
