:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #5f5f5f;
  --accent: #2b6cb0;
  --rule: #e2e2dc;
  --tag-bg: #ececec;
  --card-bg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
  --bg: #15171a;
  --fg: #e8e8e6;
  --muted: #9aa0a6;
  --accent: #6ea8fe;
  --rule: #2a2d31;
  --tag-bg: #25272b;
  --card-bg: #1c1e22;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a;
    --fg: #e8e8e6;
    --muted: #9aa0a6;
    --accent: #6ea8fe;
    --rule: #2a2d31;
    --tag-bg: #25272b;
    --card-bg: #1c1e22;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s, color 0.2s;
}

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 64px 32px 96px;
}

/* Hero */
.hero {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 32px;
  margin-bottom: 32px;
}
.hero h1 {
  font-size: 2.5rem;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.hero .label {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--muted);
}
.hero .meta {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}
.hero .meta a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.hero .meta a:hover { border-bottom-color: var(--muted); }

.profiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.profile {
  font-size: 0.85rem;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s, color 0.15s;
}
.profile:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.actions { margin-top: 8px; }
.pdf-link {
  display: inline-block;
  font-size: 0.9rem;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
}
.pdf-link:hover { opacity: 0.9; }

/* Sections */
.section {
  margin: 40px 0;
}
.section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 20px;
  font-weight: 600;
}
.summary {
  font-size: 1.05rem;
  margin: 0;
}

/* Entries */
.entry {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.entry-title h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  font-weight: 600;
}
.entry-org {
  color: var(--muted);
  font-size: 0.95rem;
}
.entry-org a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.entry-org a:hover { border-bottom-color: var(--muted); }
.entry-meta {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.entry-summary {
  margin: 8px 0;
}
.highlights {
  margin: 8px 0 0;
  padding-left: 20px;
}
.highlights li {
  margin-bottom: 4px;
}
.courses {
  margin: 6px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Skills */
.skill-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.skill-row:last-child { border-bottom: none; }
.skill-name {
  flex: 0 0 30%;
  font-weight: 600;
  font-size: 0.95rem;
}
.skill-tags {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 0.8rem;
  padding: 2px 8px;
  background: var(--tag-bg);
  border-radius: 3px;
  color: var(--fg);
}

/* Footer */
.foot {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
.foot code {
  background: var(--tag-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  background: var(--card-bg);
  color: var(--fg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 540px) {
  .page { padding: 32px 20px 64px; }
  .hero h1 { font-size: 2rem; }
  .entry-head { flex-direction: column; }
  .entry-meta { text-align: left; flex-direction: row; gap: 12px; }
  .skill-row { flex-direction: column; gap: 4px; }
  .skill-name { flex: none; }
}

/* Print */
@media print {
  :root {
    --bg: #fff;
    --fg: #000;
    --muted: #444;
    --accent: #000;
    --rule: #ccc;
    --tag-bg: #f0f0f0;
    --card-bg: #fff;
  }
  body { font-size: 11pt; }
  .page { max-width: 100%; padding: 0; margin: 0; }
  .theme-toggle, .actions, .foot { display: none; }
  .hero { padding-bottom: 16px; margin-bottom: 16px; }
  .hero h1 { font-size: 22pt; }
  .section { margin: 20px 0; page-break-inside: avoid; }
  .entry { page-break-inside: avoid; }
  a { color: var(--fg); }
  .profile {
    border: none;
    padding: 0;
    font-size: 9pt;
  }
  .profile::after { content: " · "; }
  .profile:last-child::after { content: ""; }
}
