/* ─────────────────────────────────────────────
   Corvus — Nothing Design System for Starlight
   Flat surfaces, border separation, typography hierarchy.
   No shadows, no gradients, no blur, no glow.
   ───────────────────────────────────────────── */

/* ── Font Loading — self-hosted via @fontsource ── */
@import url("@fontsource-variable/space-grotesk");
@import url("@fontsource/space-mono/400.css");
@import url("@fontsource/space-mono/700.css");
@import url("@fontsource/doto/400.css");
@import url("@fontsource/doto/700.css");

/* ── Shared Brand Tokens ── */
@import url("@corvus/shared/base.css");
@import url("@corvus/shared/nothing-theme.css");

/* ─────────────────────────────────────────────
   Starlight Token Mapping
   Maps --corvus-* tokens to --sl-* tokens.
   ───────────────────────────────────────────── */

/* ── Shared (theme-independent) ── */
:root {
  --sl-font: var(--corvus-typography-font-body);
  --sl-font-mono: var(--corvus-typography-font-mono);
  --sl-content-width: 75rem;
  --sl-text-h1: clamp(2rem, 4vw, 3rem);
  --sl-text-h2: clamp(1.5rem, 3vw, 2rem);
  --sl-text-h3: clamp(1.15rem, 2vw, 1.5rem);
}

/* ── Dark Theme (Starlight default) ── */
:root[data-theme="dark"] {
  --sl-color-bg: var(--corvus-color-bg-base);
  --sl-color-bg-nav: rgb(0 0 0 / 85%);
  --sl-color-bg-sidebar: rgb(0 0 0 / 95%);
  --sl-color-bg-inline-code: var(--corvus-color-bg-raised);
  --sl-color-hairline-shade: var(--corvus-color-border-default);
  --sl-color-hairline-light: rgb(34 34 34 / 50%);
  --sl-color-white: var(--corvus-color-text-display);
  --sl-color-gray-1: var(--corvus-color-text-primary);
  --sl-color-gray-2: var(--corvus-color-text-secondary);
  --sl-color-gray-3: var(--corvus-color-text-disabled);
  --sl-color-gray-4: var(--corvus-color-border-visible);
  --sl-color-gray-5: var(--corvus-color-bg-raised);
  --sl-color-gray-6: var(--corvus-color-bg-surface);
  --sl-color-black: var(--corvus-color-bg-base);
  --sl-color-accent-low: rgb(215 25 33 / 15%);
  --sl-color-accent: var(--corvus-color-text-primary);
  --sl-color-accent-high: var(--corvus-color-text-display);
  --sl-color-text: var(--corvus-color-text-primary);
  --sl-color-text-accent: var(--corvus-color-text-display);
}

/* ── Light Theme ── */
:root[data-theme="light"] {
  --sl-color-bg: var(--corvus-color-bg-base);
  --sl-color-bg-nav: rgb(245 245 245 / 90%);
  --sl-color-bg-sidebar: rgb(245 245 245 / 95%);
  --sl-color-bg-inline-code: var(--corvus-color-bg-raised);
  --sl-color-hairline-shade: var(--corvus-color-border-default);
  --sl-color-hairline-light: rgb(232 232 232 / 50%);
  --sl-color-white: var(--corvus-color-text-display);
  --sl-color-gray-1: var(--corvus-color-text-primary);
  --sl-color-gray-2: var(--corvus-color-text-secondary);
  --sl-color-gray-3: var(--corvus-color-text-disabled);
  --sl-color-gray-4: var(--corvus-color-border-visible);
  --sl-color-gray-5: var(--corvus-color-bg-raised);
  --sl-color-gray-6: var(--corvus-color-bg-surface);
  --sl-color-black: var(--corvus-color-bg-base);
  --sl-color-accent-low: rgb(215 25 33 / 10%);
  --sl-color-accent: var(--corvus-color-text-primary);
  --sl-color-accent-high: var(--corvus-color-text-display);
  --sl-color-text: var(--corvus-color-text-primary);
  --sl-color-text-accent: var(--corvus-color-text-display);
}

