/* LaTeX-adjacent CV: serif body, monospace metadata, minimal chrome */

:root {
  /* Default: dark */
  --ink: #e6e4df;
  --ink-muted: #9a958c;
  --rule: #3a3835;
  --paper: #121110;
  --accent: #7eb3ff;
  --switch-track-off: #2a2826;
  --switch-track-on: #4a6fa5;
  --switch-thumb: #f0ebe3;
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: "IBM Plex Mono", "SF Mono", "Consolas", "Liberation Mono", monospace;
  --measure: 42rem;
  --leading: 1.55;
}

html:not(:has(#theme-dark:checked)) {
  color-scheme: light;
  --ink: #1a1a1a;
  --ink-muted: #4a4a4a;
  --rule: #c8c4bc;
  --paper: #faf8f5;
  --accent: #2563eb;
  --switch-track-off: #d4d0c8;
  --switch-track-on: #3d4a5c;
  --switch-thumb: #fff;
}

html:has(#theme-dark:checked) {
  color-scheme: dark;
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  padding: 0 0 3rem;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  line-height: var(--leading);
  color: var(--ink);
  background: var(--paper);
  font-optical-sizing: auto;
}

/* Landing-only: no bottom padding (avoids 100vh + extra space scrollbar) */
body.is-landing {
  padding-bottom: 0;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.75rem 1.25rem 0;
}

/* --- Landing --- */

.landing {
  box-sizing: border-box;
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Tight vertical padding: clear theme toggle, no oversized top/bottom gaps */
  padding: max(3.25rem, env(safe-area-inset-top, 0px) + 2.5rem) 1.25rem max(1rem, env(safe-area-inset-bottom, 0px) + 1rem);
  text-align: center;
}

.landing-inner {
  max-width: 26rem;
  margin: 0 auto;
}

.landing-name {
  margin: 0 0 0.4rem;
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: lining-nums;
}

.landing-role {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.landing-lead {
  margin: 0 0 1.5rem;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--ink);
}

.landing-contact {
  justify-content: center;
}

.landing-contact--icons {
  gap: 1.25rem;
}

.landing-contact--icons .sep {
  display: none;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  line-height: 0;
  color: var(--ink);
  border-radius: 6px;
  border: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.icon-link:hover,
.icon-link:focus-visible {
  color: var(--accent);
  border-color: var(--rule);
  outline: none;
}

.icon {
  width: 1.5rem;
  height: 1.5rem;
}

.landing-cta-wrap {
  margin: 1.35rem 0 0;
}

.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.2rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.landing-cta:hover,
.landing-cta:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.landing-cta-arrow {
  font-size: 0.95em;
  opacity: 0.9;
}

.site-nav {
  margin: 0 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink-muted);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--rule);
}

