:root {
  --bg: #ffffff;
  --surface: #f5f5f7;
  --text: #1d1d1f;
  --muted: #86868b;
  --border: rgba(0, 0, 0, 0.06);
  --fill: rgba(0, 0, 0, 0.05);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --seg-active: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius-lg: 18px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* Dark: follows the system unless the user picked Light, or forced via the switch */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --border: rgba(255, 255, 255, 0.08);
    --fill: rgba(255, 255, 255, 0.08);
    --accent: #2997ff;
    --accent-soft: rgba(41, 151, 255, 0.16);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --seg-active: #636366;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --border: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.08);
  --accent: #2997ff;
  --accent-soft: rgba(41, 151, 255, 0.16);
  --nav-bg: rgba(22, 22, 23, 0.72);
  --seg-active: #636366;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease), color 0.3s var(--ease);
}
main { flex: 1; }

button { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* Top bar: frosted, sticky */
.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 32px;
  max-width: 1080px;
  margin: 0 auto;
}
.wordmark { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }

/* Segmented Auto / Light / Dark switch */
.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--fill);
  border-radius: 980px;
}
.segmented button {
  border: none;
  border-radius: 980px;
  background: transparent;
  padding: 5px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] {
  background: var(--seg-active);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Intro */
.intro {
  max-width: 1080px;
  margin: 0 auto;
  padding: 120px 32px 64px;
}
.intro h1 {
  font-size: clamp(3rem, 9vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
}

/* Site cards */
.sites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px 120px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.site {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 28px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
              background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.site:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.site:active { transform: translateY(-1px) scale(0.99); }

.site-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--tile);
}
.site-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.site-title { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.site-desc { font-size: 0.95rem; color: var(--muted); line-height: 1.45; }

.site-arrow {
  flex: none;
  align-self: center;
  font-size: 1.2rem;
  color: var(--muted);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}
.site:hover .site-arrow { transform: translateX(4px); color: var(--accent); }

.footer {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 40px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .topbar { padding: 8px 16px; }
  .intro { padding: 72px 16px 40px; }
  .sites { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 72px; }
  .site { padding: 20px; gap: 16px; }
  .footer { padding: 20px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
