/*
 * Arvel — docs site theming
 *
 * Source of truth: docs/ux/DESIGN.md
 * This file maps DTCG design tokens to mkdocs-material's --md-* CSS variables,
 * then adds branded surface treatments (hero, feature grid, admonitions, code
 * accent, focus rings). All visual values trace back to DESIGN.md.
 *
 * Section index:
 *   1.  Token bridge (--arvel-* variables)
 *   2.  mkdocs-material variable overrides (light + dark)
 *   3.  Hero (landing page)
 *   4.  Feature grid (grid cards on landing)
 *   4b. Pillars (landing page value props)
 *   4c. Help section (community CTA)
 *   5.  Branded admonitions
 *   6.  Code blocks
 *   7.  Buttons and focus rings
 *   8.  Announce bar
 *   9.  Reduced motion
 */

/* 1. Token bridge ---------------------------------------------------------- */

:root {
  /* Brand */
  --arvel-color-brand-midnight: #26223C;
  --arvel-color-brand-shell: #45366F;
  --arvel-color-brand-shell-deep: #2F2452;
  --arvel-color-brand-primary: #6D28D9;
  --arvel-color-brand-primary-hover: #5B21B6;
  --arvel-color-brand-primary-muted: #EDE9FE;
  --arvel-color-brand-accent: #06B6D4;
  --arvel-color-brand-accent-muted: #CFFAFE;

  /* Neutral (light) */
  --arvel-color-ink: #0B0B12;
  --arvel-color-body: #1F1F2A;
  --arvel-color-muted: #6B6B7B;
  --arvel-color-border: #E5E5EC;
  --arvel-color-surface: #FFFFFF;
  --arvel-color-surface-raised: #F8F8FB;
  --arvel-color-surface-code: #F4F4F8;

  /* Semantic */
  --arvel-color-success: #10B981;
  --arvel-color-warn: #F59E0B;
  --arvel-color-error: #EF4444;
  --arvel-color-info: #3B82F6;

  /* Spacing (4px grid) */
  --arvel-space-1: 0.25rem;
  --arvel-space-2: 0.5rem;
  --arvel-space-3: 0.75rem;
  --arvel-space-4: 1rem;
  --arvel-space-6: 1.5rem;
  --arvel-space-8: 2rem;
  --arvel-space-12: 3rem;
  --arvel-space-16: 4rem;

  /* Radii */
  --arvel-radius-sm: 0.25rem;
  --arvel-radius-md: 0.5rem;
  --arvel-radius-lg: 0.75rem;
  --arvel-radius-xl: 1rem;

  /* Motion */
  --arvel-motion-fast: 120ms;
  --arvel-motion-base: 200ms;
  --arvel-motion-slow: 320ms;
  --arvel-easing-standard: cubic-bezier(0.2, 0, 0, 1);
}

[data-md-color-scheme="slate"] {
  /* Midnight and shell are intentionally identical in both modes for chrome
     consistency (the GitHub/Linear/Vercel pattern). */
  --arvel-color-brand-midnight: #26223C;
  --arvel-color-brand-shell: #45366F;
  --arvel-color-brand-shell-deep: #2F2452;
  --arvel-color-brand-primary: #A78BFA;
  --arvel-color-brand-primary-hover: #C4B5FD;
  --arvel-color-brand-primary-muted: #2E1065;
  --arvel-color-brand-accent: #22D3EE;
  --arvel-color-brand-accent-muted: #164E63;

  --arvel-color-ink: #F4F4F8;
  --arvel-color-body: #E5E5EC;
  --arvel-color-muted: #8B8B9F;
  --arvel-color-border: #2A2A38;
  --arvel-color-surface: #0E0E1A;
  --arvel-color-surface-raised: #16162A;
  --arvel-color-surface-code: #1A1A2E;
}

/* 2. mkdocs-material variable overrides ----------------------------------- */

:root,
[data-md-color-scheme="default"] {
  /* Header, top tabs, and footer chrome use the shell color (mode-agnostic).
     Links, focus rings, and primary buttons keep the energetic brand violet. */
  --md-primary-fg-color: var(--arvel-color-brand-shell);
  --md-primary-fg-color--light: #5B4A8A;
  --md-primary-fg-color--dark: var(--arvel-color-brand-shell-deep);
  --md-primary-bg-color: #FFFFFF;
  --md-primary-bg-color--light: #FFFFFFB3;

  --md-accent-fg-color: var(--arvel-color-brand-accent);
  --md-accent-fg-color--transparent: rgba(6, 182, 212, 0.1);
  --md-accent-bg-color: #FFFFFF;
  --md-accent-bg-color--light: #FFFFFFB3;

  --md-typeset-a-color: var(--arvel-color-brand-primary);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color: var(--arvel-color-brand-shell);
  --md-primary-fg-color--light: #5B4A8A;
  --md-primary-fg-color--dark: var(--arvel-color-brand-shell-deep);
  --md-primary-bg-color: #FFFFFF;
  --md-primary-bg-color--light: #FFFFFFB3;

  --md-accent-fg-color: var(--arvel-color-brand-accent);
  --md-accent-fg-color--transparent: rgba(34, 211, 238, 0.12);

  --md-default-bg-color: var(--arvel-color-surface);
  --md-typeset-a-color: var(--arvel-color-brand-primary);
  --md-code-bg-color: var(--arvel-color-surface-code);
}