.landing-subnav {
  margin: 1.1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.landing-subnav-link {
  text-decoration: none;
  color: var(--ink-muted);
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.landing-subnav-link:hover,
.landing-subnav-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.landing-subnav-sep {
  color: var(--rule);
  user-select: none;
}

.cv-document-title {
  margin: 0 0 2rem;
  padding-bottom: 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--rule);
}

.print-only-banner {
  display: none;
}

/* --- Theme switch (checkbox + :has, no JS) --- */

.theme-control {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.theme-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.theme-track {
  position: relative;
  width: 2.5rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--switch-track-off);
  border: 1px solid var(--rule);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-thumb {
  position: absolute;
  top: 50%;
  left: 0.15rem;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  border-radius: 50%;
  background: var(--switch-thumb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#theme-dark:checked + .theme-label .theme-track {
  background: var(--switch-track-on);
}

#theme-dark:checked + .theme-label .theme-thumb {
  transform: translateX(1.15rem);
}

.theme-input:focus-visible + .theme-label .theme-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-caption {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  min-width: 2.75rem;
}

.theme-caption::before {
  content: "Light";
}

html:has(#theme-dark:checked) .theme-caption::before {
  content: "Dark";
}

/* --- Masthead --- */

.masthead {
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
  text-align: center;
}

.name {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: lining-nums;
}

.tagline {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--ink-muted);
  font-style: italic;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.contact a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.contact a:hover,
.contact a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

.sep {
  color: var(--rule);
  user-select: none;
}

/* --- Sections --- */

.block {
  margin-bottom: 1.65rem;
}

.cv-section-heading {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
}

.exp-roles {
  margin-bottom: 0.85rem;
}

.exp-role {
  margin-bottom: 0.65rem;
}

.exp-role:last-child {
  margin-bottom: 0;
}

.exp-role-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.exp-role .entry-meta {
  margin: 0.2rem 0 0;
  white-space: normal;
}

.edu-block {
  margin-bottom: 1.15rem;
}

.edu-block:last-child {
  margin-bottom: 0;
}

.edu-inst {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.edu-inst + .entry-meta {
  margin: 0.2rem 0 0.4rem;
}

.edu-qual {
  margin: 0;
}

.edu-inst + .edu-qual {
  margin-top: 0.35rem;
}

.edu-note {
  margin: 0.35rem 0 0;
  color: var(--ink-muted);
}

.skill-lines {
  margin: 0;
  font-size: 0.9rem;
}

.skill-lines dt {
  margin: 0.55rem 0 0;
  font-weight: 600;
  font-size: 0.88rem;
}

.skill-lines dt:first-child {
  margin-top: 0;
}

.skill-lines dd {
  margin: 0.2rem 0 0;
  padding: 0;
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
}

.sec-num {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-muted);
  margin-right: 0.5rem;
}

.body-text {
  margin: 0;
  text-align: justify;
  hyphens: auto;
}

.body-text--flush {
  text-align: start;
  hyphens: manual;
}

.muted-note {
  margin: 0;
  color: var(--ink-muted);
  font-style: italic;
}

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

.entry {
  margin-bottom: 1.35rem;
}

.entry:last-child {
  margin-bottom: 0;
}

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

.entry-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.entry-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.entry-org {
  margin: 0.2rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: italic;
}

.entry-list {
  margin: 0;
  padding-left: 1.15rem;
}

.entry-list li {
  margin-bottom: 0.35rem;
}

.entry-list li:last-child {
  margin-bottom: 0;
}

.entry--compact .entry-org {
  margin-bottom: 0;
}

/* --- Skills definition list --- */

.skill-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}

.skill-grid dt {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  padding-top: 0.15rem;
}

.skill-grid dd {
  margin: 0;
}

/* --- Plain lists & mono tags --- */

.plain-list {
  margin: 0;
  padding-left: 1.15rem;
}

.plain-list li {
  margin-bottom: 0.35rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
}

/* --- Footer --- */

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-style: italic;
  text-align: center;
}

.footer p {
  margin: 0;
}

/* --- Print --- */

@media print {
  .theme-control {
    display: none;
  }

  .landing,
  .site-nav,
  .landing-subnav {
    display: none !important;
  }

  .print-only-banner {
    display: block;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--rule);
  }

  html:not(:has(#theme-dark:checked)),
  html:has(#theme-dark:checked) {
    color-scheme: light;
    --ink: #1a1a1a;
    --ink-muted: #4a4a4a;
    --rule: #c8c4bc;
    --paper: #fff;
    --accent: #2563eb;
    --switch-track-off: #d4d0c8;
    --switch-track-on: #3d4a5c;
    --switch-thumb: #fff;
  }

  body {
    padding: 0;
    background: #fff;
    font-size: 10pt;
  }

  .block {
    break-inside: avoid;
  }

  .entry {
    break-inside: avoid;
  }
}

@media (max-width: 32rem) {
  .skill-grid {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .skill-grid dt {
    padding-top: 0.5rem;
  }

  .skill-grid dt:first-child {
    padding-top: 0;
  }

  .skill-grid dd + dt {
    margin-top: 0.35rem;
  }
}
