:root {
  --bg: #0d0d0d;
  --bg-raised: #161616;
  --fg: #d3d3d3;
  --fg-dim: #8a8a8a;
  --fg-strong: #f0f0f0;
  --rule: #2a2a2a;
  --accent: #d4a574;
  --accent-dim: #8a6a40;

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

  --content-width: 780px;
  --gutter: 28px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 72px var(--gutter) 96px;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent); }

h1, h2, h3 {
  color: var(--fg-strong);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.25; margin-bottom: 8px; }
h3 { font-size: 17px; line-height: 1.35; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--fg-strong); }

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
code {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  padding: 0 5px;
  border-radius: 3px;
  color: var(--fg-strong);
  white-space: nowrap;
}

strong { color: var(--fg-strong); font-weight: 600; }

ul, ol { margin: 0 0 14px; padding-left: 22px; }
li { margin-bottom: 4px; }
li::marker { color: var(--fg-dim); }

ul.proto-list { list-style: none; padding-left: 0; }
ul.proto-list li {
  padding-left: 18px;
  position: relative;
  margin-bottom: 6px;
}
ul.proto-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}

ol.steps { padding-left: 24px; }
ol.steps li { margin-bottom: 6px; }

dl.decisions { margin: 0 0 14px; }
dl.decisions dt {
  font-weight: 600;
  color: var(--fg-strong);
  margin-top: 12px;
}
dl.decisions dt:first-child { margin-top: 0; }
dl.decisions dd { margin: 2px 0 0; color: var(--fg); }

p.principle {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 14px;
  margin: 16px 0;
  color: var(--fg);
  font-style: normal;
}

/* ---------- header ---------- */

.site-header {
  margin-bottom: 64px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
}

.site-header h1 {
  font-size: 32px;
  margin-bottom: 6px;
}

.site-header .tagline {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--fg-dim);
  margin: 0 0 22px;
}

.site-header .summary {
  font-size: 17px;
  color: var(--fg);
  margin: 0 0 22px;
  max-width: 60ch;
}

.header-links {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
}
.header-links a { color: var(--fg); }
.header-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.header-links .sep { padding: 0 8px; color: var(--rule); }

/* ---------- project section ---------- */

.project {
  margin-bottom: 72px;
  padding-bottom: 72px;
  border-bottom: 1px solid var(--rule);
}
.project:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.project-header {
  margin-bottom: 28px;
}

.project-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

.project-header h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

/* ---------- screenshot grid ---------- */

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 0;
}
.screenshot-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.screenshot {
  display: block;
  border: 1px solid var(--rule);
  background: #121212;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 120ms ease;
  line-height: 0;
}
.screenshot:hover,
.screenshot:focus-visible {
  border-color: var(--accent-dim);
  outline: none;
}
.screenshot:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.screenshot img {
  display: block;
  width: 100%;
  height: auto;
}
.screenshot-figure figcaption {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 10px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .screenshot-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* ---------- other things section ---------- */

.other {
  margin-bottom: 72px;
  padding-top: 72px;
  border-top: 1px solid var(--rule);
}
.other h2 {
  font-size: 24px;
  margin-bottom: 20px;
}
.other p,
.other li {
  max-width: 64ch;
}

.project-header .one-liner {
  color: var(--fg);
  font-size: 16px;
  margin-bottom: 10px;
  max-width: 64ch;
}

.project-header .role {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
  margin: 0;
}
.project-header .role .label { color: var(--accent-dim); }

.project-section {
  margin-top: 26px;
}

/* ---------- diagram ---------- */

.diagram {
  margin: 8px 0 36px;
}
.diagram-frame {
  /* button reset */
  appearance: none;
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
  display: block;
  position: relative;

  border: 1px solid var(--rule);
  background: #121212;
  padding: 16px;
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 120ms ease;
}
.diagram-frame:hover,
.diagram-frame:focus-visible {
  border-color: var(--accent-dim);
  outline: none;
}
.diagram-frame:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.diagram-frame svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 600px;
}
.diagram-hint {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.diagram-frame:hover .diagram-hint,
.diagram-frame:focus-visible .diagram-hint {
  opacity: 1;
}

@media (max-width: 640px) {
  .diagram-frame {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
  }
  .diagram-frame svg {
    width: 680px;
    max-width: none;
    max-height: 480px;
  }
  .diagram-hint { opacity: 1; }
}

/* ---------- lightbox dialog ---------- */

dialog#lightbox {
  margin: auto;
  width: 95vw;
  height: 95vh;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--rule);
  background: #121212;
  color: var(--fg);
  overflow: hidden;
}
dialog#lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}
.lightbox-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  box-sizing: border-box;
  overflow: auto;
}
.lightbox-content svg,
.lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.lightbox-close {
  position: absolute;
  top: 10px;
  right: 14px;
  appearance: none;
  background: transparent;
  border: none;
  font: inherit;
  font-size: 28px;
  line-height: 1;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 4px 10px;
  z-index: 2;
}
.lightbox-close:hover,
.lightbox-close:focus-visible {
  color: var(--accent);
  outline: none;
}
.diagram figcaption {
  font-family: var(--font-sans);
  font-style: italic;
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 12px;
  text-align: center;
}

/* ---------- tech stack ---------- */

.tech-stack {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.tech-stack .label {
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  flex-shrink: 0;
}
.tech-stack ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--fg);
}
.tech-stack li { margin: 0; position: relative; }
.tech-stack li:not(:last-child)::after {
  content: "·";
  position: absolute;
  right: -10px;
  color: var(--rule);
}

/* ---------- skills ---------- */

.skills {
  margin-bottom: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.skills h2 { margin-bottom: 18px; }
.skills dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 24px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.skills dt {
  color: var(--accent-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  padding-top: 2px;
}
.skills dd {
  margin: 0;
  color: var(--fg);
}

/* ---------- education ---------- */

.education {
  margin-bottom: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.education h2 { margin-bottom: 18px; }
.education .degree {
  color: var(--fg);
  margin-bottom: 18px;
}
.education .certs-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin: 0 0 8px;
}
.education ul.certs {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
.education ul.certs li {
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
}
.education ul.certs li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent-dim);
}

/* ---------- footer ---------- */

.site-footer {
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-dim);
}
.site-footer a { color: var(--fg); }
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.site-footer .sep { padding: 0 8px; color: var(--rule); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  main { padding: 48px 20px 64px; }
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  .site-header h1 { font-size: 26px; }
  .skills dl { grid-template-columns: 1fr; gap: 4px 0; }
  .skills dt { padding-top: 14px; }
  .skills dt:first-child { padding-top: 0; }
  .project { margin-bottom: 64px; }
  .other { margin-bottom: 56px; padding-top: 56px; }
  .diagram-frame { padding: 10px; }
}

/* ---------- selection ---------- */

::selection {
  background: var(--accent);
  color: var(--bg);
}