.md-header__title {
  margin-inline-start: 0 !important;
  margin-inline-end: .4rem !important;
}

/* 3. Hero (landing page) --------------------------------------------------- */

/* On the landing page (index.md sets `hide: navigation, toc`), kill the
   default mkdocs-material top padding so the hero sits right under the nav
   tabs instead of floating in dead space. Targets pages where the primary
   sidebar is hidden -- i.e. the landing page. */
.md-main__inner>.md-content>.md-content__inner:has(> .arvel-hero) {
  padding-top: var(--arvel-space-4);
  padding-bottom: var(--arvel-space-4);
}

.arvel-hero {
  position: relative;
  padding: var(--arvel-space-6) 0 var(--arvel-space-4);
  margin-bottom: var(--arvel-space-4);
  text-align: center;
  isolation: isolate;
}

.arvel-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 50% 60% at 50% 30%,
      color-mix(in srgb, var(--arvel-color-brand-primary) 14%, transparent),
      transparent 70%),
    radial-gradient(ellipse 30% 40% at 75% 80%,
      color-mix(in srgb, var(--arvel-color-brand-accent) 10%, transparent),
      transparent 70%);
  pointer-events: none;
}

/* All hero rules are scoped under .md-typeset to outweigh mkdocs-material's
   built-in element rules (.md-typeset h1, .md-typeset p, etc), which would
   otherwise override our margins and add big gaps between hero elements. */

.md-typeset .arvel-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--arvel-space-2);
  padding: var(--arvel-space-1) var(--arvel-space-3);
  margin: 0 0 var(--arvel-space-4);
  font-family: var(--md-code-font-family, "JetBrains Mono", monospace);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--arvel-color-brand-primary);
  background: color-mix(in srgb, var(--arvel-color-brand-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--arvel-color-brand-primary) 25%, transparent);
  border-radius: 9999px;
}

.md-typeset .arvel-hero__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--arvel-color-brand-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--arvel-color-brand-accent) 25%, transparent);
}

.md-typeset .arvel-hero__title,
.md-typeset h1.arvel-hero__title {
  font-size: clamp(1.75rem, 1rem + 3vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 auto var(--arvel-space-3);
  padding: 0 var(--arvel-space-2);
  max-width: min(28ch, 100%);
  color: var(--arvel-color-ink);
  overflow-wrap: break-word;
}

.md-typeset .arvel-hero__title .arvel-hero__accent {
  background: linear-gradient(135deg,
      var(--arvel-color-brand-primary),
      var(--arvel-color-brand-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.md-typeset .arvel-hero__lede,
.md-typeset p.arvel-hero__lede {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--arvel-color-muted);
  max-width: 56ch;
  margin: 0 auto var(--arvel-space-6);
}

.md-typeset .arvel-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--arvel-space-3);
  justify-content: center;
  margin: 0 0 var(--arvel-space-6);
}

/* The actions div wraps a markdown-rendered <p> containing the buttons -- kill
   that paragraph's default margin so it doesn't add extra space. */
.md-typeset .arvel-hero__actions>p {
  margin: 0;
}

.md-typeset .arvel-hero__actions .md-button {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.md-typeset .arvel-hero__actions .md-button:hover {
  transform: unset;
}

.md-typeset .arvel-hero__taste {
  max-width: min(720px, 100%);
  margin: 0 auto;
  text-align: left;
}

.md-typeset .arvel-hero__taste pre,
.md-typeset .arvel-hero__taste .highlight {
  max-width: 100%;
  overflow-x: auto;
}

.arvel-hero__taste .highlight pre,
.arvel-hero__taste pre {
  border: 1px solid var(--arvel-color-border);
  border-radius: var(--arvel-radius-lg);
  box-shadow: 0 12px 32px -8px rgba(11, 11, 18, 0.12);
}

[data-md-color-scheme="slate"] .arvel-hero__taste .highlight pre,
[data-md-color-scheme="slate"] .arvel-hero__taste pre {
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
}

/* 4. Feature grid (mkdocs-material grid cards) ---------------------------- */

.md-typeset .grid.cards> :is(ul, ol)>li,
.md-typeset .grid>.card {
  border: 1px solid var(--arvel-color-border);
  border-radius: var(--arvel-radius-lg);
  background: var(--arvel-color-surface-raised);
  padding: var(--arvel-space-6);
  transition:
    border-color var(--arvel-motion-base) var(--arvel-easing-standard),
    transform var(--arvel-motion-base) var(--arvel-easing-standard),
    box-shadow var(--arvel-motion-base) var(--arvel-easing-standard);
}

.md-typeset .grid.cards> :is(ul, ol)>li:hover {
  border-color: color-mix(in srgb, var(--arvel-color-brand-primary) 40%, var(--arvel-color-border));
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--arvel-color-brand-primary) 25%, transparent);
}

