/* Ed Broadbent: Living CV
   Shared stylesheet for /cv/* pages
   Extends edbroadbent.info design system (Highland palette)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syncopate:wght@700&family=Rajdhani:wght@300;400;500;600;700&family=DM+Mono:ital,wght@0,300;0,400;1,300&display=swap');

/* ── Tokens ── */
:root {
  --bg-0:      #FAFBFD;
  --bg-1:      #F0F2F7;
  --bg-2:      #FFFFFF;
  --bg-card:   rgba(255,255,255,0.85);
  --text-0:    #1A1D2E;
  --text-1:    #4A5068;
  --text-2:    #8B92A8;
  --monera:    #FFB03F;
  --protista:  #D82253;
  --fungi:     #472675;
  --plantae:   #3CB3A5;
  --animalia:  #0081BA;
  --border:    #E2E6EF;
  --shadow-sm: 0 1px 3px rgba(26,29,46,0.06);
  --shadow-md: 0 4px 12px rgba(26,29,46,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --max-w:     860px;
  --accent:    var(--animalia);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 400;
  color: var(--text-1);
  background: var(--bg-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--plantae); }
img { max-width: 100%; display: block; }

/* ── Typography ── */
h1, h2, h3, h4 { font-family: 'Rajdhani', sans-serif; font-weight: 700; color: var(--text-0); line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 0.5rem; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); margin-bottom: 0.75rem; margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
h2:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
h3 { font-size: clamp(1rem, 1.8vw, 1.2rem); margin-bottom: 0.5rem; margin-top: 1.5rem; color: var(--text-0); }
h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-1); margin-bottom: 0.25rem; margin-top: 1rem; }

p { margin-bottom: 1rem; font-size: 1.05rem; }
p:last-child { margin-bottom: 0; }

.display {
  font-family: 'Syncopate', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mono {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 0.85em;
}

.label {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-2);
}

/* ── Nav ── */
.cv-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,251,253,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
}

.cv-nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 52px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cv-nav-inner::-webkit-scrollbar { display: none; }

.cv-nav-brand {
  font-family: 'Syncopate', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-0);
  white-space: nowrap;
  text-decoration: none;
}
.cv-nav-brand:hover { color: var(--accent); }

.cv-nav-sep {
  color: var(--border);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.cv-nav-links {
  display: flex;
  gap: 0;
  list-style: none;
  flex-shrink: 0;
}
.cv-nav-links a {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--text-2);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.cv-nav-links a:hover, .cv-nav-links a.active {
  color: var(--text-0);
  background: var(--bg-1);
}
.cv-nav-links a.active { color: var(--accent); }

/* ── Page container ── */
.cv-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

/* ── Page header ── */
.cv-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--accent);
}

.cv-header .label { margin-bottom: 0.5rem; display: block; }
.cv-header h1 { margin-bottom: 0.75rem; }
.cv-header .subtitle {
  font-size: 1.1rem;
  color: var(--text-2);
  font-weight: 400;
  margin-bottom: 0;
}
.cv-meta {
  margin-top: 1.25rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.cv-meta-item {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-2);
  letter-spacing: 0.08em;
}
.cv-meta-item strong {
  color: var(--text-1);
  font-weight: 400;
}

/* ── Accent colors per section ── */
.accent-animalia { --accent: var(--animalia); }
.accent-fungi    { --accent: var(--fungi); }
.accent-plantae  { --accent: var(--plantae); }
.accent-monera   { --accent: var(--monera); }
.accent-protista { --accent: var(--protista); }

/* ── Tables ── */
.cv-table-wrap { overflow-x: auto; margin: 1.25rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead th {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--bg-1);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-1); }

td strong { color: var(--text-0); font-weight: 600; }

/* ── Stat grid ── */
.cv-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 1.5rem 0;
}

.cv-stat {
  background: var(--bg-2);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cv-stat-value {
  font-family: 'DM Mono', monospace;
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--accent);
  line-height: 1;
}

.cv-stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-2);
}

/* ── Cards ── */
.cv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.cv-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-top: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.cv-card:hover { box-shadow: var(--shadow-md); }

.cv-card .label { display: block; margin-bottom: 0.5rem; }
.cv-card h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.cv-card p { font-size: 0.9rem; color: var(--text-1); margin: 0; }

.cv-card-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.cv-card-link:hover { color: var(--plantae); }

/* ── Callout ── */
.cv-callout {
  background: var(--bg-1);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 1rem;
  color: var(--text-0);
  font-style: italic;
}

.cv-callout strong { font-style: normal; }

