/* MKth.me — tokens, then layout.
   Theme comes from <html data-theme="auto|light|dark">. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --measure: 62ch;
  --radius: 14px;
  --dur: 220ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Light (default) */
:root,
:root[data-theme="light"] {
  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --fg: #14141a;
  --fg-muted: #5d5d6b;
  --line: rgba(20, 20, 26, 0.1);
  --accent: #2b5cff;
  --accent-fg: #ffffff;
  --glow-rgb: 43, 92, 255;
  --glow-strength: 0.16;
  --shadow: 0 1px 2px rgba(20, 20, 26, 0.06), 0 12px 32px rgba(20, 20, 26, 0.06);
}

/* Dark — explicit switch or system preference */
:root[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-elevated: #141419;
  --fg: #f4f4f7;
  --fg-muted: #9a9aa8;
  --line: rgba(244, 244, 247, 0.12);
  --accent: #7d9bff;
  --accent-fg: #0a0a0c;
  --glow-rgb: 125, 155, 255;
  --glow-strength: 0.2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #0a0a0c;
    --bg-elevated: #141419;
    --fg: #f4f4f7;
    --fg-muted: #9a9aa8;
    --line: rgba(244, 244, 247, 0.12);
    --accent: #7d9bff;
    --accent-fg: #0a0a0c;
    --glow-rgb: 125, 155, 255;
    --glow-strength: 0.2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 0 0 var(--radius) 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(1.1rem, 4vw, 2.6rem);
}

.wordmark {
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
  color: var(--fg);
}
.wordmark-dot { color: var(--accent); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle:active { transform: translateY(0); }

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Show moon when light (click → dark); sun when dark. */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .icon-sun { display: block; }
  :root[data-theme="auto"] .icon-moon { display: none; }
}

/* ---------- hero ---------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  padding: clamp(2rem, 7vh, 5rem) clamp(1.1rem, 5vw, 3rem);
  overflow: hidden;
}

.stage-inner {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  text-align: center;
  animation: rise 620ms var(--ease) both;
}

.overline {
  margin: 0 0 1.1rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.display {
  margin: 0;
  font-size: clamp(2.7rem, 11vw, 6.2rem);
  font-weight: 680;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.lede {
  max-width: 34ch;
  margin: 1.4rem auto 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--fg-muted);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 2.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 0.94rem;
  font-weight: 550;
  text-decoration: none;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-fg);
}
.btn-primary:hover { border-color: transparent; }

.glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(900px, 128vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  /* Fade to the same colour at zero alpha — fading to `transparent`
     would interpolate through black and grey out the halo. */
  background: radial-gradient(
    circle closest-side,
    rgba(var(--glow-rgb), var(--glow-strength)),
    rgba(var(--glow-rgb), 0) 72%
  );
  pointer-events: none;
}

/* ---------- section ---------- */

.more {
  padding: clamp(2.5rem, 7vw, 5rem) clamp(1.1rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
}

.more-title {
  max-width: 1080px;
  margin: 0 auto 1.5rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
}

.card {
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--fg-muted);
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  padding: 1.5rem clamp(1.1rem, 4vw, 2.6rem);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.site-footer p { margin: 0; }

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

.site-footer a {
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
.site-footer a:hover { color: var(--fg); text-decoration: underline; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- legal page ---------- */

.legal {
  max-width: 68ch;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.1rem, 5vw, 3rem) 4rem;
}
.legal h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); letter-spacing: -0.03em; margin: 0 0 1.6rem; }
.legal h2 { font-size: 1.15rem; margin: 2.4rem 0 0.6rem; letter-spacing: -0.01em; }
.legal p, .legal li { color: var(--fg-muted); }
.legal .todo {
  border-left: 3px solid var(--accent);
  padding: 0.3rem 0 0.3rem 0.9rem;
  color: var(--fg-muted);
  font-style: italic;
}
.legal a { color: var(--accent); }