.md-typeset .grid.cards> :is(ul, ol)>li> :first-child {
  margin-top: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* 4b. Pillars (landing page value props) ---------------------------------- */

/* Auto-fit responsive grid. At wide viewports renders three columns; collapses
   to two and then one as the container shrinks. Sits below the hero, above
   Quick Start. Icons + heading + description per pillar. */
.md-typeset .arvel-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--arvel-space-6);
  margin: var(--arvel-space-8) auto var(--arvel-space-12);
}

@media (max-width: 48em) {
  .md-typeset .arvel-pillars {
    gap: var(--arvel-space-4);
  }
}

.md-typeset .arvel-pillar {
  position: relative;
  min-width: 0;
  padding: var(--arvel-space-6);
  background: var(--arvel-color-surface-raised);
  border: 1px solid var(--arvel-color-border);
  border-radius: var(--arvel-radius-lg);
  transition:
    border-color var(--arvel-motion-base) var(--arvel-easing-standard),
    transform var(--arvel-motion-base) var(--arvel-easing-standard),
    box-shadow var(--arvel-motion-base) var(--arvel-easing-standard);
}

.md-typeset .arvel-pillar::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--arvel-space-6);
  right: var(--arvel-space-6);
  height: 2px;
  border-radius: 0 0 var(--arvel-radius-sm) var(--arvel-radius-sm);
  background: linear-gradient(90deg,
      var(--arvel-color-brand-primary),
      var(--arvel-color-brand-accent));
  opacity: 0.7;
}

.md-typeset .arvel-pillar:hover {
  border-color: color-mix(in srgb, var(--arvel-color-brand-primary) 40%, var(--arvel-color-border));
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--arvel-color-brand-primary) 25%, transparent);
}

.md-typeset .arvel-pillar__icon {
  display: block;
  font-size: 2rem;
  line-height: 1;
  color: var(--arvel-color-brand-primary);
  margin-bottom: var(--arvel-space-3);
}

.md-typeset .arvel-pillar h3 {
  margin: 0 0 var(--arvel-space-2);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--arvel-color-ink);
}

.md-typeset .arvel-pillar p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--arvel-color-muted);
}

/* 4c. Help section (community CTA) --------------------------------------- */

/* Three-item list with icons; renders as a row on wide screens, stacks on
   narrow ones. Icons inherit the surrounding link color. */
.md-typeset .arvel-help>ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--arvel-space-4);
  margin: var(--arvel-space-6) 0 var(--arvel-space-8);
  padding: 0;
  list-style: none;
}

.md-typeset .arvel-help>ul>li {
  margin: 0;
  min-width: 0;
  padding: var(--arvel-space-4) var(--arvel-space-5);
  background: var(--arvel-color-surface-raised);
  border: 1px solid var(--arvel-color-border);
  border-radius: var(--arvel-radius-md);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--arvel-color-body);
  transition:
    border-color var(--arvel-motion-base) var(--arvel-easing-standard),
    transform var(--arvel-motion-base) var(--arvel-easing-standard);
}

.md-typeset .arvel-help>ul>li:hover {
  border-color: color-mix(in srgb, var(--arvel-color-brand-primary) 40%, var(--arvel-color-border));
  transform: translateY(-1px);
}

.md-typeset .arvel-help>ul>li::before {
  content: none;
}

/* 5. Branded admonitions --------------------------------------------------- */

.md-typeset .admonition,
.md-typeset details {
  border-radius: var(--arvel-radius-lg);
  border-width: 1px;
  border-left-width: 4px;
}

.md-typeset .admonition.info,
.md-typeset details.info {
  border-color: var(--arvel-color-brand-accent);
}

