:root {
  --concrete: #e8ebed;
  --paper: #f3f5f6;
  --ink: #18222c;
  --graphite: #55616c;
  --rule: #c9ced3;
  --detect: #d7262c;
  --on-detect: #ffffff;
  --mark: #f2c230;
  --lesion-class: #0f6f8f;

  --asphalt: #20262c;
  --on-asphalt: #e9ecee;
  --on-asphalt-dim: #9aa5af;

  --gutter: clamp(16px, 5vw, 72px);
  --measure: 40rem;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --concrete: #1a1f24;
    --paper: #232a31;
    --ink: #e4e8eb;
    --graphite: #9aa5af;
    --rule: #36404a;
    --detect: #ff4b4b;
    --on-detect: #1a1f24;
    --lesion-class: #138bb3;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --concrete: #1a1f24;
  --paper: #232a31;
  --ink: #e4e8eb;
  --graphite: #9aa5af;
  --rule: #36404a;
  --detect: #ff4b4b;
  --on-detect: #1a1f24;
  --lesion-class: #138bb3;

  color-scheme: dark;
}

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

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

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

body {
  margin: 0;
  background: var(--concrete);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.55;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--detect);
  color: var(--on-detect);
}

h1,
h2,
h3,
h4,
p,
ol,
dl,
dd,
figure {
  margin: 0;
}

ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--detect);
  outline-offset: 4px;
}

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

/* Stage: header and hero over the live perception view */

.stage {
  --road: clamp(180px, 31svh, 300px);
  --detect: #ff4b4b;
  --on-detect: #20262c;

  position: relative;
  isolation: isolate;
  display: flex;
  min-height: max(660px, 100svh);
  flex-direction: column;
  padding-bottom: var(--road);
  overflow: hidden;
  background: var(--asphalt);
  color: var(--on-asphalt);
  color-scheme: dark;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.road-zone {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--road);
  pointer-events: none;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 1.25rem var(--gutter);
  font-size: 1rem;
}

.brand {
  font-weight: 650;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.site-nav a {
  color: var(--on-asphalt-dim);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--on-asphalt);
  text-decoration: underline;
}

.hero {
  display: grid;
  flex: 1;
  grid-template-columns: auto minmax(16rem, 28rem);
  align-content: end;
  align-items: end;
  justify-content: space-between;
  gap: 3rem var(--gutter);
  padding: clamp(3rem, 6vw, 4.5rem) var(--gutter) clamp(3.75rem, 6vw, 5rem);
}

