*, *::before, *::after { box-sizing: border-box; }
:root {
  /* Dark is the default theme; [data-theme="light"] on <html> switches it. Same palette as the projects. */
  color-scheme: dark;
  --ink: #e5e7eb; --muted: #9ca3af; --line: #30363d; --line-hover: #6b7280;
  --bg: #0d1117; --card: #161b22; --card-hover: #1c2129; --link: #60a5fa;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --line-hover: #9ca3af;
  --bg: #fff; --card: #f3f4f6; --card-hover: #e5e7eb; --link: #2563eb;
}
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--link); }

/* ---------- top bar (inner pages) ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.topbar .mark { display: flex; }
.topbar .mark img { display: block; border-radius: 7px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 1.05rem; min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.topbar .theme-toggle { margin-left: auto; }

.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; flex: none; }
.theme-toggle:hover { border-color: var(--line-hover); }
.theme-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .sun, :root[data-theme="light"] .theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
.home > .theme-toggle { position: fixed; top: 14px; right: 14px; }

/* ---------- home ---------- */
.hero { display: flex; flex-direction: column; align-items: center; padding: 72px 16px 8px; text-align: center; }
.avatar { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 4.5rem; font-weight: 700; letter-spacing: -.03em; color: #fff; background: linear-gradient(135deg, #4f46e5, #db2777); }
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.2rem); font-weight: 800; letter-spacing: -.02em; margin: 36px 0 0; }

/* ---------- card grid (home + projects) ---------- */
.grid { width: 100%; max-width: 1100px; margin: 0 auto; padding: 48px 24px 72px; display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 50px; }
.page .grid { padding-top: 64px; }
.card { flex: 0 1 324px; display: block; padding: 18px 18px 26px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color .15s, background .15s; }
.card:hover, .card:focus-visible { border-color: var(--line-hover); background: var(--card-hover); }
.card h2 { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.card p { margin: 14px 0 0; color: var(--muted); line-height: 1.45; }

/* ---------- 404 ---------- */
.notfound { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 16px; }
.notfound h1 { font-size: 5rem; margin: 0; }
.notfound p { color: var(--muted); }

@media (max-width: 600px) {
  .hero { padding-top: 48px; }
  .avatar { width: 150px; height: 150px; font-size: 3.3rem; }
  .grid { gap: 18px; }
  .card { flex-basis: 100%; }
}