.md-typeset .admonition.info>.admonition-title,
.md-typeset details.info>summary {
  background: color-mix(in srgb, var(--arvel-color-brand-accent) 10%, transparent);
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-color: var(--arvel-color-brand-primary);
}

.md-typeset .admonition.tip>.admonition-title,
.md-typeset details.tip>summary {
  background: color-mix(in srgb, var(--arvel-color-brand-primary) 10%, transparent);
}

/* 6. Code blocks ----------------------------------------------------------- */

.md-typeset pre>code,
.md-typeset .highlight pre {
  border-radius: var(--arvel-radius-md);
}

.md-typeset .highlight {
  position: relative;
}

/* Subtle left-edge accent on code blocks for "structural" feel */
.md-typeset div.highlight>pre::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg,
      var(--arvel-color-brand-primary),
      var(--arvel-color-brand-accent));
  border-radius: var(--arvel-radius-md) 0 0 var(--arvel-radius-md);
  opacity: 0.6;
}

/* Inline code */
.md-typeset code {
  border-radius: var(--arvel-radius-sm);
  padding: 0.1em 0.35em;
  background: color-mix(in srgb, var(--arvel-color-brand-primary) 7%, transparent);
}

[data-md-color-scheme="slate"] .md-typeset code {
  background: color-mix(in srgb, var(--arvel-color-brand-primary) 14%, transparent);
}

/* 7. Buttons and focus rings ---------------------------------------------- */

.md-typeset .md-button {
  border-radius: var(--arvel-radius-md);
  padding: var(--arvel-space-2) var(--arvel-space-4);
  transition:
    transform var(--arvel-motion-fast) var(--arvel-easing-standard),
    box-shadow var(--arvel-motion-base) var(--arvel-easing-standard),
    background var(--arvel-motion-base) var(--arvel-easing-standard);
}

.md-typeset .md-button--primary {
  background: linear-gradient(135deg,
      var(--arvel-color-brand-primary),
      color-mix(in srgb, var(--arvel-color-brand-primary) 75%, var(--arvel-color-brand-accent)));
  border-color: transparent;
  color: #FFFFFF;
}

.md-typeset .md-button--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--arvel-color-brand-primary) 50%, transparent);
}

.md-typeset .md-button:focus-visible,
.md-typeset a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--arvel-color-brand-accent) 40%, transparent);
}

/* 8. Announce bar --------------------------------------------------------- */

/* The banner is mode-agnostic chrome on the deepest brand surface (midnight),
   above the shell-colored header. The almost-black background lets the cyan
   CTA and code accents pop while reading as a calm system bar, not a
   marketing splash. */
.md-banner {
  background: var(--arvel-color-brand-midnight);
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.md-banner__inner {
  font-weight: 500;
}

/* The whole banner can be a single clickable <a> (good UX -- click anywhere
   to follow the announcement). Keep the wrapper link styled like body text so
   the bar reads as a status banner, not as one giant hyperlink. */
.md-banner a {
  color: #FFFFFF;
  font-weight: 500;
  text-decoration: none;
}

/* The visible CTA is the <em> "see the roadmap" part inside the wrapper link.
   Uses cyan-300 (#67E8F9, lighter than the brand accent) so it stays readable
   over the cyan end of the gradient. */
.md-banner em {
  color: #67E8F9;
  font-style: normal;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition:
    color var(--arvel-motion-fast) var(--arvel-easing-standard),
    text-decoration-thickness var(--arvel-motion-fast) var(--arvel-easing-standard);
}

.md-banner a:hover em,
.md-banner a:focus-visible em {
  color: #A5F3FC;
  text-decoration-thickness: 2px;
}

.md-banner a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, #67E8F9 40%, transparent);
  border-radius: var(--arvel-radius-sm);
}

/* <strong> in the banner ("Pre-alpha") stays white but gets a hair more weight
   to anchor the message. */
.md-banner strong {
  font-weight: 700;
  color: #FFFFFF;
}

/* Inline <code> in the banner (e.g. the `0.1.0` version label). */
.md-banner code {
  background: rgba(255, 255, 255, 0.14);
  color: #67E8F9;
  padding: 0.1em 0.45em;
  border-radius: var(--arvel-radius-sm);
  font-size: 0.92em;
  font-weight: 500;
}

/* The dismiss button (X icon) inherits color: #FFFFFF from .md-banner, which
   already gives good contrast on the gradient. */

/* 9. Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

  .md-typeset .grid.cards> :is(ul, ol)>li,
  .md-typeset .md-button {
    transition: none;
  }

  .md-typeset .grid.cards> :is(ul, ol)>li:hover,
  .md-typeset .md-button--primary:hover {
    transform: none;
  }
}