.name {
  font-size: clamp(4rem, 12vw, 10.5rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 0.86;
  letter-spacing: -0.035em;
}

.detection {
  position: relative;
  display: inline-block;
  padding: 0.07em 0.12em 0.1em 0.08em;
}

.det-box {
  position: absolute;
  inset: 0;
  border: 3px solid var(--detect);
  pointer-events: none;
}

.det-label {
  position: absolute;
  bottom: 100%;
  left: -3px;
  padding: 0.2em 0.55em 0.15em;
  background: var(--detect);
  color: var(--on-detect);
  font-size: clamp(0.8125rem, 1.1vw, 1rem);
  font-weight: 650;
  font-stretch: 75%;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.hero-intro {
  max-width: 28rem;
  padding-bottom: 0.4rem;
}

.hero-intro p {
  font-size: 1.3125rem;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2rem;
}

.hero-intro .hero-actions {
  font-size: 1.125rem;
}

.button {
  display: inline-block;
  padding: 0.65em 1.1em;
  border-radius: 3px;
  background: var(--ink);
  color: var(--concrete);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}

.stage .button {
  background: var(--on-asphalt);
  color: var(--asphalt);
}

.button:hover,
.stage .button:hover {
  background: var(--detect);
  color: var(--on-detect);
}

.scene-note {
  position: absolute;
  bottom: calc(var(--road) + 1rem);
  left: var(--gutter);
  max-width: calc(100% - 2 * var(--gutter));
  color: var(--on-asphalt-dim);
  font-size: 0.875rem;
  font-stretch: 90%;
}

/* Sections */

.section {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(0, 3.4fr);
  gap: 1.5rem var(--gutter);
  padding: clamp(3rem, 7vw, 6rem) var(--gutter);
  border-top: 1px solid var(--rule);
}

.stage + main .section:first-child {
  border-top: 0;
}

.section h2 {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  font-size: 1.3125rem;
  font-weight: 650;
  line-height: 1.3;
}

.section-body {
  max-width: 62rem;
}

.section-body-wide {
  max-width: 76rem;
}

.section-body p {
  max-width: var(--measure);
}

/* Projects */

.project + .project {
  margin-top: clamp(4rem, 8vw, 6.5rem);
}

.project h3 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.project-what {
  margin: 0.85rem 0 1.25rem;
  font-size: 1.3125rem;
  line-height: 1.4;
}

.project-stack {
  margin-top: 1rem;
  color: var(--graphite);
  font-size: 1rem;
}

.project-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 2.5rem clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.75rem;
  counter-reset: stage;
}

.stages li {
  padding-top: 0.75rem;
  border-top: 2px solid var(--ink);
  counter-increment: stage;
}

.stages h4 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.stages h4::before {
  content: counter(stage);
  margin-right: 0.5em;
  color: var(--graphite);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.stages p {
  color: var(--graphite);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* DeepDerm illustration */

.derm-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px;
  background:
    radial-gradient(ellipse 60% 50% at 30% 25%, #e8bc9f, transparent),
    radial-gradient(ellipse 70% 60% at 78% 75%, #c08a6f, transparent),
    radial-gradient(circle at 55% 45%, #dcaa8c, #c4907a);
}

.lesion {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle, #9e3d37 0 30%, rgba(178, 72, 62, 0.55) 55%, transparent 72%);
  translate: -50% -50%;
}

.derm-box {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--w);
  height: var(--w);
  border: 2px solid var(--lesion-class);
  translate: -50% -50%;
}

.derm-box::before {
  position: absolute;
  bottom: 100%;
  left: -2px;
  padding: 0 0.35em;
  background: var(--lesion-class);
  color: #ffffff;
  content: attr(data-conf);
  font-size: 0.6875rem;
  font-weight: 650;
  font-stretch: 75%;
  line-height: 1.45;
}

.derm-result {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}

.derm-result span {
  color: var(--graphite);
}

figcaption {
  margin-top: 0.6rem;
  color: var(--graphite);
  font-size: 0.875rem;
}

/* TurkRAG retrieval example */

.rag {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
}

.rag-query {
  margin-bottom: 1.25rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.35;
  quotes: "“" "”";
}

.rag-query::before {
  content: open-quote;
}

.rag-query::after {
  content: close-quote;
}

.rag h4 {
  margin-bottom: 0.4rem;
  color: var(--graphite);
  font-size: 0.875rem;
  font-weight: 600;
}

.rag-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.rag ol {
  counter-reset: rank;
}

.rag li {
  padding: 0.3rem 0.45rem;
  margin-left: -0.45rem;
  border-radius: 3px;
  counter-increment: rank;
  font-size: 0.9375rem;
  line-height: 1.4;
  transition: background-color 120ms ease;
}

.rag li::before {
  display: inline-block;
  width: 1.2em;
  color: var(--graphite);
  content: counter(rank);
  font-variant-numeric: tabular-nums;
}

.rag-fused {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}

.rag-fused li {
  font-weight: 600;
}

.rag:has(li[data-doc="art7"]:hover) li[data-doc="art7"],
.rag:has(li[data-doc="policy"]:hover) li[data-doc="policy"],
.rag:has(li[data-doc="guide"]:hover) li[data-doc="guide"],
.rag:has(li[data-doc="notice"]:hover) li[data-doc="notice"] {
  background: color-mix(in srgb, var(--mark) 55%, transparent);
}

/* Experience */

.timeline li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
}

.timeline li + li {
  margin-top: 2.25rem;
}

.when {
  padding-top: 0.2rem;
  color: var(--graphite);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.timeline h3 {
  margin-bottom: 0.4rem;
  font-size: 1.3125rem;
  font-weight: 650;
  line-height: 1.3;
}

.subhead {
  margin: 3.5rem 0 1.25rem;
  font-size: 1.3125rem;
  font-weight: 650;
}

.timeline-compact li + li {
  margin-top: 0.75rem;
}

.timeline-compact .when {
  padding-top: 0.1rem;
}

/* Toolkit */

.toolkit {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  max-width: 56rem;
}

.toolkit dt,
.toolkit dd {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}

.toolkit dt {
  padding-right: 1.5rem;
  font-weight: 650;
}

.toolkit dd {
  max-width: var(--measure);
}

/* Terminal */

.terminal-hint {
  margin-bottom: 1.25rem;
}

kbd {
  padding: 0.05em 0.35em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.875em;
}

.terminal {
  display: flex;
  flex-direction: column;
  max-width: 50rem;
  height: 26rem;
  border-radius: 4px;
  background: var(--asphalt);
  color: var(--on-asphalt);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.55;
  cursor: text;
}

.terminal:focus-within {
  outline: 3px solid var(--detect);
  outline-offset: 4px;
}

.output {
  flex: 1;
  min-height: 0;
  padding: 1.25rem 1.25rem 0.5rem;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.output .cmd {
  color: var(--on-asphalt-dim);
}

.input-line {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 0 1.25rem 1.25rem;
}

.prompt {
  flex: 0 0 auto;
  color: var(--on-asphalt-dim);
}

.input-line input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--on-asphalt);
  font: inherit;
  caret-color: #ff4b4b;
}

/* Contact */

.contact .section-body > p:first-child {
  font-size: 1.3125rem;
}

.contact-email {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: clamp(1.375rem, 6.2vw, 3.75rem);
  font-weight: 750;
  font-stretch: 108%;
  line-height: 1.1;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

.contact-email:hover {
  text-decoration-color: var(--detect);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-top: 2rem;
}

/* Responsive */

@media (max-width: 1080px) {
  .stages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-split {
    grid-template-columns: 1fr;
  }

  .derm,
  .rag {
    max-width: 36rem;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section {
    grid-template-columns: 1fr;
  }

  .section h2 {
    position: static;
  }
}

@media (max-width: 560px) {
  .stage {
    --road: clamp(170px, 30svh, 230px);

    min-height: 0;
  }

  .site-nav {
    gap: 0.25rem 1.1rem;
  }

  .hero {
    padding-top: 3.5rem;
    padding-bottom: 4.5rem;
  }

  .name {
    font-size: 20vw;
  }

  .det-box {
    border-width: 2px;
  }

  .det-label {
    left: -2px;
  }

  .stages,
  .timeline li,
  .toolkit,
  .rag-lists {
    grid-template-columns: 1fr;
  }

  .toolkit dt {
    padding-bottom: 0.25rem;
  }

  .toolkit dd {
    padding-top: 0;
    border-top: 0;
  }

  .terminal {
    height: 22rem;
    font-size: 0.875rem;
  }
}
