:root {
  color-scheme: dark;
  /* Dark theme — true black, monochrome, jdx-style hairlines */
  --bg: #050506;
  --surface: transparent;
  --surface-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #ededed;
  --text-muted: #a6a7ac;
  --text-dim: #74767c;
  /* Black & white interactive color (no blue) */
  --link: #ededed;
  --link-strong: #ffffff;

  --font-serif: "Lora", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;

  --radius: 0.85rem;
  --radius-pill: 999px;
  --content-width: 44rem;
  --transition: 180ms ease;
  --section-space: clamp(3.25rem, 6vw, 4.5rem);
  --card-pad: 1.35rem;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f1eb;
  --surface: rgba(15, 17, 22, 0.04);
  --surface-hover: rgba(15, 17, 22, 0.08);
  --border: rgba(15, 17, 22, 0.16);
  --border-strong: rgba(15, 17, 22, 0.26);
  --text: #12141a;
  --text-muted: #4f5766;
  --text-dim: #6c7382;
  --link: #12141a;
  --link-strong: #000000;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Keep the original layered light-theme background. */
[data-theme="light"] body {
  background:
    radial-gradient(circle at top, rgba(0, 0, 0, 0.04), transparent 34%),
    linear-gradient(180deg, #f4f1eb 0%, #f4f1eb 64%, #ece7df 100%);
}

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

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

img,
svg {
  display: block;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(-220%);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: transform var(--transition);
  z-index: 20;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
.profile,
.section,
.site-footer {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
}

.site-header {
  padding-top: 0.5rem;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.brand,
.nav-actions a,
.theme-toggle {
  font-size: 0.85rem;
}

.brand {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-actions a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.nav-actions a:hover {
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.theme-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.theme-icon--moon {
  display: none;
}

[data-theme="light"] .theme-icon--sun {
  display: none;
}

[data-theme="light"] .theme-icon--moon {
  display: block;
}

/* ---------- Compact profile ---------- */

.profile {
  padding-top: 2.6rem;
}

.profile-name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 4.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.profile-bio {
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 54ch;
}

.profile .social-links {
  margin-top: 1.15rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
}

.social-links a:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--link-strong);
}

.social-links svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
  stroke: currentColor;
}

/* ---------- Sections ---------- */

.section {
  padding-top: var(--section-space);
}

.eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-card {
  display: grid;
  gap: 0.9rem;
  padding: var(--card-pad);
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card-links a,
.quiet-link a {
  color: var(--link);
  font-weight: 500;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1px;
  transition: color var(--transition), border-color var(--transition);
}

.card-links a:hover,
.quiet-link a:hover {
  color: var(--link-strong);
  border-color: var(--link-strong);
}

.quiet-link {
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ---------- Tags / pills ---------- */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
}

.tag-row span {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  background: transparent;
  transition: border-color var(--transition), color var(--transition);
}

.tag-row span:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* ---------- Tech stack ---------- */

.tech-list {
  margin: 0;
  display: grid;
  gap: 1.35rem;
}

.tech-group {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: 0.7rem 1.25rem;
  align-items: baseline;
}

.tech-group dt {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
}

.tech-group dd {
  margin: 0;
}

/* ---------- Experience ---------- */

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

.experience-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

.experience-company {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.experience-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.experience-role {
  margin-top: 0.15rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.experience-desc {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ---------- GitHub ---------- */

.section-note {
  margin: 0 0 1.1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.subtle-note {
  margin: 1.25rem 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.stat-card {
  display: grid;
  gap: 0.45rem;
  padding: 1.05rem 1.1rem;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 4vw, 2.1rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.github-block {
  margin-top: 1.85rem;
  display: grid;
  gap: 0.9rem;
}

.block-title {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chart-placeholder {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.language-chart {
  display: grid;
  gap: 0.75rem;
}

.language-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
}

.language-name,
.language-percent {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.language-track {
  position: relative;
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

[data-theme="light"] .language-track {
  background: rgba(15, 17, 22, 0.1);
}

.language-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--text);
}

/* ---------- Contributions heatmap (GitHub dark style) ---------- */
/* ghchart renders green squares on light-gray empties. invert + hue-rotate
   flips it to GitHub's dark look: dark empties, brighter green = more active. */

.heatmap {
  margin: 0;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

.heatmap-img {
  width: 100%;
  min-width: 34rem;
  height: auto;
  filter: invert(1) hue-rotate(180deg);
}

.heatmap-fallback {
  margin: 0;
  min-width: 0;
  color: #8b949e;
  font-size: 0.9rem;
}

.heatmap-fallback a {
  color: #58a6ff;
  font-weight: 500;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 3.25rem 0 2.25rem;
}

.copyright {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* ---------- Responsive ---------- */

@media (max-width: 34rem) {
  .top-nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    gap: 0.7rem 1rem;
    justify-content: flex-start;
  }

  .tech-group {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }

  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .experience-meta {
    white-space: normal;
  }

  .language-row {
    grid-template-columns: minmax(0, 6rem) minmax(0, 1fr);
  }

  .language-percent {
    grid-column: 2;
    justify-self: end;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
