:root {
  color-scheme: dark;
  --bg: #0f1115;
  --panel: #14171d;
  --text: #e6e1d8;
  --muted: #b8b2a6;
  --border: #2a2e36;
  --border-soft: rgba(42, 46, 54, 0.7);
  --accent: #d6d0c4;
  --focus: #8ab4ff;
  --nav-active: rgba(214, 208, 196, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

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

a:hover,
a:focus-visible {
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: -999px;
  background: var(--panel);
  color: var(--text);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  z-index: 10;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.top-anchor {
  position: absolute;
  top: 0;
  left: 0;
  height: 0;
}

.page {
  width: 100%;
  max-width: 1200px;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.75rem;
  align-items: start;
}

.page > * {
  min-width: 0;
}

.rail {
  padding: 1.25rem;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 10px;
  align-self: start;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .rail {
    position: sticky;
    top: 2rem;
    max-height: none;
    overflow: visible;
  }

  #about p {
    font-size: 0.85rem;
  }
}

.rail-block {
  position: relative;
  padding-top: 0.25rem;
}

.rail-block + .rail-block {
  padding-top: 0.85rem;
}

.rail-block + .rail-block::before {
  content: "";
  position: absolute;
  inset: -0.65rem 0 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(214, 208, 196, 0) 0%, rgba(214, 208, 196, 0.08) 50%, rgba(214, 208, 196, 0) 100%);
  opacity: 0.7;
  pointer-events: none;
}

#about.rail-block::after {
  content: "";
  position: absolute;
  inset: auto 0 -0.65rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(214, 208, 196, 0) 0%, rgba(214, 208, 196, 0.08) 50%, rgba(214, 208, 196, 0) 100%);
  opacity: 0.7;
  pointer-events: none;
}

.anchor-nav.rail-block::before {
  display: none;
}

.rail-block:last-of-type::after {
  content: "";
  position: absolute;
  inset: auto 0 -0.65rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(214, 208, 196, 0) 0%, rgba(214, 208, 196, 0.06) 50%, rgba(214, 208, 196, 0) 100%);
  opacity: 0.7;
  pointer-events: none;
}

.identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.headshot {
  width: 100%;
  max-width: 118px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d11;
  margin: 0.35rem auto 1.05rem;
  filter: saturate(0.9);
}

.headshot img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.identity-text {
  width: 100%;
}

.identity-text h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: 0.01em;
}

