/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --primary:    #3b82f6;
  --primary-dk: #2563eb;
  --text:       #0f172a;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --radius:     0.75rem;
  --shadow:     0 1px 3px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  color-scheme: light;
}

/* Auto dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #0f172a;
    --surface:    #1e293b;
    --primary:    #60a5fa;
    --primary-dk: #3b82f6;
    --text:       #f1f5f9;
    --muted:      #94a3b8;
    --border:     #334155;
    --shadow:     0 1px 3px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.2);
    color-scheme: dark;
  }
}

/* Manual dark override */
:root[data-theme="dark"] {
  --bg:         #0f172a;
  --surface:    #1e293b;
  --primary:    #60a5fa;
  --primary-dk: #3b82f6;
  --text:       #f1f5f9;
  --muted:      #94a3b8;
  --border:     #334155;
  --shadow:     0 1px 3px rgba(0,0,0,.3), 0 4px 12px rgba(0,0,0,.2);
  color-scheme: dark;
}

/* Manual light override */
:root[data-theme="light"] {
  color-scheme: light;
}

html { font-size: 16px; }

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

.page { display: flex; flex-direction: column; min-height: 100dvh; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--primary);
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  transition: background 0.15s;
}
.theme-toggle:hover { background: var(--border); color: var(--text); }

/* ── Main ────────────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Section label ───────────────────────────────────────────────────────── */
.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ── About card ──────────────────────────────────────────────────────────── */
.about-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.about-card .tagline {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.about-card p {
  font-size: 0.95rem;
  line-height: 1.75;
}

/* ── Project grid (index.html featured section) ──────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .project-grid { grid-template-columns: 1fr; }
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:not(.disabled):hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

.project-card .icon {
  font-size: 1.4rem;
  margin-bottom: 0.15rem;
}

.project-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.project-card .desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.project-card.disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.tag {
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

/* ── Project list rows (projects.html) ───────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.project-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color 0.15s;
}

.project-row:hover {
  border-color: var(--primary);
}

.project-row .row-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.project-row .row-body { flex: 1; }

.project-row h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.project-row .desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; }