/* ── Badge row ── */
.cv-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.cv-badge {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.65rem;
  border-radius: 100px;
  background: var(--bg-1);
  color: var(--text-1);
  border: 1px solid var(--border);
}

.cv-badge.accent {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
}

/* ── Timeline ── */
.cv-timeline {
  position: relative;
  padding-left: 1.5rem;
  margin: 1.5rem 0;
}

.cv-timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.cv-timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}

.cv-timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.45rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-0);
  box-shadow: 0 0 0 1px var(--accent);
}

.cv-timeline-year {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}

.cv-timeline-title {
  font-weight: 700;
  color: var(--text-0);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.cv-timeline-body {
  font-size: 0.95rem;
  color: var(--text-1);
}

/* ── Section divider ── */
.cv-divider {
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

/* ── Footer nav ── */
.cv-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.cv-footer-link {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cv-footer-link:hover { color: var(--accent); }
.cv-footer-back { justify-self: flex-start; }

/* ── Pill tag ── */
.tag {
  display: inline-block;
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-1);
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* ── Gaps / placeholders ── */
.cv-gap {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--monera);
  background: color-mix(in srgb, var(--monera) 8%, transparent);
  border: 1px dashed color-mix(in srgb, var(--monera) 35%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0;
}

/* ── Publication entries ── */
.pub-entry {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}

.pub-meta {
  margin-bottom: 0.75rem;
}

.pub-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-0);
  margin-bottom: 0.3rem;
  line-height: 1.4;
  margin-top: 0;
}

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 0.2rem;
}

.pub-journal {
  font-size: 0.85rem;
  color: var(--text-1);
  margin-bottom: 0.75rem;
}

.pub-summary {
  font-size: 0.95rem;
  color: var(--text-1);
  margin-bottom: 0;
}

/* ── Connect entries ── */
.connect-entry {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow-sm);
}

.connect-entry h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  margin-top: 0;
}

.connect-draft {
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-1);
  white-space: pre-wrap;
  font-family: 'Rajdhani', sans-serif;
  line-height: 1.6;
  border-left: 2px solid var(--border);
}

/* ── Testimonial ticker ── */
.cv-testimonial-ticker {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.cv-testimonial-track {
  position: relative;
  overflow: hidden;
}

.cv-testimonial {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
  animation: cvFadeIn 0.6s ease;
}

.cv-testimonial.active {
  display: block;
}

@keyframes cvFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cv-testimonial p {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text-0);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.cv-testimonial cite {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--text-2);
  display: block;
}

.cv-testimonial cite a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent);
  text-underline-offset: 2px;
}

.cv-testimonial cite a:hover {
  text-decoration-color: var(--accent);
}

.cv-testimonial-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.cv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-1);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, border-color 0.3s;
}

.cv-dot.active {
  background: var(--accent);
  border-color: var(--accent);
}

.cv-dot:hover {
  border-color: var(--accent);
}

/* ══════════════════════════════════════════════
   PRINT — Optimized for exactly 2 A4 pages
   Shared across all CV files. Individual CVs
   should NOT override these rules.
   ══════════════════════════════════════════════ */