/* ─────────────────────────────────────────────
   Global Resets & Typography
   ───────────────────────────────────────────── */

body {
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────
   Header / Navbar
   Flat surface with bottom border — no blur.
   ───────────────────────────────────────────── */

header.header {
  border-bottom: 1px solid var(--sl-color-hairline-shade);
}

header.header .header {
  min-height: 4rem;
}

/* ── Site Title ── */
.site-title {
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--corvus-typography-font-display);
  gap: 0.75rem;
}

.site-title img {
  width: 28px;
  height: 28px;
}

:root[data-theme="light"] .site-title img:first-of-type {
  display: none;
}

:root[data-theme="light"] .site-title img:last-of-type {
  display: block;
}

:root[data-theme="dark"] .site-title img:first-of-type {
  display: block;
}

:root[data-theme="dark"] .site-title img:last-of-type {
  display: none;
}

/* ─────────────────────────────────────────────
   Sidebar
   Clean borders, no blur.
   ───────────────────────────────────────────── */

nav.sidebar a[aria-current="page"] {
  border-left: 3px solid var(--sl-color-accent);
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   Hero Section
   Flat background, border separation.
   ───────────────────────────────────────────── */

.hero {
  background: var(--sl-color-bg);
  padding: 5rem 3rem;
  position: relative;
  overflow: hidden;
  border-radius: var(--corvus-radius-card-lg);
  margin-top: 1rem;
  border: 1px solid var(--sl-color-hairline-shade);
}

.hero > .sl-flex {
  gap: 2rem;
}

.hero h1 {
  font-family: var(--corvus-typography-font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--sl-color-white);
}

.hero .tagline {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.7;
  max-width: 42rem;
  margin-top: 1.5rem;
  color: var(--sl-color-gray-2);
}

/* ── Hero Action Buttons ── */
.hero .action {
  margin-top: 2.5rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.hero a.primary {
  background: var(--sl-color-white);
  color: var(--sl-color-black);
  border: none;
  padding: 0.75rem 2rem;
  border-radius: var(--corvus-radius-pill);
  font-family: var(--corvus-typography-font-mono);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: opacity var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

.hero a.primary:hover {
  opacity: 0.85;
}

.hero a.minimal {
  border: 1px solid var(--sl-color-hairline-shade);
  padding: 0.75rem 2rem;
  border-radius: var(--corvus-radius-pill);
  font-family: var(--corvus-typography-font-mono);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sl-color-gray-1);
  transition: border-color var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

.hero a.minimal:hover {
  border-color: var(--sl-color-gray-2);
}

/* ─────────────────────────────────────────────
   Card Grid
   Flat cards, border only — no glass, no glow.
   ───────────────────────────────────────────── */

.sl-card-grid {
  gap: 1.5rem;
}

.card {
  background: var(--sl-color-gray-6);
  border: 1px solid var(--sl-color-hairline-shade);
  border-radius: var(--corvus-radius-card-lg);
  padding: 1.75rem;
  transition: border-color var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

.card:hover {
  border-color: var(--sl-color-gray-4);
}

.card .card-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sl-color-white);
}

.card .card-icon {
  border-radius: var(--corvus-radius-technical);
  padding: 0.5rem;
}

/* ─────────────────────────────────────────────
   Content Area Headings
   Nothing typography — display font, clean separation.
   ───────────────────────────────────────────── */

.sl-markdown-content h1,
.sl-markdown-content h2,
.sl-markdown-content h3,
.sl-markdown-content h4 {
  font-family: var(--corvus-typography-font-body);
}

.sl-markdown-content h2 {
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 3rem;
  margin-bottom: 2.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--sl-color-hairline-shade);
}

.features-section h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* ─────────────────────────────────────────────
   Inline Code
   Flat background, subtle border — no gradient.
   ───────────────────────────────────────────── */

.sl-markdown-content :not(pre) > code {
  background: var(--sl-color-bg-inline-code);
  border: 1px solid var(--sl-color-hairline-shade);
  border-radius: var(--corvus-radius-technical);
  padding: 0.15em 0.4em;
  font-size: 0.88em;
}

/* ─────────────────────────────────────────────
   Code Blocks
   Clean border, no shadow.
   ───────────────────────────────────────────── */

.expressive-code {
  border-radius: var(--corvus-radius-card);
  overflow: hidden;
}

.expressive-code .frame {
  border: 1px solid var(--sl-color-hairline-shade);
  border-radius: var(--corvus-radius-card);
}

/* ─────────────────────────────────────────────
   Smooth Transitions
   ───────────────────────────────────────────── */

a,
button,
input,
summary {
  transition-property: color, background-color, border-color, opacity;
  transition-duration: var(--corvus-motion-duration-default);
  transition-timing-function: var(--corvus-motion-easing-default);
}

/* ─────────────────────────────────────────────
   Table of Contents
   ───────────────────────────────────────────── */

starlight-toc a {
  transition: color var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

starlight-toc a[aria-current="true"] {
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   Links
   Underline on hover — no gradient underline.
   ───────────────────────────────────────────── */

.sl-markdown-content a {
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

.sl-markdown-content a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentcolor;
  transition: width var(--corvus-motion-duration-slow) var(--corvus-motion-easing-default);
}

.sl-markdown-content a:hover::after {
  width: 100%;
}

/* ─────────────────────────────────────────────
   Pagination Buttons
   Flat with border — no blur, no shadow.
   ───────────────────────────────────────────── */

.pagination-links a {
  border-radius: var(--corvus-radius-card);
  border: 1px solid var(--sl-color-hairline-shade);
  transition: border-color var(--corvus-motion-duration-default) var(--corvus-motion-easing-default);
}

.pagination-links a:hover {
  border-color: var(--sl-color-gray-4);
}

/* ─────────────────────────────────────────────
   Asides / Callouts
   Clean border — no blur.
   ───────────────────────────────────────────── */

.starlight-aside {
  border-radius: var(--corvus-radius-card);
  border-left-width: 4px;
}

/* ─────────────────────────────────────────────
   Scrollbar (dark)
   ───────────────────────────────────────────── */

[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--sl-color-gray-6);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--sl-color-gray-4);
  border-radius: var(--corvus-radius-pill);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--sl-color-gray-3);
}

