/*
 * CV page — the exact two-column A4 structure of the original cv.html, with the
 * navy palette remapped to Peak Warden Color Standard tokens. Theme-aware (bands
 * use the constant --accent; text/surfaces use semantic tokens) and print-ready.
 * All rules are scoped under .cv-sheet so they never touch the rest of the site.
 */

.cv-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 52rem;
}
.cv-toolbar h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--content);
}
.cv-toolbar .page-lede { margin: 0.2rem 0 0; }

/* The A4 "sheet" — a centered card. Fixed A4 proportions on print; fluid on web. */
.cv-sheet {
  position: relative;
  width: 100%;
  max-width: 52rem;               /* ~ A4 width on screen */
  background-color: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow: hidden;
  color: var(--content-secondary);
}

/* Faint semiconductor watermark, exactly as the original. */
.cv-sheet__bg {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  height: 70%;
  z-index: 0;
  opacity: 0.04;
  background-image: url(/images/semiconductor.svg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  pointer-events: none;
}
html.dark .cv-sheet__bg { opacity: 0.06; filter: invert(1); }

.cv-sheet > * { position: relative; z-index: 1; }

/* ------------------------------------------------------------- header */
.cv-header {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.cv-intro {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
}

.cv-intro__avatar {
  flex-basis: 30%;
  flex-shrink: 0;
  min-height: 13rem;
  background-color: var(--surface-inset);
}
.cv-intro__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cv-intro__desc {
  flex-basis: 70%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.3rem;
  background-color: var(--accent);
  color: var(--on-accent);
}
.cv-intro__desc h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.1;
  color: var(--on-accent);
}
.cv-intro__desc .cv-role {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--on-accent) 62%, transparent);
}
.cv-intro__desc p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--on-accent) 92%, transparent);
}
.cv-intro__desc b { font-weight: 700; }

/* Contact links row */
.cv-contact {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}
.cv-contact__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 0;
  min-width: 5.5rem;
  color: var(--content-muted);
  text-align: center;
  transition: color 0.15s ease;
}
.cv-contact__link:hover { color: var(--accent); }
.cv-contact__link svg { width: 1.6rem; height: 1.6rem; stroke: currentColor; }
.cv-contact__link .cv-contact__globe { fill: currentColor; stroke: none; }
.cv-contact__link p {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.2;
  word-break: break-word;
  color: var(--content-muted);
}

/* --------------------------------------------------------------- main grid */
.cv-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: max-content;
  row-gap: 1.25rem;
  column-gap: 1.5rem;
}

.cv-block { display: flex; flex-direction: column; gap: 0.75rem; }

/* Banded section header */
.cv-block > h2 {
  margin: 0;
  background-color: var(--accent);
  color: var(--on-accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-radius: 0.3rem;
}

.cv-list { display: flex; flex-direction: column; gap: 0.85rem; list-style: none; margin: 0; padding: 0; }

/* First-level items — square accent bullet, hanging indent */
.cv-item {
  position: relative;
  margin-left: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.cv-item::before {
  content: "";
  position: absolute;
  top: 0.24rem;
  left: -0.95rem;
  width: 0.55rem;
  height: 0.55rem;
  background-color: var(--accent);
  border-radius: 2px;
}
.cv-item > h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--accent);
}
.cv-item p { margin: 0; font-size: 0.78rem; line-height: 1.35; color: var(--content-secondary); }
.cv-item .cv-meta { color: var(--content-muted); }
.cv-item a { color: var(--content-secondary); }
.cv-item a:hover { color: var(--accent); text-decoration: underline; }

