/* CV site — readable, calm, print-friendly */
:root {
  --text: #141414;
  --muted: #5c5c5c;
  --border: #e2e2e2;
  --accent: #0b57d0;
  --accent-hover: #0842a0;
  --bg: #f0f1f3;
  --surface: #fff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --max: 42rem;
  --font: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Section H2 — light mode */
  --hdr-summary: #0b5394;
  --hdr-skills: #5b21b6;
  --hdr-experience: #0f766e;
  --hdr-education: #a16207;
  /* Subsection labels — job titles (h3), skill category (first strong in each skills row) */
  --subhdr-skills: #7c3aed;
  --subhdr-job: #0f5c56;
  /* Surfaces (light) */
  --header-scrim: rgba(240, 241, 243, 0.92);
  --cv-panel-surface: rgba(255, 255, 255, 0.55);
  --experience-stack-bg: rgba(11, 87, 208, 0.04);
  --footer-code-bg: #ebebed;
  --job-card-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
  --skills-p-dash: var(--border);
  --pdf-btn-fg: #fff;
  --pdf-btn-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  --pdf-btn-hover-shadow: 0 2px 8px rgba(11, 87, 208, 0.25);
  --theme-toggle-hover: rgba(0, 0, 0, 0.05);
  --theme-toggle-active: rgba(11, 87, 208, 0.12);
}

/* Dark palette — manual */
:root[data-theme="dark"] {
  --text: #ececec;
  --muted: #9a9a9a;
  --border: #2e2e32;
  --accent: #6ea8ff;
  --accent-hover: #a8c7ff;
  --bg: #0f0f10;
  --surface: #18181b;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 40px rgba(0, 0, 0, 0.45);
  --hdr-summary: #93c5fd;
  --hdr-skills: #d8b4fe;
  --hdr-experience: #5eead4;
  --hdr-education: #fcd34d;
  --subhdr-skills: #e9d5ff;
  --subhdr-job: #99f6e4;
  --header-scrim: rgba(15, 15, 16, 0.92);
  --cv-panel-surface: rgba(40, 40, 44, 0.65);
  --experience-stack-bg: rgba(110, 168, 255, 0.06);
  --footer-code-bg: #252528;
  --job-card-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  --skills-p-dash: rgba(255, 255, 255, 0.1);
  --pdf-btn-fg: #0f0f10;
  --pdf-btn-shadow: none;
  --pdf-btn-hover-shadow: none;
  --theme-toggle-hover: rgba(255, 255, 255, 0.06);
  --theme-toggle-active: rgba(110, 168, 255, 0.16);
}

/* Dark palette — system preference when user has not chosen */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --text: #ececec;
    --muted: #9a9a9a;
    --border: #2e2e32;
    --accent: #6ea8ff;
    --accent-hover: #a8c7ff;
    --bg: #0f0f10;
    --surface: #18181b;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 40px rgba(0, 0, 0, 0.45);
    --hdr-summary: #93c5fd;
    --hdr-skills: #d8b4fe;
    --hdr-experience: #5eead4;
    --hdr-education: #fcd34d;
    --subhdr-skills: #e9d5ff;
    --subhdr-job: #99f6e4;
    --header-scrim: rgba(15, 15, 16, 0.92);
    --cv-panel-surface: rgba(40, 40, 44, 0.65);
    --experience-stack-bg: rgba(110, 168, 255, 0.06);
    --footer-code-bg: #252528;
    --job-card-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
    --skills-p-dash: rgba(255, 255, 255, 0.1);
    --pdf-btn-fg: #0f0f10;
    --pdf-btn-shadow: none;
    --pdf-btn-hover-shadow: none;
    --theme-toggle-hover: rgba(255, 255, 255, 0.06);
    --theme-toggle-active: rgba(110, 168, 255, 0.16);
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.58;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  z-index: 10;
  color: var(--text);
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header-scrim);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header {
    background: var(--bg);
  }
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  flex-wrap: wrap;
}

.site-header-brand {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.site-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.site-tagline {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.theme-toggle button {
  margin: 0;
  padding: 0.38rem 0.7rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: background 0.12s ease, color 0.12s ease;
}

.theme-toggle button:last-of-type {
  border-right: none;
}

.theme-toggle button:hover {
  color: var(--text);
  background: var(--theme-toggle-hover);
}

.theme-toggle button:focus {
  outline: none;
}

.theme-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}

.theme-toggle button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--theme-toggle-active);
}

/* Main frame */
.page-frame {
  padding: 1.5rem 0 3rem;
}

main {
  margin: 0;
}

.cv-sheet {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 2rem 1.75rem 2.25rem;
}

@media (min-width: 520px) {
  .cv-sheet {
    padding: 2.25rem 2.25rem 2.5rem;
  }
}

