/* Thulani Hlongwane: personal site. Plain CSS, no build step. */

:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f3f1ed;
  --text: #1b1c1f;
  --muted: #5d6068;
  --border: #e4e1db;
  --accent: #b2502c;
  --accent-strong: #933f20;
  --accent-soft: #f7e7df;
  --on-accent: #ffffff;
  --ok: #1f8a4c;
  --shadow: 0 1px 2px rgb(20 20 20 / 0.04), 0 8px 24px rgb(20 20 20 / 0.06);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --wrap: 68rem;
  --header-h: 4rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --surface: #18191c;
    --surface-2: #202125;
    --text: #ececec;
    --muted: #a3a6ad;
    --border: #2c2e33;
    --accent: #f0936b;
    --accent-strong: #f6ae8e;
    --accent-soft: #3a2219;
    --on-accent: #1a0d07;
    --ok: #4ccf86;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111214;
  --surface: #18191c;
  --surface-2: #202125;
  --text: #ececec;
  --muted: #a3a6ad;
  --border: #2c2e33;
  --accent: #f0936b;
  --accent-strong: #f6ae8e;
  --accent-soft: #3a2219;
  --on-accent: #1a0d07;
  --ok: #4ccf86;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-strong); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

@media (max-width: 40rem) {
  .wrap { padding-inline: 1rem; }
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.filled { fill: currentColor; stroke: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}

.brand {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--on-accent); background: var(--accent-strong); }

.site-nav {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }

.site-nav ul {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="true"] { color: var(--text); background: var(--surface-2); }

@media (max-width: 40rem) {
  .site-nav ul { justify-content: flex-start; }
  .site-nav a { padding: 0.4rem 0.6rem; font-size: 0.875rem; }
}

.theme-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[aria-pressed="true"] .icon-sun { display: block; }
.theme-toggle[aria-pressed="true"] .icon-moon { display: none; }

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.btn:hover { color: var(--text); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }

.btn-icon { padding-inline: 0.75rem; }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-button:hover { color: var(--text); }

/* ---------- Hero ---------- */

.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 6vw, 4rem); }

.hero-inner {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
}

.portrait {
  flex: none;
  width: clamp(8rem, 22vw, 13rem);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent);
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.role {
  margin: 0.35rem 0 0.25rem;
  color: var(--accent);
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  font-weight: 600;
}

.stack { margin-bottom: 0.75rem; color: var(--text); font-weight: 500; }

.location {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

@media (max-width: 40rem) {
  .hero-inner { flex-direction: column; align-items: flex-start; }
  .portrait { width: 7rem; }
  .hero .actions { gap: 0.5rem; }
  .hide-sm { display: none; }
}

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--border);
}

.section h2 {
  margin-bottom: 2rem;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 700;
}

