:root {
  color-scheme: light dark;
  --bg: #f6f6f3;
  --text: #17181b;
  --muted: #666b73;
  --soft-text: #4f555e;
  --line: rgba(0,0,0,.11);
  --grid: rgba(0,0,0,.045);
  --grid-line: rgba(0,0,0,.045);
  --grid-effective: rgba(0,0,0,.0144);
  --accent: #477c16;
  --selection-text: #ffffff;
  --max: 760px;
  --header-height: 76px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090a0d;
    --text: #f2f3f5;
    --muted: #9399a3;
    --soft-text: #b5bac2;
    --line: rgba(255,255,255,.11);
    --grid: rgba(255,255,255,.035);
    --grid-line: rgba(255,255,255,.035);
    --grid-effective: rgba(255,255,255,.0112);
    --accent: #b8ff7a;
    --selection-text: #090a0d;
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f6f3;
  --text: #17181b;
  --muted: #666b73;
  --soft-text: #4f555e;
  --line: rgba(0,0,0,.11);
  --grid: rgba(0,0,0,.045);
  --grid-line: rgba(0,0,0,.045);
  --grid-effective: rgba(0,0,0,.0144);
  --accent: #477c16;
  --selection-text: #ffffff;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090a0d;
  --text: #f2f3f5;
  --muted: #9399a3;
  --soft-text: #b5bac2;
  --line: rgba(255,255,255,.11);
  --grid: rgba(255,255,255,.035);
  --grid-line: rgba(255,255,255,.035);
  --grid-effective: rgba(255,255,255,.0112);
  --accent: #b8ff7a;
  --selection-text: #090a0d;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow: visible;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .18s ease, color .18s ease;
}

button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--selection-text); }

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

/* A single background layer spans both header and content. */
.pixel-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  z-index: 0;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: .035;
  pointer-events: none;
  z-index: 3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/*
 * The browser/document owns the one scrollbar for the whole page. The fixed
 * header and the main content therefore use the same viewport width.
 */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 10;
  font-size: 14px;
  line-height: 1;
  background: transparent;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/*
 * This mask hides body text before it reaches the fixed header. Its grid is
 * anchored at viewport (0, 0), so it lines up exactly with the global grid.
 * The global noise layer remains on top of both, keeping the texture seamless.
 */
.header-mask {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 2;
  pointer-events: none;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-effective) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-effective) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: 0 0;
  transition: background-color .18s ease;
}

/* Main content uses normal document scrolling; it does not own a scrollbar. */
.scroll-shell {
  position: relative;
  z-index: 1;
  padding-top: var(--header-height);
  background: transparent;
}

.content-wrap {
  position: relative;
  z-index: 1;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-email-slot {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  white-space: nowrap;
}

.header-email-sizer {
  display: block;
  visibility: hidden;
  white-space: nowrap;
  font: inherit;
}

.header-email {
  appearance: none;
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s ease;
}

.header-email:hover,
.header-linkedin:hover {
  color: var(--accent);
}

.header-email:focus-visible,
.header-linkedin:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.site-header nav {
  display: flex;
  gap: 20px;
  color: var(--text);
}

.theme-toggle {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

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

.theme-icon {
  display: block;
  font-size: 17px;
  line-height: 1;
  transform: translateY(-.5px);
}

.intro { padding: 96px 0 58px; }
h1 {
  margin: 0;
  font-size: clamp(52px, 10vw, 82px);
  line-height: .98;
  letter-spacing: -.065em;
  font-weight: 680;
}

.lead {
  max-width: 650px;
  margin: 28px 0 0;
  font-size: clamp(19px, 3vw, 24px);
  line-height: 1.5;
  letter-spacing: -.02em;
}


.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
}
.links a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}

.section {
  padding: 72px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-height) + 20px);
}

.final-section { padding-bottom: 104px; }

.section h2 {
  margin: 0 0 38px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.entry + .entry { margin-top: 44px; }
.entry-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: baseline;
}

.entry h3, .project h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.015em;
}

.role, .date, .project-head span {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.date { white-space: nowrap; }
.entry > p:last-child {
  margin: 14px 0 0;
  color: var(--soft-text);
  font-size: 14px;
}
.entry strong { color: var(--text); font-weight: 650; }

.project-list { display: block; }
.project { padding: 0; }
.project + .project {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.project-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
}
.project-head span {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}
.project p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.award-main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.award-main strong { font-size: 16px; letter-spacing: -.015em; }
.award-main span, .muted { color: var(--muted); font-size: 14px; }
.muted { margin: 12px 0 0; }

@media (max-width: 700px) {
  .header-inner {
    align-items: center;
  }
  .header-left { gap: 14px; font-size: 13px; }
  .header-right { gap: 10px; }
  .site-header nav { gap: 13px; font-size: 13px; }
  .header-email-slot { font-size: 13px; }
}

@media (max-width: 620px) {
  :root { --header-height: 104px; }
  .wrap { width: min(calc(100% - 32px), var(--max)); }
  .header-inner {
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 11px;
  }
  .header-left {
    width: 100%;
    justify-content: space-between;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .site-header nav { gap: 15px; }
  .intro { padding: 70px 0 50px; }
  .section {
    padding: 58px 0;
    scroll-margin-top: calc(var(--header-height) + 20px);
  }
  .final-section { padding-bottom: 84px; }
  .entry-head, .project-head { align-items: flex-start; flex-direction: column; gap: 2px; }
  .entry + .entry { margin-top: 38px; }
}

/* Levenshtein easter eggs */
.levenshtein-inline {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}

.levenshtein-inline {
  position: relative;
  font-weight: inherit;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
  text-underline-offset: 5px;
  transition: color .15s ease, text-decoration-color .15s ease;
}

.levenshtein-inline:hover,
.levenshtein-inline:focus-visible,
.minecraft-description:hover,
.minecraft-description:focus-visible,
.project-github-link:hover,
.project-github-link:focus-visible {
  color: var(--accent);
}

.levenshtein-inline:focus-visible,
.minecraft-description:focus-visible,
.project-github-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.project-github-link {
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
  text-underline-offset: 5px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.minecraft-description {
  cursor: pointer;
  transition: color .15s ease;
}


@media (prefers-reduced-motion: reduce) {
  .levenshtein-inline,
  .minecraft-description,
  .project-github-link {
    transition: none;
  }
}

/* Header Levenshtein link + compact explanation section */
.levenshtein-nav {
  display: inline-block;
  min-width: 92px;
  text-align: right;
  white-space: nowrap;
}

.levenshtein-section p {
  max-width: 650px;
  margin: 0;
  color: var(--soft-text);
  font-size: 14px;
}

@media (max-width: 620px) {
  .levenshtein-nav {
    min-width: 86px;
  }
}