/* Theme tokens mirror frontend/src/index.css (SPA ThemeContext). */
:root,
.light {
  color-scheme: light;
  --background: 0 0% 100%;
  --foreground: 0 0% 8%;
  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 40%;
  --border: 0 0% 90%;
  --accent: 217 91% 55%;
  --accent-hover: 217 91% 48%;
  --accent-foreground: 0 0% 100%;
  --prose: 0 0% 24%;
  --header-bg: 0 0% 100% / 0.8;
  --grid-line: 0 0% 0% / 0.06;
  --radius: 0.5rem;
}

.dark {
  color-scheme: dark;
  --background: 0 0% 4%;
  --foreground: 0 0% 100%;
  --muted: 0 0% 10%;
  --muted-foreground: 0 0% 64%;
  --border: 0 0% 18%;
  --accent: 217 91% 60%;
  --accent-hover: 217 91% 68%;
  --accent-foreground: 0 0% 100%;
  --prose: 0 0% 78%;
  --header-bg: 0 0% 4% / 0.8;
  --grid-line: 0 0% 100% / 0.04;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Satoshi", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.65;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  color: hsl(var(--accent-hover));
  text-decoration: underline;
}

code {
  font-family: "JetBrains Mono", Menlo, Monaco, monospace;
  font-size: 0.9em;
  background: hsl(var(--muted));
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
}

.site-header {
  height: 4rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--header-bg));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 640px) {
  .site-header-inner {
    padding: 0 2.5rem;
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Cabinet Grotesk", "Satoshi", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: hsl(var(--foreground));
}

.brand svg {
  display: block;
  flex-shrink: 0;
}

.site-nav {
  display: none;
  align-items: center;
  gap: 2rem;
}

@media (min-width: 768px) {
  .site-nav {
    display: flex;
  }
}

.site-nav a {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
}

.site-nav a:hover {
  color: hsl(var(--foreground));
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.5rem;
  background: transparent;
  color: hsl(var(--muted-foreground));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--muted-foreground));
}

.theme-toggle svg {
  display: block;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

.dark .theme-toggle .icon-sun {
  display: block;
}

.dark .theme-toggle .icon-moon {
  display: none;
}

.header-actions .nav-text {
  display: none;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
}

@media (min-width: 640px) {
  .header-actions .nav-text {
    display: inline;
  }
}

.header-actions .nav-text:hover {
  color: hsl(var(--foreground));
  text-decoration: none;
}

.header-actions .cta-nav {
  font-size: 0.875rem;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease;
}

.header-actions .cta-nav:hover {
  background: hsl(var(--accent-hover));
  color: hsl(var(--accent-foreground));
  text-decoration: none;
}

.page-wrap {
  position: relative;
  overflow: hidden;
}

.page-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(hsl(var(--grid-line)) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--grid-line)) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

@media (min-width: 640px) {
  .page {
    padding: 3.5rem 2.5rem 5rem;
  }
}

h1,
h2,
h3 {
  font-family: "Cabinet Grotesk", "Satoshi", sans-serif;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}

h1 {
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2.25rem 0 0.75rem;
}

p,
li {
  color: hsl(var(--prose));
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.4rem;
}

.meta {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1.75rem;
}

.meta a {
  color: hsl(var(--muted-foreground));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.meta a:hover {
  color: hsl(var(--foreground));
}

.site-footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}

.site-footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 2.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .site-footer-inner {
    padding: 2rem 2.5rem 2.75rem;
  }
}

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

.site-footer a:hover {
  color: hsl(var(--foreground));
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.cta {
  display: inline-block;
  margin-top: 0.75rem;
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.2s ease;
}

.cta:hover {
  text-decoration: none;
  background: hsl(var(--accent-hover));
  color: hsl(var(--accent-foreground));
}

.page.page-wide {
  max-width: 48rem;
}

.resource-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resource-card {
  display: block;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  background: hsl(var(--background));
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.resource-card:hover {
  border-color: hsl(var(--accent) / 0.45);
  text-decoration: none;
  transform: translateY(-1px);
}

.resource-card .tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: hsl(var(--accent));
  border: 1px solid hsl(var(--accent) / 0.4);
  border-radius: 0.25rem;
  padding: 0.15rem 0.45rem;
  margin-bottom: 0.55rem;
}

.resource-card h2 {
  font-size: 1.125rem;
  margin: 0 0 0.4rem;
}

.resource-card p {
  margin: 0;
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}

@media (min-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: hsl(var(--muted));
}

.stat .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.35rem;
}

.stat .value {
  display: block;
  font-family: "Cabinet Grotesk", "Satoshi", sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
  line-height: 1.2;
}

.stat .hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

.callout {
  border-left: 3px solid hsl(var(--accent));
  background: hsl(var(--muted));
  padding: 0.9rem 1rem;
  margin: 1.25rem 0 1.5rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.do-dont {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.25rem 0 1.5rem;
}

@media (min-width: 640px) {
  .do-dont {
    grid-template-columns: 1fr 1fr;
  }
}

.do-dont section {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: hsl(var(--muted) / 0.45);
}

.do-dont h3 {
  font-size: 1rem;
  margin: 0 0 0.65rem;
}

.do-dont ul {
  margin-bottom: 0;
}

::selection {
  background: #3b82f6;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  a,
  .cta,
  .header-actions .cta-nav,
  .theme-toggle,
  .resource-card {
    transition: none;
  }
}