.subhead {
  margin: 2.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.two-col .subhead { margin-top: 0; }

.when {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* About */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 3rem;
  align-items: start;
}

.prose { max-width: 40rem; }
.lead { font-size: 1.2rem; line-height: 1.55; font-weight: 500; }
.aside { color: var(--muted); margin-bottom: 0; }

.facts {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}
.facts div {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.facts dt { font-size: 1.5rem; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
.facts dd { margin: 0; color: var(--muted); font-size: 0.9375rem; }

@media (max-width: 52rem) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .facts { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
}

/* Experience */

.timeline {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 1.75rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 0.4rem;
  top: 0.75rem;
  bottom: 0.75rem;
  width: 2px;
  background: var(--border);
}

.job {
  position: relative;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.job::before {
  content: "";
  position: absolute;
  left: calc(-1.75rem + 0.4rem - 5px);
  top: 1.6rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.job:first-child::before { background: var(--accent); }

.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
}
.job h3 { font-size: 1.15rem; font-weight: 600; }
.job .when { margin: 0; }

.org {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 0.2rem 0 0.6rem;
  font-weight: 500;
}
.via { color: var(--muted); font-weight: 400; font-size: 0.9375rem; }

.tag {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 600;
}

.projects { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.projects strong { color: var(--text); font-weight: 600; }

.job ul { margin-top: 0.75rem; padding-left: 1.1rem; list-style: disc; }
.job li + li { margin-top: 0.3rem; }

.earlier {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.earlier li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
}
.earlier li + li { border-top: 1px solid var(--border); }
.earlier strong { font-weight: 600; }

@media (max-width: 40rem) {
  .timeline { padding-left: 1.25rem; }
  .timeline::before { left: 0.2rem; }
  .job { padding: 1rem 1.1rem; }
  .job::before { left: calc(-1.25rem + 0.2rem - 5px); }
  .earlier li { flex-direction: column; padding-inline: 1rem; }
}

/* Skills */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}

.skill-group {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.skill-group-wide { grid-column: 1 / -1; }
.skill-group h3 { margin-bottom: 0.85rem; font-size: 1rem; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.875rem;
  font-weight: 500;
}
.chips li.core {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
  font-weight: 600;
}
.chips-quiet li { background: transparent; color: var(--muted); }

@media (max-width: 40rem) {
  .skills-grid { grid-template-columns: 1fr; }
  .skill-group { padding: 1rem 1.1rem; }
}

/* Education */

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
}

.entries { display: grid; gap: 1.1rem; }
.entries li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
}
.entries strong { font-weight: 600; }
.entries span:not(.when) { grid-column: 1; color: var(--muted); font-size: 0.9375rem; }
.entries .when { grid-column: 2; grid-row: 1; }

@media (max-width: 52rem) {
  .two-col { grid-template-columns: 1fr; gap: 2rem; }
}

/* Contact */

.contact-card {
  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.contact-card h2 { margin-bottom: 0.75rem; }
.contact-card > p { max-width: 38rem; margin-bottom: 1.75rem; color: var(--muted); font-size: 1.0625rem; }
.small { margin: 1rem 0 0; font-size: 0.875rem; color: var(--muted); }

/* Footer */

.site-footer {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}
.footer-inner p { margin: 0; }

/* ---------- Print: the page doubles as a one-click PDF CV ---------- */

@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #444;
    --border: #ccc; --accent: #933f20; --accent-strong: #933f20; --accent-soft: #fff;
    --shadow: none;
    color-scheme: light;
  }
  @page { margin: 14mm 14mm; }
  body { font-size: 10.5pt; line-height: 1.45; }
  .site-header, .skip-link, .status, .actions, .site-footer, .facts, noscript { display: none !important; }
  .hero { padding: 0 0 6mm; }
  .portrait { width: 26mm; border: 0; box-shadow: none; }
  .hero h1 { font-size: 24pt; }
  .location { display: block; margin-bottom: 0; }
  .location svg { display: none; }
  .lead { font-size: 11.5pt; }
  .location::after { content: " · thulanih@gmail.com · +27 72 332 2415 · linkedin.com/in/thulani-hlongwane-67056a1a"; }
  .section { padding: 5mm 0; }
  .section h2 { margin-bottom: 3mm; font-size: 14pt; }
  .about-grid { display: block; }
  .aside { display: none; }
  .timeline { padding-left: 0; gap: 2mm; }
  .timeline::before, .job::before { display: none; }
  .job, .skill-group, .earlier { padding: 0; border: 0; }
  .job { break-inside: avoid; }
  .earlier li { padding: 1mm 0; border: 0 !important; }
  .skills-grid { grid-template-columns: 1fr 1fr; gap: 2mm 6mm; }
  .skill-group h3 { margin-bottom: 1mm; font-size: 10.5pt; }
  .chips { display: block; }
  .chips li { display: inline; padding: 0; border: 0; background: none; color: #000; font-weight: 400; }
  .chips li:not(:last-child)::after { content: ", "; }
  .tag { padding: 0; background: none; font-weight: 400; }
  .tag::before { content: "· "; }
  .two-col { grid-template-columns: 1fr 1fr; gap: 6mm; }
  .entries { gap: 2mm; }
  #contact { display: none; }
  a { color: inherit; text-decoration: none; }
}
