:root {
  --bg: 250 250 249;
  --surface: 255 255 255;
  --ink: 24 24 27;
  --muted: 113 113 122;
  --border: 228 228 231;
  --accent: 249 115 22;

  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

html.dark {
  --bg: 9 9 11;
  --surface: 24 24 27;
  --ink: 244 244 245;
  --muted: 161 161 170;
  --border: 39 39 42;
  --accent: 251 146 60;
}

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

body {
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  font-family: 'Sora', system-ui, sans-serif;
  min-height: 100vh;
  transition:
    background-color 250ms ease,
    color 250ms ease;
}

code {
  font-family: ui-monospace, monospace;
  background: rgb(var(--border) / 0.6);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3.5rem;
}

.logo {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

/* ---------- Theme switch ---------- */
.theme-switch {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.theme-switch__track {
  display: flex;
  align-items: center;
  width: 56px;
  height: 30px;
  border-radius: 999px;
  background: rgb(var(--border));
  padding: 3px;
  transition: background-color 250ms ease;
}

html.dark .theme-switch__track {
  background: rgb(var(--accent) / 0.35);
}

.theme-switch__thumb {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgb(var(--surface));
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.25);
  transition: transform 320ms var(--ease-out-expo);
}

html.dark .theme-switch__thumb {
  transform: translateX(26px);
}

.icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: rgb(var(--accent));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity 200ms ease,
    transform 320ms var(--ease-out-expo);
}

.icon-moon {
  fill: rgb(var(--accent));
  stroke: none;
  opacity: 0;
  transform: rotate(-40deg) scale(0.6);
}

html.dark .icon-sun {
  opacity: 0;
  transform: rotate(40deg) scale(0.6);
}

html.dark .icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .theme-switch__thumb,
  .icon {
    transition-duration: 1ms;
  }
}

/* ---------- Content ---------- */
.hero {
  margin-bottom: 3rem;
}

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgb(var(--accent));
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.9rem;
  max-width: 18ch;
}

.lede {
  color: rgb(var(--muted));
  font-size: 1.05rem;
  max-width: 48ch;
  line-height: 1.65;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}

.card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 16px;
  padding: 1.5rem;
  transition:
    background-color 250ms ease,
    border-color 250ms ease,
    transform 200ms var(--ease-out-quad);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-3px);
  }
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card p {
  color: rgb(var(--muted));
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ---------- View Transitions: barrido circular ---------- */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

/* La vista NUEVA siempre queda encima: el círculo que crece en su clip-path
   revela el tema entrante sobre el saliente, sin importar la dirección. */
::view-transition-new(root) {
  z-index: 9999;
}
