:root {
  --bg: #f7f7f5;
  --fg: #141413;
  --muted: #6b6b66;
  --border: #e2e2dc;
  --surface: #efefe9;
  --accent: #0f6e6a;
  --success: #22865c;
  --header: 56px;
  --content: 42rem;
  --radius: 0.45rem;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #10100f;
  --fg: #f3f3ee;
  --muted: #a4a49c;
  --border: #2b2b27;
  --surface: #1b1b18;
  --accent: #4ecdc4;
  --success: #4ade80;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent);
  z-index: 40;
}

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

a:hover {
  color: var(--fg);
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 60;
  padding: 8px 12px;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: min(var(--content), calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header);
  gap: 12px;
}

.nav-links {
  display: flex;
  gap: 16px;
  font-size: 14px;
  font-weight: 500;
}

.nav-links a {
  color: var(--muted);
  transition: color 150ms ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--fg);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
  font: inherit;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-btn:hover {
  color: var(--fg);
  background: var(--surface);
}

.icon-btn:active {
  transform: scale(0.98);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  .kbd {
    display: none;
  }
}

main {
  padding: 32px 0 80px;
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
}

.identity {
  display: grid;
  gap: 12px;
}

.avatar {
  width: 80px;
  height: 80px;
  object-fit: cover;
  object-position: center 18%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.lede,
.meta,
.muted {
  color: var(--muted);
}

.identity-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  font-size: 14px;
}

.copy-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 0;
  transition: color 150ms ease;
}

.copy-btn:hover {
  color: var(--fg);
}

.status-line {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

.status-line b {
  color: var(--fg);
  font-weight: 500;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 14px;
  font-weight: 500;
}

.hero-links a {
  color: var(--muted);
  transition: color 150ms ease;
}

.hero-links a:hover {
  color: var(--fg);
}

.principles {
  display: grid;
  gap: 8px;
}

.principle h3 {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.principle p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.socials {
  display: flex;
  gap: 8px;
}

.socials a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  border-radius: 8px;
  transition: color 150ms ease, background 150ms ease;
}

.socials a:hover {
  color: var(--fg);
  background: var(--surface);
}

.socials svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.section {
  margin-top: 40px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.more {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 150ms ease;
}

.more:hover {
  color: var(--fg);
}

.stack {
  display: grid;
  gap: 8px;
}

.row,
.exp,
.system,
.post {
  width: 100%;
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  text-align: left;
  transition: background 150ms ease, border-color 150ms ease;
}

a.row:hover,
a.system:hover,
a.post:hover,
.exp:hover {
  background: var(--surface);
}

.row-top,
.exp-top,
.post-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.row-top h3,
.system h3,
.post h3,
.exp h3 {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
}

.row-meta,
.exp-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
}

.row p,
.system p,
.post p,
.exp p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 14%, var(--bg));
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
}

.badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

.expand {
  margin-top: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.expand:hover {
  color: var(--fg);
}

.details {
  display: none;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.details.open {
  display: block;
}

.details ul {
  margin: 0;
  padding-left: 18px;
}

.details li {
  margin: 6px 0;
  font-size: 14px;
  line-height: 20px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag,
.filter {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.filter {
  background: var(--bg);
  cursor: pointer;
  font: inherit;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.filter[aria-pressed="true"] {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.post-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.record {
  padding: 8px 0 28px;
  border-bottom: 1px solid var(--border);
}

.record:last-of-type {
  border-bottom: 0;
}

.record h2 {
  font-size: 18px;
}

.record h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tech li {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
}

.page-intro {
  margin-bottom: 28px;
}

.page-intro p {
  margin: 8px 0 0;
  color: var(--muted);
}

.article h1,
.article h2,
.article h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: 0;
}

.article h1 {
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.15;
  margin: 12px 0 12px;
}

.article h2 {
  font-size: 30px;
  line-height: 36px;
  margin: 32px 0 16px;
}

.article h3 {
  font-size: 24px;
  line-height: 32px;
  margin: 24px 0 12px;
}

.article p,
.article li {
  font-size: 16px;
  line-height: 24px;
}

.article p {
  margin: 0 0 16px;
}

.article a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article blockquote {
  margin: 20px 0;
  padding: 0 0 0 16px;
  border-left: 4px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.article code,
.inline-code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
}

.article pre {
  overflow: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
}

.article pre code {
  padding: 0;
  background: transparent;
}

.back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.article-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.share {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.progress-pill {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  display: none;
  transform: translateX(-50%);
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #141413;
  color: #f3f3ee;
  font-size: 12px;
}

[data-theme="dark"] .progress-pill {
  background: #f3f3ee;
  color: #141413;
}

.progress-pill.show {
  display: inline-flex;
}

.ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(currentColor calc(var(--p, 0) * 1%), transparent 0);
}

.resume {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  background: color-mix(in srgb, var(--bg) 92%, white);
}

.resume h2 {
  margin: 28px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.resume h2:first-of-type {
  margin-top: 18px;
}

.resume h3 {
  margin: 14px 0 4px;
  font-size: 16px;
}

.resume ul {
  margin: 0;
  padding-left: 18px;
}

.resume-name {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.resume-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.resume-links {
  display: grid;
  gap: 4px;
  font-size: 14px;
  color: var(--muted);
}

.resume-links a {
  color: var(--accent);
}

.not-found {
  padding: 48px 0;
}

.not-found .code {
  font-family: var(--font-mono);
  font-size: 56px;
  line-height: 1;
  color: var(--accent);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
}

.btn.ghost {
  background: transparent;
  color: var(--fg);
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 48px 0 28px;
}

.quote {
  margin: 0 0 28px;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 30px;
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.footer-cols h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.footer-cols a,
.footer-cols p {
  display: block;
  margin: 6px 0;
  color: var(--muted);
  font-size: 14px;
}

.footer-cols a:hover {
  color: var(--fg);
}

.copyright {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: start center;
  padding: 12vh 16px 16px;
  background: color-mix(in srgb, #000 40%, transparent);
}

.dialog.open {
  display: grid;
}

.dialog-panel {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}

.dialog-panel input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  padding: 14px 16px;
  font: inherit;
}

.dialog-panel input:focus {
  outline: none;
}

.dialog-panel ul {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 320px;
  overflow: auto;
}

.dialog-panel a,
.dialog-empty {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.dialog-panel a:hover,
.dialog-panel a.active {
  background: var(--surface);
  color: var(--fg);
}

.dialog-panel strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: none;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
}

.toast.show {
  display: block;
}

@media (max-width: 640px) {
  .row-top,
  .exp-top,
  .post-top,
  .resume-top,
  .article-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .row-meta,
  .exp-meta {
    white-space: normal;
  }

  .footer-cols {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header,
  .site-footer,
  .skip,
  .nav-tools,
  .progress-pill,
  .share,
  body::before {
    display: none !important;
  }

  main {
    padding: 0;
  }

  .resume {
    border: 0;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