@media print {
  /* ── Hide non-print elements ── */
  .cv-nav, .cv-footer, .download-bar { display: none !important; }

  /* ── Page setup ── */
  @page { size: A4; margin: 1cm 1.3cm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  /* ── Base typography — sized to fill 2 pages ── */
  body { font-size: 9.5pt; line-height: 1.4; margin: 0; padding: 0; color: var(--text-1); }
  .cv-page { max-width: 100%; padding: 0; margin: 0; }

  /* ── Header ── */
  .cv-header { padding: 0 0 0.3cm; margin-bottom: 0.3cm; border-bottom: 2px solid var(--accent, var(--animalia)); }
  .cv-header .label { font-size: 6.5pt; margin-bottom: 0.1rem; display: block; }
  h1 { font-size: 18pt; margin-bottom: 0.1rem; }
  .cv-header .subtitle { font-size: 9.5pt !important; margin-bottom: 0 !important; }
  .app-contact-bar { gap: 0.8rem; margin-top: 0.25rem; }
  .app-contact-bar a { font-size: 7pt; }

  /* ── Content container ── */
  .cv-content { padding: 0; }
  .cv-content > .label { font-size: 6.5pt; margin-bottom: 0.1rem; display: block; }

  /* ── Typography ── */
  p { margin-bottom: 0.3rem; font-size: 9pt; line-height: 1.45; }
  h2 { font-size: 12pt; margin-top: 0.4cm; padding-top: 0.2cm; margin-bottom: 0.2cm; border-top: none; page-break-before: auto; }
  h2:first-of-type { margin-top: 0; border-top: none; padding-top: 0; }
  h3 { font-size: 10pt; margin-top: 0.35cm; margin-bottom: 0.15cm; }

  /* ── Stats grid ── */
  .cv-stats { gap: 1px; margin: 0.3cm 0; }
  .cv-stat { padding: 0.35rem 0.5rem; }
  .cv-stat-value { font-size: 13pt; }
  .cv-stat-label { font-size: 5.5pt; }

  /* ── Pull quote ── */
  .pull-quote { padding: 0.3rem 0.8rem; font-size: 8.5pt; margin: 0.25cm 0; line-height: 1.4; }

  /* ── Badges ── */
  .cv-badges { gap: 0.3rem; margin: 0.2cm 0; }
  .cv-badge { font-size: 6pt; padding: 0.15rem 0.5rem; }

  /* ── Competency grid (3-column) ── */
  .comp-grid { gap: 1rem; margin: 0.2cm 0; }
  .comp-col h4 { font-size: 6.5pt; margin-bottom: 0.15rem; }
  .comp-col li { font-size: 8pt; padding: 0.12rem 0; line-height: 1.35; }

  /* ── Side-by-side (education + publications) ── */
  .side-by-side { gap: 1.5rem; margin: 0.2cm 0; }
  .side-by-side h3 { font-size: 9.5pt; margin-bottom: 0.15cm; margin-top: 0; }

  /* ── Two-column layout ── */
  .two-col { gap: 1.5rem; margin: 0.2cm 0; }
  .two-col h3 { margin-top: 0; }

  /* ── Timeline ── */
  .cv-timeline { display: flex; gap: 1.5rem; padding-left: 0; margin: 0.15cm 0; }
  .cv-timeline::before { display: none; }
  .cv-timeline-item { margin-bottom: 0; padding-left: 0; }
  .cv-timeline-item::before { display: none; }
  .cv-timeline-year { font-size: 6.5pt; }
  .cv-timeline-title { font-size: 9pt; }
  .cv-timeline-body { font-size: 8pt; }

  /* ── Lists ── */
  .ed-list { margin: 0.15cm 0; padding-left: 1rem; }
  .ed-list li { font-size: 8pt; margin-bottom: 0.1rem; line-height: 1.4; }

  /* ── Tech pills ── */
  .tech-row { gap: 0.3rem; margin: 0.2cm 0; }
  .tech-item { font-size: 7.5pt; padding: 0.15rem 0.5rem; }
  .tech-item strong { font-size: 7pt; }

  /* ── Section rule ── */
  .section-rule { margin: 0.25cm 0; }

  /* ── Experience blocks ── */
  .experience-section { padding-top: 0; }
  .experience-section h2 { margin-top: 0.3cm; padding-top: 0.15cm; }
  .exp-block {
    box-shadow: none; border-radius: 4px;
    padding: 0.5rem 0.75rem; margin: 0.25cm 0;
    break-inside: avoid; page-break-inside: avoid;
  }
  .exp-block h3 { font-size: 10pt; margin-bottom: 0.06rem; }
  .exp-block .exp-org { font-size: 8pt; margin-bottom: 0.06rem; }
  .exp-block .exp-dates { font-size: 6.5pt; margin-bottom: 0.2rem; }
  .exp-block .exp-summary, .exp-block p { font-size: 8pt; margin-bottom: 0.15rem; line-height: 1.4; }
  .exp-block ul { margin: 0.1rem 0 0; padding-left: 1rem; }
  .exp-block li { font-size: 8pt; margin-bottom: 0.08rem; line-height: 1.35; }

  /* ── Cards ── */
  .cv-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }

  /* ── Publication entries ── */
  .pub-entry { box-shadow: none; padding: 0.5rem 0.75rem; margin: 0.2cm 0; break-inside: avoid; }
  .pub-title { font-size: 9pt; }
  .pub-authors, .pub-journal { font-size: 7.5pt; }
  .pub-summary { font-size: 8pt; }

  /* ── Additional info ── */
  .additional-row { font-size: 8pt; margin: 0.2cm 0; line-height: 1.4; }

  /* ── Flow control — no forced breaks, keep sections together ── */
  h2, h3 { page-break-after: avoid; break-after: avoid; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .cv-page { padding: 1.5rem 1rem 4rem; }
  .cv-stats { grid-template-columns: repeat(2, 1fr); }
  .cv-cards { grid-template-columns: 1fr; }
  .cv-footer { flex-direction: column; align-items: flex-start; }
}
