:root {
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #1c1c1c;
  --muted: #6b6b6b;
  --line: #e4e2dc;
  --accent: #1c1c1c;
  --accent-text: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --card: #1b1b1b;
  --text: #f0efea;
  --muted: #9a9a9a;
  --line: #2c2c2c;
  --accent: #f0efea;
  --accent-text: #121212;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --card: #1b1b1b;
    --text: #f0efea;
    --muted: #9a9a9a;
    --line: #2c2c2c;
    --accent: #f0efea;
    --accent-text: #121212;
  }
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  z-index: 10;
}
.theme-toggle:hover { border-color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media print { .theme-toggle { display: none; } }

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

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.card {
  width: 100%;
  max-width: 420px;
  padding: 40px 0;
  text-align: center;
}

.photo {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
  background: var(--line);
}

h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
.role { font-weight: 500; margin-top: 4px; }
.location { color: var(--muted); font-size: 0.9rem; }
.bio { color: var(--muted); margin: 16px 0 24px; font-size: 0.95rem; }

.links {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-bottom: 28px;
}

.links a {
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  text-decoration: none;
  transition: color .15s, transform .15s;
}
.links a:hover { color: var(--text); transform: translateY(-2px); }
.links svg { width: 24px; height: 24px; display: block; }

.cv {
  display: block;
  padding: 12px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 600;
}
.cv:hover { opacity: .9; }

/* ---- Página /cv/ ---- */
.cv-page {
  width: 100%;
  max-width: 760px;
  align-self: start;
  padding: 32px 0;
}

.cv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.cv-top .cv { display: inline-block; padding: 10px 18px; }
.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back:hover { color: var(--text); }

.cv-header { margin-bottom: 8px; }
.cv-header .role { color: var(--muted); font-weight: 400; }
.contacts { font-size: 0.9rem; margin-top: 6px; color: var(--muted); }
.contacts a { color: var(--text); }

.cv-page section { margin-top: 28px; }
.cv-page h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.cv-page h3 { font-size: 1rem; }
.cv-page h3 span { font-weight: 400; color: var(--muted); }
.item { margin-bottom: 16px; }
.item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.period { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.cv-page ul { padding-left: 20px; }
.cv-page li { margin: 2px 0; }
.skill { margin: 2px 0; }

@media print {
  body { background: #fff; padding: 0; }
  .cv-page { border: 0; max-width: none; padding: 0; color: #000; }
  .cv-top { display: none; }
}

.cv-page h4 { font-size: 0.92rem; margin: 10px 0 4px; }
.cv-page h4 span { font-weight: 400; color: var(--muted); }
.cv-page section > p, .cv-page li { font-size: 0.93rem; }
.skills { display: grid; grid-template-columns: 130px 1fr; gap: 6px 16px; font-size: 0.93rem; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; }
@media (max-width: 560px) {
  .cv-page { padding: 20px 0; }
  .skills { grid-template-columns: 1fr; gap: 0; }
  .skills dd { margin-bottom: 8px; }
}
