:root {
  --fg: #e6edf3;
  --muted: #9198a1;
  --bg: #0d1117;
  --accent: #58a6ff;
  --border: #30363d;
  --maxw: 64rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --fg: #1f2328;
    --muted: #57606a;
    --bg: #ffffff;
    --accent: #0969da;
    --border: #d0d7de;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.site-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 48rem;
}

/* Sections */
.section {
  padding: 2.75rem 0 1rem;
  scroll-margin-top: 1rem;
}
.section-head { margin-bottom: 1.75rem; }
.section-title {
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.section-lede {
  display: block;
  max-width: 60ch;
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.65;
}
.section-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.section-link:hover { text-decoration: underline; }

/* Projects — simple single-column list */
.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 42rem;
}
.project {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.project:last-child { border-bottom: none; }
.project-name {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.project-name a {
  color: var(--accent);
  text-decoration: none;
}
.project-name a:hover { text-decoration: underline; }
.project-story {
  margin: 0 0 0.6rem;
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* Tags — small, muted detail (kept for any legacy use) */
.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tags li {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
}
.tags li:not(:last-child)::after {
  content: "·";
  margin-left: 0.35rem;
  color: var(--border);
}

/* Services — grouped grid of homelab services */
.services-root { margin-top: 0.5rem; }
.services-loading, .services-error {
  color: var(--muted);
  font-style: italic;
}
.service-group { margin: 0 0 2rem; }
.group-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
.group-icon { margin-right: 0.4rem; }
.service-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
}
.service {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.service:hover { border-color: var(--accent); }
.service-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  text-decoration: none;
  color: var(--fg);
  height: 100%;
}
.service-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  width: 1.6rem;
  text-align: center;
}
.service-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.service-name {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 0.1rem;
}

/* Status dot — green up, grey down/pending */
.status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--muted);
  opacity: 0.5;
  transition: background 0.3s ease, opacity 0.3s ease, border-color 0.3s ease;
}
.status-pending { background: var(--muted); opacity: 0.4; }
.status-up {
  background: #2ea043;
  border-color: #2ea043;
  opacity: 1;
}
.status-down { background: #d73a49; border-color: #d73a49; opacity: 0.85; }

/* Orgs list (Projects section) */
.orgs {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 42rem;
}
.orgs li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.98rem;
}
.orgs li:last-child { border-bottom: none; }
.orgs a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}
.orgs a:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 1.75rem 0 2.25rem;
  border-top: 1px solid var(--border);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.footer-links a:hover { text-decoration: underline; }
.footer-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.footer-meta a { color: var(--muted); text-decoration: underline; }

/* Focus visibility */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Responsive tightening on small screens */
@media (max-width: 30rem) {
  .site-header { padding: 2rem 0 1.25rem; }
  .section { padding: 2rem 0 0.5rem; }
}