/* Nested groups (Projects / Events under a job) */
.cv-sub { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.5rem; }
.cv-sub > h4 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--content);
}
.cv-sublist { display: flex; flex-direction: column; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.cv-subitem {
  position: relative;
  margin-left: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.cv-subitem::before {
  content: "";
  position: absolute;
  top: 0.28rem;
  left: -0.7rem;
  width: 0.36rem;
  height: 0.36rem;
  background-color: var(--accent);
  border-radius: 2px;
}
.cv-subitem > h5 {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent);
}
.cv-subitem p { margin: 0; font-size: 0.74rem; line-height: 1.35; color: var(--content-secondary); }
.cv-subitem .cv-meta { color: var(--content-muted); }

/* Two events side by side */
.cv-sub-row {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: space-between;
}
.cv-sub-row > .cv-subitem { flex: 1 1 0; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .cv-sheet { padding: 1.25rem; }
  .cv-intro { flex-direction: column; }
  .cv-intro__avatar { flex-basis: auto; min-height: 12rem; }
  .cv-intro__desc { flex-basis: auto; }
  .cv-main { grid-template-columns: 1fr; }
  .cv-contact { justify-content: center; }
}

/* --------------------------------------------------------------- print
 * Goal: one perfect A4 page — the two-column layout preserved and scaled to
 * fit, centered on the sheet by symmetric page margins, always on white
 * (light palette forced even if the site is in dark mode). */
@media print {
  @page { size: A4 portrait; margin: 9mm 11mm; }

  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Force the light palette so the CV always prints on white with teal bands. */
  :root, html.dark {
    --surface: #FEFEFE; --surface-subtle: #FCFCFE; --surface-raised: #FFFFFF;
    --surface-inset: #FDFDFE; --content: #111827; --content-secondary: #1f2937;
    --content-muted: #475569; --line: #E7E8F4; --line-strong: #E0E1F1;
    --accent: #147187; --on-accent: #FFFFFF;
  }

  html, body { background: #fff !important; }
  .site-header, .site-footer, .cv-toolbar, .squares, .cv-sheet__bg { display: none !important; }
  main.container { padding: 0 !important; max-width: none !important; }
  .cv-wrap { display: block; gap: 0; }

  .cv-sheet {
    max-width: none; width: 100%;
    border: none; border-radius: 0; box-shadow: none;
    padding: 0; gap: 9px; overflow: visible;
  }

  /* Header band */
  .cv-intro { min-height: 0 !important; flex-direction: row !important; }
  .cv-intro__avatar { flex-basis: 27% !important; min-height: 0 !important; }
  .cv-intro__desc { flex-basis: 73% !important; padding: 10px 14px; gap: 4px; }
  .cv-intro__desc h1 { font-size: 20px; }
  .cv-intro__desc .cv-role { font-size: 8.5px; }
  .cv-intro__desc p { font-size: 9.2px; line-height: 1.38; }

  .cv-contact { margin: 10px 0; gap: 6px; }
  .cv-contact__link svg { width: 1.2rem; height: 1.2rem; }
  .cv-contact__link p { font-size: 6.8px; }

  /* Two columns, always — override any narrow-width collapse. A moderate row-gap
     spreads the sections down the sheet while keeping everything on one page. */
  .cv-main { grid-template-columns: 1fr 1fr !important; column-gap: 10mm; row-gap: 15px; }
  .cv-block { gap: 7px; }
  .cv-block > h2 { font-size: 10px; padding: 4px 6px 4px 9px; }

  .cv-list { gap: 8px; }
  .cv-item { margin-left: 0.9rem; break-inside: avoid; }
  .cv-item::before { top: 0.18rem; width: 0.44rem; height: 0.44rem; }
  .cv-item > h3 { font-size: 9.4px; }
  .cv-item p { font-size: 9px; line-height: 1.38; }

  .cv-sub { margin-top: 4px; gap: 5px; }
  .cv-sub > h4 { font-size: 9px; }
  .cv-subitem { margin-left: 0.7rem; break-inside: avoid; }
  .cv-subitem::before { top: 0.2rem; width: 0.34rem; height: 0.34rem; }
  .cv-subitem > h5 { font-size: 8.6px; }
  .cv-subitem p { font-size: 8.6px; line-height: 1.34; }
  .cv-sub-row { gap: 7mm; }
}
