/* Base tokens (light mode defaults) */
:root {
  --bg: #ffffff;        /* page background */
  --panel: #f5f5f5;     /* sidebar/background panel */
  --text: #0a0a0a;      /* primary text */
  --muted: #5f5f5f;     /* secondary text */
  --accent: #000000;    /* headings and borders */
  --link: #111111;
  --link-hover: #000000;
  --shadow: 0 10px 30px rgba(0,0,0,0.06);
  --maxw: 800px;
  --border: rgba(0,0,0,0.10);
}

/* Dark theme tokens */
html[data-theme="dark"] {
  --bg: #000000;
  --panel: #111111;
  --text: #f5f5f5;
  --muted: #b3b3b3;
  --accent: #ffffff;
  --link: #eaeaea;
  --link-hover: #ffffff;
  --shadow: 0 10px 30px rgba(0,0,0,0.6);
  --border: rgba(255,255,255,0.12);
}

/* Respect system preference when data-theme=auto */
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { 
    --bg:#000; 
    --panel:#111; 
    --text:#f5f5f5; 
    --muted:#b3b3b3; 
    --accent:#fff; 
    --link:#eaeaea; 
    --link-hover:#fff; 
    --shadow:0 10px 30px rgba(0,0,0,0.6); 
    --border: rgba(255,255,255,0.12); 
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'PT Serif', serif;
  background: var(--bg);
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}

a { color: var(--link); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--link-hover); }

.wrap {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 48px 28px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 32px;
  transition: background-color .25s ease, border-color .25s ease;
}

.brand h1 { font-size: 24px; margin: 0; color: var(--accent); letter-spacing: 0.02em; }
.brand .role { color: var(--muted); font-size: 14px; margin-top: 8px; }

nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
nav a { opacity: 0.9; }
nav a:hover { opacity: 1; }

.controls { display: flex; gap: 10px; align-items: center; }

.toggle {
  display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted);
}
.switch {
  position: relative; width: 48px; height: 26px; border-radius: 999px; background: var(--border); cursor: pointer; border: 1px solid var(--border);
  transition: background-color .25s ease, border-color .25s ease;
}
.switch::after {
  content: ""; position: absolute; top: 50%; left: 2px; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent);
  transition: left .25s ease, background-color .25s ease;
}
.switch[aria-checked="true"]::after { left: 24px; }

main { padding: 56px min(6vw, 64px); display: grid; place-items: start; }
.content { max-width: var(--maxw); width: 100%; }

h2 { font-size: 20px; color: var(--accent); margin: 0 0 16px; }
p { line-height: 1.75; font-size: 18px; color: var(--text); }
.muted { color: var(--muted); }

.card {
  background: rgba(127,127,127,0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.social { display: flex; flex-direction: column; gap: 12px; }
.social a { 
  display: flex; align-items: center; gap: 8px; 
  font-size: 14px; opacity: 0.8; transition: opacity 0.2s ease;
}
.social a:hover { opacity: 1; }
.social-icon { font-size: 16px; }

.thoughts-grid, .projects-grid { 
  display: grid; gap: 24px; margin-top: 24px;
}

.thought-card, .project-card {
  background: rgba(127,127,127,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: background-color .25s ease, border-color .25s ease;
}

.thought-card:hover, .project-card:hover {
  background: rgba(127,127,127,0.06);
}

.thought-card h3, .project-card h3 { 
  font-size: 18px; margin: 0 0 12px; color: var(--accent);
}

.thought-date, .project-status {
  display: inline-block;
  font-size: 12px; color: var(--muted);
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 6px;
  margin-top: 12px;
}

.project-tags {
  display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap;
}

.tag {
  font-size: 12px; color: var(--muted);
  background: var(--panel);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; }
  aside {
    height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border);
    padding: 24px 20px; gap: 18px;
  }
  .brand h1 { font-size: 20px; }
  main { padding: 28px 20px 56px; }
}
