/* CV site — light/dark via prefers-color-scheme, print styles for the PDF. */
:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --border: #e3e6eb;
  --text: #16191f;
  --muted: #5b6472;
  --accent: #c2410c;          /* burnt orange, nods to the SadServers badge */
  --accent-ink: #ffffff;
  --hero-bg: #0f172a;
  --hero-text: #f1f5f9;
  --hero-muted: #a3adbd;
  --chip-bg: #eef1f5;
  --radius: 10px;
  --wrap: 920px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #121826;
    --border: #232b3b;
    --text: #e6e9ef;
    --muted: #97a1b2;
    --accent: #fb923c;
    --accent-ink: #1a0d03;
    --hero-bg: #070a11;
    --chip-bg: #1a2233;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-family: var(--mono); font-size: .9em; }
img { max-width: 100%; height: auto; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.print-only { display: none; }

/* ---------- hero ---------- */
.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 20px 0 32px;
}
.hero a { color: var(--hero-text); }
.langs { display: flex; justify-content: flex-end; gap: 12px; font-size: .875rem; }
.langs a { color: var(--hero-muted); text-decoration: none; }
.langs a:hover { color: var(--hero-text); }
.langs [aria-current] { color: var(--hero-text); font-weight: 600; }

.hero-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 12px;
}
.avatar {
  width: 140px; height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,.15);
}
.hero h1 { font-size: clamp(2rem, 5vw, 2.75rem); letter-spacing: -.02em; }
.role { margin: 4px 0 8px; font-size: 1.15rem; color: var(--accent); font-weight: 600; }
@media (prefers-color-scheme: light) { .hero .role { color: #fdba74; } }
.contact { margin: 0; color: var(--hero-muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.contact a { color: var(--hero-muted); }
.links { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.links a { font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.25); }
.links a:hover { border-color: currentColor; }

.summary { max-width: 70ch; margin: 24px 0 0; font-size: 1.05rem; color: #d5dbe5; }

.download { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.download-label { color: var(--hero-muted); font-size: .875rem; margin-right: 4px; }
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.3);
  font-weight: 600; font-size: .9rem;
  text-decoration: none;
  color: var(--hero-text);
}
.btn:hover { background: rgba(255,255,255,.08); }
.btn-primary { background: #ea580c; border-color: #ea580c; color: #fff; }
.btn-primary:hover { background: #c2410c; }

.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.badges img { display: block; }

/* ---------- sections ---------- */
main section { padding: 36px 0 8px; }
main h2 {
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
main h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }
main h3 { font-size: 1.05rem; }
.count { font-size: .75rem; background: var(--chip-bg); color: var(--muted); padding: 1px 8px; border-radius: 999px; letter-spacing: 0; }

/* experience */
.timeline { list-style: none; margin: 0; padding: 0; }
.job { position: relative; padding: 0 0 24px 22px; border-left: 2px solid var(--border); }
.job::before {
  content: ""; position: absolute; left: -7px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.job:last-child { padding-bottom: 0; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; }
.at { color: var(--muted); font-weight: 500; }
.when { margin: 0; color: var(--muted); font-size: .9rem; }
.job ul { margin: 8px 0 0; padding-left: 18px; }
.job li { margin: 3px 0; }

/* skills */
.skills { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 28px; }
.skills dt { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.skills dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block;
  background: var(--chip-bg);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: .85rem;
}

/* certifications */
.certs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.cert {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.cert-img img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.cert-body { padding: 14px 16px; }
.cert-body p { margin: 4px 0 0; }
.cert.is-expired .cert-img img { filter: grayscale(1); opacity: .7; }
.tag-expired { color: #b91c1c; font-weight: 600; }
@media (prefers-color-scheme: dark) { .tag-expired { color: #f87171; } }

/* training */
.training {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px;
}
.training li { display: flex; flex-direction: column; gap: 2px; }
.training a { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.training img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
  transition: transform .15s ease;
}
.training a:hover img { transform: translateY(-2px); }
.t-name { font-size: .9rem; font-weight: 600; line-height: 1.35; }
.t-meta { font-size: .8rem; color: var(--muted); }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 40px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin: 4px 0; }

footer { padding: 40px 16px 32px; text-align: center; }

/* lightbox */
dialog {
  border: 0; border-radius: var(--radius); padding: 12px;
  max-width: min(1000px, 94vw); max-height: 92vh;
  background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.75); }
dialog img { display: block; max-height: 78vh; width: auto; margin: 0 auto; border-radius: 6px; }
dialog .caption { margin: 8px 4px 0; font-size: .9rem; }
dialog .close {
  position: absolute; top: 6px; right: 10px;
  border: 0; background: none; color: inherit;
  font-size: 28px; line-height: 1; cursor: pointer;
}

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .hero-grid { grid-template-columns: 1fr; gap: 16px; }
  .avatar { width: 104px; height: 104px; }
  .two-col { grid-template-columns: 1fr; }
  .training { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- print / PDF ---------- */
@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  :root {
    --bg: #fff; --surface: #fff; --border: #d9dde3; --text: #111;
    --muted: #4b5563; --accent: #c2410c; --chip-bg: #f1f3f6;
    color-scheme: light;
  }
  body { font-size: 10.5pt; line-height: 1.45; }
  .no-print { display: none !important; }
  .print-only { display: inline; }
  a { color: inherit; text-decoration: none; }

  .hero { background: none; color: var(--text); padding: 0 0 6px; border-bottom: 2px solid var(--accent); }
  .hero a, .contact, .contact a { color: var(--text); }
  .hero-grid { grid-template-columns: 84px 1fr; gap: 18px; margin: 0; }
  .avatar { width: 84px; height: 84px; border: 0; }
  .hero h1 { font-size: 22pt; }
  .hero .role { color: var(--accent); margin: 2px 0 4px; }
  .links a { border: 0; font-weight: 400; }
  .links a span { color: var(--muted); }
  .summary { color: var(--text); font-size: 10.5pt; margin-top: 10px; max-width: none; }
  .wrap { max-width: none; padding: 0; }

  main section { padding: 14px 0 0; }
  main h2 { margin-bottom: 8px; color: var(--accent); }
  main h3 { font-size: 11pt; }
  .timeline { padding-left: 7px; }
  .job { padding-bottom: 10px; break-inside: avoid; }
  .job::before { background: #fff; }
  .skills { grid-template-columns: 1fr 1fr; gap: 6px 20px; }
  .skills dt { margin-bottom: 2px; }
  .skills dd { gap: 3px; }
  .chip { padding: 0 5px; font-size: 8.5pt; }

  .certs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cert { border: 0; }
  .cert-body { padding: 0; }
  .cert-body h3 { font-size: 10.5pt; }

  .training { display: block; columns: 2; column-gap: 20px; }
  .training li { display: block; break-inside: avoid; margin-bottom: 3px; font-size: 9pt; }
  .training a { display: inline; }
  .t-name { font-size: 9pt; }
  .t-name::after { content: " — "; color: var(--muted); font-weight: 400; }
  .t-meta { font-size: 9pt; }

  .two-col { grid-template-columns: 1.4fr 1fr; }
  footer { display: none; }
  h2, h3 { break-after: avoid; }
}
