/* ============================================================
   Tokens — light is the base, dark overrides below.
   ============================================================ */
:root {
  --bg:        #fbfbfa;
  --bg-soft:   #f2f2f0;
  --text:      #16161a;
  --text-dim:  #5c5c66;
  --text-faint:#8b8b96;
  --rule:      #e2e2de;
  --accent:    #5b4bd6;
  --accent-dim:#7a6ce8;
  --glow:      rgba(91, 75, 214, .07);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;

  --measure: 44rem;
  --pad: clamp(1.4rem, 5vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0c0d10;
    --bg-soft:   #16171b;
    --text:      #e9e9ec;
    --text-dim:  #9a9aa6;
    --text-faint:#6b6b78;
    --rule:      #232429;
    --accent:    #9b8cff;
    --accent-dim:#b3a7ff;
    --glow:      rgba(155, 140, 255, .10);
  }
}

:root[data-theme="dark"] {
  --bg:        #0c0d10;
  --bg-soft:   #16171b;
  --text:      #e9e9ec;
  --text-dim:  #9a9aa6;
  --text-faint:#6b6b78;
  --rule:      #232429;
  --accent:    #9b8cff;
  --accent-dim:#b3a7ff;
  --glow:      rgba(155, 140, 255, .10);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

/* Soft glow behind the top of the page. */
body::before {
  content: "";
  position: fixed;
  inset: -20vh 0 auto 0;
  height: 70vh;
  background: radial-gradient(60% 60% at 50% 0%, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: .6rem 1rem;
  background: var(--bg-soft);
  z-index: 10;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.6rem var(--pad) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--text);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: .3rem .5rem;
  transition: border-color .18s ease, color .18s ease;
}
.wordmark:hover { border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .18s ease, color .18s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg {
  width: 16px; height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the theme you would switch *to*. */
.i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun  { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
:root[data-theme="dark"]  .i-sun  { display: none; }
:root[data-theme="dark"]  .i-moon { display: block; }
:root[data-theme="light"] .i-sun  { display: block; }
:root[data-theme="light"] .i-moon { display: none; }

/* ============================================================
   Layout
   ============================================================ */
main {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: clamp(3.5rem, 12vh, 6.5rem) 0 clamp(3rem, 9vh, 4.5rem); }

.hero h1 {
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 650;
  letter-spacing: -0.035em;
  margin-bottom: 1.4rem;
}

.lede {
  font-size: clamp(1.08rem, 2.6vw, 1.25rem);
  line-height: 1.55;
  max-width: 34ch;
  margin-bottom: 1rem;
  text-wrap: pretty;
}

.bio {
  color: var(--text-dim);
  max-width: 58ch;
  text-wrap: pretty;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1.5rem;
  margin-top: 2rem;
}
.links a {
  font-size: .93rem;
  color: var(--text-dim);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
  transition: color .18s ease, border-color .18s ease;
}
.links a:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: clamp(2.5rem, 7vh, 4rem) 0; border-top: 1px solid var(--rule); }

.section-h {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-dim);
  margin-bottom: 2.4rem;
}
.section-h .num {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-faint);
}

/* ============================================================
   Projects
   ============================================================ */
.projects { display: grid; gap: 2.6rem; }

.project-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .6rem;
}
.project h3 { font-size: 1.14rem; font-weight: 600; }
.project .year {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-faint);
  flex-shrink: 0;
}
.project > p { color: var(--text-dim); max-width: 62ch; text-wrap: pretty; }

/* Engineering highlights under a project summary. */
.highlights {
  display: grid;
  gap: .7rem;
  margin-top: 1rem;
  padding-left: 1.05rem;
  border-left: 1px solid var(--rule);
}
.highlights li {
  font-size: .93rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 60ch;
  text-wrap: pretty;
}
.highlights strong { color: var(--text); font-weight: 600; }

/* Caveat line, e.g. confidentiality on client work. */
.note {
  margin-top: .95rem;
  font-size: .82rem;
  font-style: italic;
  color: var(--text-faint);
}

/* ============================================================
   Screenshot carousel
   Horizontal scroll-snap: native swipe on touch, arrows drive
   scrollBy() on desktop. No library.
   ============================================================ */
.shots { margin-top: 1.5rem; }

.shots-frame {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg-soft);
  scrollbar-width: none;              /* Firefox */
  -ms-overflow-style: none;
}
.shots-frame::-webkit-scrollbar { display: none; }
.shots-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .shots-frame { scroll-behavior: smooth; }
}

.shot {
  flex: 0 0 100%;
  scroll-snap-align: center;
  margin: 0;
  min-width: 0;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 9px;
}

.shots-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .7rem;
}
.shots-caption {
  font-size: .82rem;
  color: var(--text-faint);
  min-height: 1.2em;
}
.shots-nav { display: flex; align-items: center; gap: .45rem; flex-shrink: 0; }
.shots-count {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-faint);
  margin-right: .3rem;
  font-variant-numeric: tabular-nums;
}

.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.icon-btn[disabled] { opacity: .32; cursor: default; }
.icon-btn[disabled]:hover { border-color: var(--rule); color: var(--text-dim); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .9rem;
}
.tags li {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--text-dim);
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: .16rem .45rem;
}

.project-links {
  display: flex;
  gap: 1.2rem;
  margin-top: .95rem;
  font-size: .88rem;
}

/* ============================================================
   Experience timeline
   ============================================================ */
.timeline { display: grid; gap: 2.4rem; }

.role { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.5rem; }

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

.what h3 { font-size: 1.04rem; font-weight: 600; margin-bottom: .45rem; }
.what .at { font-weight: 400; color: var(--text-dim); }
.what p { color: var(--text-dim); max-width: 58ch; text-wrap: pretty; }

@media (max-width: 34rem) {
  .role { grid-template-columns: 1fr; gap: .5rem; }
  .when { padding-top: 0; }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.2rem var(--pad) 3.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 1rem;
  font-size: .82rem;
  color: var(--text-faint);
}
.colophon { font-family: var(--mono); font-size: .74rem; }

/* ============================================================
   Reveal on scroll — only when motion is welcome.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .6s ease, transform .6s ease;
  }
  .reveal.in { opacity: 1; transform: none; }
}

@media print {
  body::before, .topbar, .icon-btn { display: none; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
