:root {
  --ink: #0f172a;
  --muted: #4b5563;
  --line: #e5e7eb;
  --accent: #2563eb;
  --bg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e5e7eb;
    --muted: #9ca3af;
    --line: #1f2937;
    --accent: #60a5fa;
    --bg: #0b0f1a;
  }
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.6;
}

.wrap {
  max-width: 980px;
  margin: 28px auto;
  padding: 0 16px;
}

.top {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 28px;
  align-items: start;
}

h1 {
  font-size: 36px;
  line-height: 1.15;
  margin: 0 0 6px;
}

.sub {
  color: var(--muted);
  margin: 0 0 12px;
}

.side .block {
  border-top: 2px solid var(--line);
  padding-top: 12px;
  margin-top: 14px;
}

.block h2 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--ink);
}

.pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  margin: 2px 6px 2px 0;
  font-size: 12px;
  color: var(--muted);
}

.contact {
  list-style: none;
  padding: 0;
  margin: 0 0 4px;
}

.contact li {
  margin: 4px 0;
  color: var(--muted);
}

.section h2 {
  font-size: 18px;
  margin: 0 0 8px;
  color: var(--ink);
}

.rule {
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin-bottom: 14px;
}

.job {
  margin-bottom: 18px;
}

.job h3 {
  font-size: 16px;
  margin: 0 0 2px;
}

.meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 6px 0 10px;
  margin-bottom: 8px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.portfolio .card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.portfolio .title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-block;
  background: rgba(37, 99, 235, .08);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, .2);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
}

.langswitch {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0 18px;
  justify-content: flex-end;
}

.langswitch button {
  border: 1px solid var(--line);
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.langswitch button.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Mobile: đổi layout sidebar sang flex và đặt thứ tự
   Kết quả: Liên hệ xuống cuối, Kỹ năng đầu, Học vấn giữa */
@media (max-width:900px) {
  .top {
    grid-template-columns: 1fr;
  }

  .side {
    display: flex;
    flex-direction: column;
  }

  #block-skills { order: 1; }
  #block-edu    { order: 2; }
  #block-contact{ order: 3; }
}

@media print {
  .wrap {
    margin: 0;
  }

  .portfolio .card {
    break-inside: avoid;
  }

  .langswitch,
  .hint {
    display: none;
  }
}

.not_found {
  width: 100%;
  height: 100vh;
  align-items: center;
  display: flex;
  justify-content: center;
  align-items: center;
}