/* ─────────────────────────────────────────────
   Search Dialog
   Flat surface — no blur, no glass.
   ───────────────────────────────────────────── */

dialog {
  border-radius: var(--corvus-radius-card-lg);
  border: 1px solid var(--sl-color-hairline-shade);
}

[data-theme="dark"] dialog {
  background: var(--corvus-color-bg-surface);
}

/* ─────────────────────────────────────────────
   Splash Page Layout
   ───────────────────────────────────────────── */

[data-page-type="splash"] .sl-container {
  max-width: var(--sl-content-width);
}

/* ── Feature Section ── */
.features-section {
  padding: 4rem 0;
}

/* ─────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--sl-color-hairline-shade);
}

/* ─────────────────────────────────────────────
   Focus Styles
   ───────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--corvus-color-text-primary);
  outline-offset: 2px;
  border-radius: var(--corvus-radius-technical);
}

/* ─────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────── */

@media (width <= 50rem) {
  .hero {
    padding: 2.5rem 0;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }
}

/* ─────────────────────────────────────────────
   View Transitions
   ───────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root) {
    animation: vt-fade-out 0.25s var(--corvus-motion-easing-default) both;
  }

  ::view-transition-new(root) {
    animation: vt-fade-in 0.3s var(--corvus-motion-easing-default) both;
  }

  @keyframes vt-fade-out {
    from {
      opacity: 1;
    }

    to {
      opacity: 0;
    }
  }

  @keyframes vt-fade-in {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }
}

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