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

:root {
  --bg:          #0d0d0f;
  --surface:     #141416;
  --border:      #242428;
  --text:        #e8e8ed;
  --muted:       #6b6b7a;
  --accent:      #3dd6c8;
  --accent-glow: rgba(61, 214, 200, 0.15);
  --tag-bg:      rgba(61, 214, 200, 0.08);
  --tag-border:  rgba(61, 214, 200, 0.2);
  --tag-text:    #6ee8df;
  --sidebar-w:   280px;
}

html { font-size: 16px; }

html.light {
  --bg:          #f9f9fb;
  --surface:     #ffffff;
  --border:      #e2e2e8;
  --text:        #111114;
  --muted:       #7a7a8a;
  --accent:      #0fa89a;
  --accent-glow: rgba(15, 168, 154, 0.12);
  --tag-bg:      rgba(15, 168, 154, 0.08);
  --tag-border:  rgba(15, 168, 154, 0.2);
  --tag-text:    #0fa89a;
}

html.light .sidebar h1 {
  background: linear-gradient(135deg, #111114 30%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
}

html.light .about p { color: #3a3a4a; }

html.light .sidebar .location { color: #b0b0be; }

html.light footer { color: #c0c0cc; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* ── Layout ──────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 3rem 2rem;
  height: 100%;
}

.sidebar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
}

.sidebar .tagline {
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.sidebar .location {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: #3a3a4a;
}

/* ── Sidebar nav ─────────────────────────────────────── */
nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}

nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

/* ── Sidebar contact ─────────────────────────────────── */
.sidebar-contact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

.sidebar-contact a {
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-contact a:hover { color: var(--accent); }

/* ── Main content ────────────────────────────────────── */
main {
  flex: 1;
  padding: 4rem 3.5rem;
}

/* ── Sections ────────────────────────────────────────── */
section { margin-bottom: 4.5rem; }

section h2 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* ── About ───────────────────────────────────────────── */
.about p {
  font-size: 0.9375rem;
  color: #b0b0be;
  max-width: 62ch;
}

.about p + p { margin-top: 0.75rem; }

/* ── Projects ────────────────────────────────────────── */
.projects { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.card.full { grid-column: 1 / -1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.375rem 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 24px var(--accent-glow);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.card a.repo-link {
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.card a.repo-link:hover { opacity: 1; }

.card p {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.875rem;
}

.tag {
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* ── Contact ─────────────────────────────────────────── */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact-links a {
  font-size: 0.9375rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.contact-links a:hover { color: var(--text); }

/* ── Footer ──────────────────────────────────────────── */
footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: #3a3a48;
}

/* ── Theme toggle ────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  width: fit-content;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

.theme-toggle-icon::before { content: "☀️"; font-size: 0.875rem; }
html.light .theme-toggle-icon::before { content: "🌙"; }

/* ── Tablet ───────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 220px; }

  .sidebar-inner { padding: 2.5rem 1.5rem; gap: 2rem; }

  main { padding: 3rem 2rem; }

  .projects { grid-template-columns: 1fr; }
  .card.full { grid-column: 1; }
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-inner {
    gap: 1.25rem;
    padding: 1.75rem 1.25rem;
  }

  nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  nav a {
    padding: 0.5rem 0.875rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .sidebar-contact {
    margin-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
  }

  .sidebar-contact a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  main { padding: 2rem 1.25rem; }

  section { margin-bottom: 3rem; }

  .contact-links a {
    word-break: break-all;
  }
}