/* ── Theme ── */
:root {
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-display: "Newsreader", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --accent: #9a3412;
  --accent-hover: #7c2d12;
  --accent-soft: rgba(154, 52, 18, 0.08);
  --line: #d6d0c8;
  --line-strong: #b8b0a4;

  --radius: 6px;
  --radius-lg: 10px;
  --wrap: 720px;
  --wrap-wide: 980px;
  --header-h: 58px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f0;
  --bg-alt: #efebe3;
  --surface: #fffcf7;
  --surface-hover: #fff;
  --text: #1c1917;
  --text-muted: #57534e;
  --header-bg: rgba(247, 245, 240, 0.94);
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.04), 0 4px 16px rgba(28, 25, 23, 0.05);
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent: #ea580c;
  --accent-hover: #fb923c;
  --accent-soft: rgba(234, 88, 12, 0.1);
  --line: #3f3a36;
  --line-strong: #57534e;

  --bg: #121110;
  --bg-alt: #1a1816;
  --surface: #1e1c1a;
  --surface-hover: #252220;
  --text: #e7e5e0;
  --text-muted: #a8a29e;
  --header-bg: rgba(18, 17, 16, 0.94);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.25);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.25rem);
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-muted);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 150ms ease;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  padding: 0.12em 0.4em;
  border-radius: 3px;
}

ul {
  list-style: none;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap--wide {
  max-width: var(--wrap-wide);
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--header-h);
  padding: 0 1.5rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  min-width: 0;
  flex-shrink: 1;
}

.site-header__brand:hover .site-header__name {
  color: var(--accent);
}

.site-header__avatar {
  flex-shrink: 0;
}

.site-header__name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shared avatar */
.avatar {
  display: block;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg-alt);
}

.avatar--sm {
  width: 32px;
  height: 32px;
}

.avatar--md {
  width: 72px;
  height: 72px;
}

.avatar--lg {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  margin-inline: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.1rem;
  margin-left: auto;
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
}

.site-nav a.is-active {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--accent);
}

.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  flex-shrink: 0;
}

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

.theme-toggle__label--dark {
  display: none;
}

[data-theme="dark"] .theme-toggle__label--light {
  display: none;
}

[data-theme="dark"] .theme-toggle__label--dark {
  display: inline;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  height: 1.5px;
  background: var(--text);
  transition: transform 200ms ease;
}

.nav-open .nav__toggle span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.nav-open .nav__toggle span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* ── Sections ── */
.section {
  padding: 5rem 0;
  border-bottom: 1px solid var(--line);
}

.section--alt {
  background: var(--bg-alt);
}

.section--hero {
  padding-top: 3.5rem;
  padding-bottom: 5.5rem;
}

.section--footer {
  border-bottom: none;
  padding-bottom: 4rem;
}

.section-header {
  margin-bottom: 2.5rem;
  max-width: 52ch;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.625rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.section-lede {
  font-size: 1.0625rem;
  color: var(--text-muted);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ── Hero ── */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem 4rem;
  align-items: start;
}

.hero-main h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.875rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--text);
  max-width: 20ch;
  margin-bottom: 1.5rem;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 58ch;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

[data-theme="dark"] .btn--primary {
  color: #121110;
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

[data-theme="dark"] .btn--primary:hover {
  color: #121110;
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.btn--ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.hero-aside {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.hero-profile {
  position: relative;
  margin: 0 0 1.35rem;
  width: 100%;
  max-width: 200px;
  margin-inline: auto;
}

.hero-profile__monogram {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #fff;
  background: var(--accent);
  border: 2px solid var(--surface);
  border-radius: 50%;
  line-height: 1;
}

[data-theme="dark"] .hero-profile__monogram {
  color: #121110;
}

.fact-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-bottom: 1.25rem;
}

.fact-list__item dt {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.fact-list__item dd {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.45;
}

.fact-list__item dd a {
  text-decoration: none;
  word-break: break-all;
}

.fact-list__item dd a:hover {
  text-decoration: underline;
}

.hero-aside__links {
  display: flex;
  gap: 1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

.hero-aside__links a {
  text-decoration: none;
}

.hero-aside__links a:hover {
  text-decoration: underline;
}

/* ── Tags ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
}

[data-theme="light"] .tags li {
  background: var(--surface);
}

.tags--sm li {
  font-size: 0.6875rem;
  padding: 0.2rem 0.5rem;
}

/* ── Skills ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.skill-group__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.skill-group .tags {
  margin-bottom: 0.85rem;
}

.skill-group p {
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ── Work ── */
.job-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.job-card:last-child {
  margin-bottom: 0;
}

.job-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.85rem;
}

.job-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
}

.job-card__company {
  font-size: 0.9375rem;
  color: var(--accent);
  font-weight: 500;
}

.job-card__date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.3rem 0.65rem;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.job-card__summary {
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.85rem;
  max-width: 65ch;
}

.job-card__points {
  margin-bottom: 1rem;
  padding-left: 0;
}

.job-card__points li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.4rem;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.job-card__points li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.job-card__stack {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

/* ── Projects ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.project-card--featured {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

[data-theme="light"] .project-card--featured {
  background: linear-gradient(160deg, var(--surface) 0%, var(--accent-soft) 100%);
}

.project-card__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
}

.project-card__name {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.65rem;
}

.project-card__desc {
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
  line-height: 1.55;
}

.project-card__points {
  margin-bottom: 0.85rem;
}

.project-card__points li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.project-card__points li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.project-card .tags {
  margin-bottom: 1rem;
}

.project-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  margin-top: auto;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
}

.project-card__links a {
  text-decoration: none;
}

.project-card__links a:hover {
  text-decoration: underline;
}

.link-arrow::after {
  content: " →";
}

/* ── Education ── */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.edu-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.edu-card__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.edu-card__head h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  max-width: 16ch;
}

.edu-card__badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text-muted);
}

.edu-card__badge--active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.edu-card__school {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.65rem;
}

.edu-card p:last-child {
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ── Contact ── */
.contact-intro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 28rem;
}

.contact-intro__photo {
  flex-shrink: 0;
}

.contact-intro__name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.contact-intro__role {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 150ms ease, background 150ms ease;
}

.contact-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.contact-card--primary {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.contact-card--primary:hover {
  border-color: var(--accent-hover);
}

.contact-card__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-card__value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

.contact-card:hover .contact-card__value {
  color: var(--accent);
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .hero-main h1 {
    max-width: none;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .edu-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0.5rem 1.5rem 1rem;
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
  }

  .nav-open .site-nav {
    display: flex;
  }

  .site-nav a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
  }

  .site-nav a:last-child {
    border-bottom: none;
  }

  .site-header {
    flex-wrap: wrap;
    position: relative;
  }

  .site-header__name {
    font-size: 1rem;
  }

  .site-header__avatar {
    width: 28px;
    height: 28px;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .nav__toggle {
    display: flex;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 3.5rem 0;
  }

  .section--hero {
    padding-top: 2.5rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    text-align: center;
  }
}

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

  * {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .theme-toggle,
  .nav__toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
  }

  .project-card,
  .job-card,
  .skill-group,
  .edu-card,
  .contact-card,
  .hero-aside {
    box-shadow: none;
    break-inside: avoid;
  }
}