.headline {
  margin: 0.2rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.location {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

section {
  margin-bottom: 2rem;
}

.rail section {
  margin-bottom: 1.15rem;
}

.section-header {
  margin-bottom: 1.35rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.section-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.rail h2 {
  font-size: 1.3rem;
}

h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #1a1d24;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

.button:hover,
.button:focus-visible {
  background: #1f222b;
  border-color: rgba(214, 208, 196, 0.35);
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.button:active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(214, 208, 196, 0.25);
}

.button.ghost:hover,
.button.ghost:focus-visible {
  background: rgba(214, 208, 196, 0.07);
}

.project-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.35rem;
  background: var(--panel);
  display: grid;
  gap: 0.85rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.project-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.project-card-media {
  position: relative;
}

.project-card-image {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0f131a;
}

.project-card-image img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 140ms ease, box-shadow 160ms ease;
}

.project-card-image:focus-visible img,
.project-card-image:hover img {
  transform: scale(1.01);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.project-card-source {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.project-card-source:hover {
  background: rgba(0, 0, 0, 0.7);
}

.project-card-source:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.project-card-media:hover .project-card-source,
.project-card-media:focus-within .project-card-source {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  .project-card-source {
    opacity: 1;
    transform: none;
  }
}

.project-card-source-icon {
  width: 18px;
  height: 18px;
}

@media (min-width: 720px) {
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.role {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  position: relative;
  overflow: hidden;
}

.role::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 3px 0 0 rgba(214, 208, 196, 0.08);
  pointer-events: none;
}

.meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.role ul {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--text);
  display: grid;
  gap: 0.45rem;
}

.role + .role {
  margin-top: 1.1rem;
}

.role + .section-header {
  margin-top: 1.35rem;
}

.section-header + .role {
  margin-top: 0.35rem;
}

.contact-links {
  margin-top: 0.75rem;
  margin-bottom: 0.4rem;
}

.contact-links ul {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.contact-links li {
  color: var(--muted);
}

.contact-links .contact-link,
.contact-links .contact-link-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 9px;
  color: var(--text);
  line-height: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.16);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.contact-links .contact-link-live:hover,
.contact-links .contact-link-live:focus-visible {
  background: rgba(214, 208, 196, 0.09);
  border-color: rgba(214, 208, 196, 0.35);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  outline: 2px solid transparent;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), 0 0 0 2px rgba(138, 180, 255, 0.25);
}

.contact-links .contact-link-live:active {
  transform: translateY(1px);
  background: rgba(214, 208, 196, 0.07);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.anchor-nav {
  margin-bottom: 1.25rem;
}

.anchor-nav ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.anchor-nav a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-left: 3px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9em;
}

.anchor-nav a:hover,
.anchor-nav a:focus-visible {
  background: rgba(214, 208, 196, 0.05);
  border-left-color: var(--border);
  text-decoration: none;
}

.anchor-nav a[aria-current="location"] {
  background: var(--nav-active);
  border-left-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.anchor-nav a[aria-current="location"]:hover,
.anchor-nav a[aria-current="location"]:focus-visible {
  background: var(--nav-active);
  border-left-color: var(--accent);
}

.education-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.muted {
  color: var(--muted);
  margin-top: 0;
}

.reassurance {
  margin-top: 0.2rem;
  color: rgba(184, 178, 166, 0.9);
}

.form-status {
  margin: 0 0 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1117;
  color: var(--text);
}

.form-status.success {
  border-color: rgba(138, 180, 255, 0.3);
  background: rgba(138, 180, 255, 0.08);
}

.form-status.error {
  border-color: rgba(255, 99, 71, 0.35);
  background: rgba(255, 99, 71, 0.08);
}

.form-status p {
  margin: 0;
}

.noscript-note {
  margin: 0 0 0.85rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px dashed rgba(214, 208, 196, 0.35);
  background: rgba(255, 255, 255, 0.02);
}

form {
  display: grid;
  gap: 1rem;
  border: 1px solid var(--border);
  padding: 1.35rem;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.form-group {
  display: grid;
  gap: 0.35rem;
}

label {
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0d11;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
  border-color: rgba(138, 180, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(138, 180, 255, 0.16);
}

button {
  padding: 0.75rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #1a1d24;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}

button:hover,
button:focus-visible {
  background: #1f222b;
  border-color: rgba(214, 208, 196, 0.35);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.to-top {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-40%);
  width: 56px;
  height: 56px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #161920;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 150ms ease;
}

.to-top svg {
  display: block;
}

.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover,
.to-top:focus-visible {
  background: #1c2028;
}

.honeypot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
  display: grid;
  gap: 0.35rem;
}

.footer-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-identity {
  margin: 0;
}

.footer-icon-link,
.chess-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  color: var(--muted);
  line-height: 0;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease, outline-color 0.2s ease;
}

.footer-icon-link:hover,
.footer-icon-link:focus-visible,
.chess-link:hover,
.chess-link:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.footer-icon-link:focus-visible,
.chess-link:focus-visible {
  outline: 1px solid var(--focus);
  outline-offset: 2px;
}

.footer-icon-link svg,
.chess-link svg {
  display: block;
}

.last-updated {
  margin: 0;
}

.e404-page {
  align-items: start;
}

.e404-rail {
  display: grid;
  gap: 0.75rem;
  align-self: start;
}

.e404-rail-heading {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.e404-nav ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.e404-nav a {
  display: block;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.e404-panel {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  background: var(--panel);
  max-width: 100%;
}

.e404-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 100% 48px, 56px 100%;
  opacity: 0.07;
  pointer-events: none;
}

.e404-panel > * {
  position: relative;
  z-index: 1;
}

.e404-content {
  gap: 1.5rem;
}

.e404-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.e404-status {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.e404-grid {
  margin: 1rem 0 0;
  padding: 0;
}

.e404-grid-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border);
}

.e404-grid dt {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.e404-grid dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.e404-picks-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.4rem;
}

.e404-picks-list li {
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
}

.e404-picks-list a {
  font-weight: 600;
}

.e404-cycle-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 899px) {
  .page {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    top: auto;
    max-height: none;
    overflow: visible;
    padding: 1.15rem 1.2rem;
    gap: 1.1rem;
  }

  .headshot {
    max-width: 108px;
    margin: 0.65rem auto 1.35rem;
  }

  .to-top {
    top: auto;
    bottom: 24px;
    transform: none;
  }

  #contact {
    margin-top: 0.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(214, 208, 196, 0.06);
  }
}

@media (max-width: 600px) {
  .headshot {
    max-width: 92px;
    margin: 0.85rem auto 1.5rem;
  }

  .to-top {
    right: 14px;
    bottom: 76px;
  }

  .e404-grid-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --text: #f0ece4;
    --muted: #ccc5b8;
    --border: #3a3f48;
  }

  .page,
  .rail,
  .role,
  form {
    border-color: var(--border);
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  html {
    background: #ffffff;
    color: #111111;
    font-size: 12pt;
  }

  body {
    justify-content: flex-start;
  }

  .page {
    padding: 0;
    max-width: none;
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    border: none;
    background: transparent;
    padding: 0 0 1rem;
  }

  .role,
  form {
    border-color: #cccccc;
    background: #ffffff;
  }

  .headshot img,
  .headshot {
    display: none;
  }

  .skip-link {
    display: none;
  }
}