/* Typography — content lives in cv.md; selectors target generated HTML */
.cv-sheet h1 {
  font-size: clamp(1.55rem, 4vw, 1.85rem);
  line-height: 1.2;
  margin: 0 0 0.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cv-sheet .subtitle {
  margin: 0 0 0.35rem;
  font-size: 1.06rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.cv-sheet .contact-line {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  line-height: 1.45;
}

.cv-sheet .contact-line a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  text-underline-offset: 3px;
}
.cv-sheet .contact-line a:hover {
  text-decoration: underline;
}

.cv-download {
  margin: 1rem 0 1.75rem;
}

.pdf-download {
  display: inline-block;
  padding: 0.5rem 1.15rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--pdf-btn-fg);
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: var(--pdf-btn-shadow);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pdf-download:hover {
  background: var(--accent-hover);
  text-decoration: none;
  box-shadow: var(--pdf-btn-hover-shadow);
}

.pdf-download:active {
  transform: translateY(1px);
}

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

/* --- Section panels (cv.md wrappers) --- */
.cv-panel {
  margin: 1.35rem 0;
  padding: 1.2rem 1.25rem 1.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--cv-panel-surface);
}

.experience-stack {
  margin: 1.35rem 0;
  padding: 1.25rem 1.15rem 1.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--experience-stack-bg);
}

.cv-panel:first-of-type {
  margin-top: 0.5rem;
}

.cv-panel--skills p {
  margin: 0.55rem 0;
  padding-bottom: 0.65rem;
  border-bottom: 1px dashed var(--skills-p-dash);
}

.cv-panel--skills p:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.job-card {
  margin: 0 0 1rem;
  padding: 1rem 1.1rem 1.05rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--job-card-shadow);
}

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

/* Section titles inside panels / stack */
.cv-panel > h2,
.experience-stack > h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0 0 1rem;
  padding: 0 0 0.55rem 0.6rem;
  border-left: 3px solid var(--hdr-summary);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.cv-sheet > .cv-panel:first-of-type > h2 {
  color: var(--hdr-summary);
  border-left-color: var(--hdr-summary);
}

.cv-panel.cv-panel--skills > h2 {
  color: var(--hdr-skills);
  border-left-color: var(--hdr-skills);
}

.experience-stack > h2 {
  color: var(--hdr-experience);
  border-left-color: var(--hdr-experience);
  margin-bottom: 1.1rem;
}

.cv-sheet > .cv-panel:last-of-type > h2 {
  color: var(--hdr-education);
  border-left-color: var(--hdr-education);
}

/* Job title row */
.job-card > h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
  color: var(--subhdr-job);
}

/* Skill category labels (**Languages**, **Mobile & frameworks**, …) */
.cv-panel--skills p > strong:first-child {
  color: var(--subhdr-skills);
  font-weight: 700;
}

.job-card > p {
  margin: 0.35rem 0;
  max-width: none;
  font-size: 0.96rem;
}

.job-card > ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.job-card li {
  margin: 0.32rem 0;
  padding-left: 0.2rem;
  line-height: 1.5;
}

.job-card li::marker {
  color: var(--accent);
}

.cv-panel strong,
.job-card strong {
  font-weight: 600;
}

.cv-panel > p {
  margin: 0.5rem 0 0;
  max-width: none;
}

.cv-panel > h2 + p {
  margin-top: 0.35rem;
}

/* Default h2/h3 outside panels (shouldn’t occur on CV page) */
.cv-sheet > h2 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin: 2rem 0 0.85rem;
  padding: 0 0 0.5rem 0.65rem;
  border-left: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.cv-sheet > h2:first-of-type {
  margin-top: 0.25rem;
}

.cv-sheet hr {
  border: none;
  height: 1px;
  margin: 1.75rem 0;
  background: linear-gradient(90deg, transparent, var(--border) 12%, var(--border) 88%, transparent);
}

.cv-sheet a:not(.pdf-download) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cv-sheet a:not(.pdf-download):hover {
  text-decoration-thickness: 2px;
}

.meta {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.tech-tags {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

/* Footer */
.site-footer {
  margin-top: 1.5rem;
  padding: 0 0.25rem;
  font-size: 0.82rem;
}

.muted {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  max-width: 52ch;
}

.site-footer code {
  font-size: 0.88em;
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  background: var(--footer-code-bg);
  border: 1px solid var(--border);
}

.site-footer a {
  color: var(--accent);
}

@media print {
  :root {
    --text: #111;
    --muted: #444;
    --border: #ccc;
    --bg: #fff;
    --surface: #fff;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .cv-download,
  .theme-toggle {
    display: none !important;
  }

  .page-frame {
    padding: 0;
    max-width: none;
  }

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

  .cv-sheet {
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .cv-panel,
  .experience-stack,
  .job-card {
    break-inside: avoid;
    box-shadow: none !important;
    background: #fff !important;
    border: 1px solid #ccc !important;
    border-radius: 0;
    padding: 0.75rem 0 !important;
    margin: 0.5rem 0 !important;
  }

  .experience-stack {
    border: none !important;
    padding: 0 !important;
  }

  .job-card {
    border-left: 3px solid #333 !important;
    padding-left: 0.75rem !important;
  }

  .cv-sheet a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    font-weight: 400;
  }

  .cv-sheet a[href$=".pdf"]::after {
    content: "";
  }
}
