:root {
  --paper: #f4efe6;
  --paper-2: #ece5d9;
  --ink: #17130f;
  --muted: #5f574d;
  --faint: #8a8174;
  --accent: #a8401f;
  --line: rgba(23, 19, 15, 0.16);
  --font-sans: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

.cv-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  background: rgba(244, 239, 230, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cv-back {
  color: var(--muted);
}

.cv-back:hover {
  color: var(--accent);
}

.cv-bar-title {
  color: var(--faint);
}

.cv-download {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  letter-spacing: 0.04em;
}

.cv-download:hover {
  background: var(--accent);
}

.cv {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(2.25rem, 6vw, 4.5rem) clamp(1.15rem, 5vw, 2.5rem) 4rem;
}

.cv-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
}

.cv-kicker {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.cv-head h1 {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  font-weight: 500;
}

.cv-role {
  margin-top: 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 34ch;
}

.cv-contact {
  list-style: none;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  padding-top: 0.4rem;
}

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

.cv-section {
  padding: 1.65rem 0;
  border-bottom: 1px solid var(--line);
}

.cv-section:last-of-type {
  border-bottom: 0;
}

.cv-section h2 {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.cv-lead {
  font-size: 1rem;
  line-height: 1.7;
  max-width: 68ch;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
}

.cv-entry {
  padding: 0.15rem 0 1.35rem;
}

.cv-entry:last-child {
  padding-bottom: 0;
}

.cv-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.cv-entry-head h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.cv-entry-head span {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.cv-org {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--accent);
}

.cv-entry p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
  max-width: 72ch;
}

.cv-entry ul {
  margin-top: 0.55rem;
  padding-left: 1.05rem;
}

.cv-entry li {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.cv-entry li::marker {
  color: var(--accent);
}

.cv-skills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 2rem;
}

.cv-skills div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.cv-skills dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.cv-skills dd {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
}

.cv-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1.5rem;
}

.cv-details div {
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.cv-details dt {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.cv-details dd {
  margin-top: 0.2rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.cv-certs {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 2rem;
}

.cv-certs li {
  display: flex;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}

.cv-certs span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  min-width: 96px;
  padding-top: 0.12rem;
}

.cv-foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint);
}

.cv-foot a {
  color: var(--accent);
}

/* Scroll CTA dialog */
.cv-modal {
  width: min(460px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: auto;
  padding: 0;
  border: 1px solid rgba(23, 19, 15, 0.12);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 40px 90px -24px rgba(23, 19, 15, 0.5);
}

.cv-modal[open] {
  animation: modal-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cv-modal::backdrop {
  background: rgba(23, 19, 15, 0.58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.cv-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem 0 1.35rem;
}

.cv-modal-kicker {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.cv-modal-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.cv-modal-close:hover {
  background: var(--ink);
  color: var(--paper);
}

.cv-modal h2 {
  padding: 0.4rem 1.35rem 0;
  font-size: 1.85rem;
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 500;
}

.cv-modal > p {
  padding: 0.65rem 1.35rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.cv-modal-actions {
  display: grid;
  gap: 0.5rem;
  padding: 1.2rem 1.35rem 0.6rem;
}

.cv-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 54px;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: transform 0.25s ease, background 0.25s ease;
}

.cv-action:hover {
  transform: translateY(-2px);
}

.cv-action span {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.cv-action b {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: right;
}

.cv-action-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.cv-action-dark span {
  color: rgba(244, 239, 230, 0.55);
}

.cv-action-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f0;
}

.cv-action-accent span {
  color: rgba(255, 248, 240, 0.7);
}

.cv-modal form[method="dialog"]:last-child {
  padding: 0 1.35rem 1.35rem;
}

.cv-modal-dismiss {
  width: 100%;
  padding: 0.6rem 0 0.2rem;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.cv-modal-dismiss:hover {
  color: var(--accent);
}

@media (max-width: 700px) {
  .cv-head {
    flex-direction: column;
    gap: 1.25rem;
  }

  .cv-contact {
    text-align: left;
    gap: 0.35rem;
  }

  .cv-skills,
  .cv-certs,
  .cv-details {
    grid-template-columns: 1fr;
  }

  .cv-skills div {
    grid-template-columns: 84px 1fr;
  }

  .cv-entry-head {
    flex-direction: column;
    gap: 0.15rem;
  }

  .cv-entry-head span {
    order: -1;
  }

  .cv-foot {
    flex-direction: column;
    gap: 0.35rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 11mm 13mm;
  }

  body {
    background: #fff;
    font-size: 8.8pt;
    line-height: 1.36;
  }

  .cv-bar,
  .cv-modal {
    display: none;
  }

  .cv {
    max-width: none;
    padding: 0;
  }

  .cv-lead {
    padding-left: 7pt;
  }

  .cv-head {
    padding-bottom: 7pt;
  }

  .cv-head h1 {
    font-size: 26pt;
  }

  .cv-kicker {
    margin-bottom: 0.45rem;
  }

  .cv-role {
    margin-top: 0.5rem;
    font-size: 8.4pt;
  }

  .cv-contact {
    gap: 0.1rem;
    font-size: 6.8pt;
  }

  .cv-section {
    padding: 6pt 0;
  }

  .cv-section h2 {
    margin-bottom: 6pt;
  }

  .cv-entry {
    padding-bottom: 0.55rem;
    page-break-inside: avoid;
  }

  .cv-entry-head h3 {
    font-size: 9.8pt;
  }

  .cv-entry p,
  .cv-entry li,
  .cv-lead {
    font-size: 8.2pt;
    line-height: 1.38;
  }

  .cv-entry ul {
    margin-top: 0.25rem;
  }

  .cv-entry li {
    margin-bottom: 0.1rem;
  }

  .cv-skills {
    gap: 0.25rem 1.4rem;
  }

  .cv-skills div {
    padding-bottom: 0.25rem;
    grid-template-columns: 72px 1fr;
    gap: 0.5rem;
  }

  .cv-skills dd {
    font-size: 7.8pt;
    line-height: 1.35;
  }

  .cv-details {
    grid-template-columns: repeat(3, 1fr);
    gap: 4pt 12pt;
  }

  .cv-details dd {
    font-size: 7.8pt;
  }

  .cv-certs {
    grid-template-columns: repeat(3, 1fr);
    gap: 1pt 10pt;
  }

  .cv-certs li {
    gap: 0.35rem;
    font-size: 7.3pt;
    padding: 1.2pt 0;
    line-height: 1.3;
  }

  .cv-certs span {
    min-width: 0;
    font-size: 5.9pt;
    padding-top: 0.06rem;
  }

  .cv-foot {
    margin-top: 6pt;
    padding-top: 5pt;
  }

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