/* ============================================================
   painted — landing page styles
   Catppuccin Latte (light) / Mocha (dark), CSS custom properties
   ============================================================ */

/* --- Design Tokens --- */

:root {
  color-scheme: light;
  /* Catppuccin Latte */
  --page-bg: #eff1f5;
  --surface: #e6e9ef;
  --text: #4c4f69;
  --text-muted: #9ca0b0;
  --text-subtle: #8c8fa1;
  --code-bg: #e6e9ef;
  --code-border: #dce0e8;
  --accent: #1e66f5;
  --success: #40a02b;
  --warning: #df8e1d;
  --error: #d20f39;
  --mauve: #8839ef;
  --overlay: #9ca0b0;
  --heading: #4c4f69;
  --link: #1e66f5;
  --link-hover: #7287fd;
  --gif-shadow: 0 4px 24px rgba(76, 79, 105, 0.12), 0 1px 4px rgba(76, 79, 105, 0.08);
  --code-shadow: none;
  --hero-glow: none;
  --divider: #ccd0da;
  --install-bg: #dce0e8;
  --kbd-bg: #ccd0da;

  /* Prism token colors — Latte */
  --prism-keyword: #8839ef;
  --prism-string: #40a02b;
  --prism-function: #1e66f5;
  --prism-comment: #9ca0b0;
  --prism-number: #fe640b;
  --prism-operator: #04a5e5;
  --prism-class: #df8e1d;
  --prism-builtin: #ea76cb;
  --prism-punctuation: #6c6f85;
  --prism-boolean: #fe640b;
  --prism-decorator: #dd7878;
  --prism-parameter: #4c4f69;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    /* Catppuccin Mocha */
    --page-bg: #1e1e2e;
    --surface: #181825;
    --text: #cdd6f4;
    --text-muted: #6c7086;
    --text-subtle: #585b70;
    --code-bg: #181825;
    --code-border: #313244;
    --accent: #89b4fa;
    --success: #a6e3a1;
    --warning: #f9e2af;
    --error: #f38ba8;
    --mauve: #cba6f7;
    --overlay: #6c7086;
    --heading: #cdd6f4;
    --link: #89b4fa;
    --link-hover: #b4befe;
    --gif-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
    --code-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    --hero-glow: 0 0 80px rgba(137, 180, 250, 0.06);
    --divider: #313244;
    --install-bg: #181825;
    --kbd-bg: #313244;

    /* Prism token colors — Mocha */
    --prism-keyword: #cba6f7;
    --prism-string: #a6e3a1;
    --prism-function: #89b4fa;
    --prism-comment: #6c7086;
    --prism-number: #fab387;
    --prism-operator: #89dceb;
    --prism-class: #f9e2af;
    --prism-builtin: #f5c2e7;
    --prism-punctuation: #a6adc8;
    --prism-boolean: #fab387;
    --prism-decorator: #f2cdcd;
    --prism-parameter: #cdd6f4;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* Catppuccin Mocha */
  --page-bg: #1e1e2e;
  --surface: #181825;
  --text: #cdd6f4;
  --text-muted: #6c7086;
  --text-subtle: #585b70;
  --code-bg: #181825;
  --code-border: #313244;
  --accent: #89b4fa;
  --success: #a6e3a1;
  --warning: #f9e2af;
  --error: #f38ba8;
  --mauve: #cba6f7;
  --overlay: #6c7086;
  --heading: #cdd6f4;
  --link: #89b4fa;
  --link-hover: #b4befe;
  --gif-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --code-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  --hero-glow: 0 0 80px rgba(137, 180, 250, 0.06);
  --divider: #313244;
  --install-bg: #181825;
  --kbd-bg: #313244;

  /* Prism token colors — Mocha */
  --prism-keyword: #cba6f7;
  --prism-string: #a6e3a1;
  --prism-function: #89b4fa;
  --prism-comment: #6c7086;
  --prism-number: #fab387;
  --prism-operator: #89dceb;
  --prism-class: #f9e2af;
  --prism-builtin: #f5c2e7;
  --prism-punctuation: #a6adc8;
  --prism-boolean: #fab387;
  --prism-decorator: #f2cdcd;
  --prism-parameter: #cdd6f4;
}

/* --- Reset & Base --- */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--text);
  background-color: var(--page-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */

h1, h2, h3 {
  color: var(--heading);
  line-height: 1.25;
  font-weight: 700;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
}

code, pre, .mono {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code",
    "Fira Code", "Droid Sans Mono", "Source Code Pro", monospace;
}

/* --- Layout Shell --- */

.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Top Nav --- */

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 0.5rem;
}

.brand {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code",
    "Fira Code", "Droid Sans Mono", "Source Code Pro", monospace;
  font-weight: 800;
  color: var(--heading);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-button {
  border: 1px solid var(--code-border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease;
}

.nav-button:hover {
  border-color: var(--accent);
}

.nav-button:active {
  transform: translateY(1px);
}

.nav-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Docs Layout --- */

body.docs .page-wrapper {
  max-width: 1120px;
}

body.docs .docs-shell {
  display: flex;
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--divider);
}

body.docs .docs-sidebar {
  flex: 0 0 240px;
  width: 240px;
  align-self: flex-start;
  position: sticky;
  top: 1rem;
  padding: 1rem 1rem 0.75rem;
  border: 1px solid var(--code-border);
  background: var(--surface);
  border-radius: 12px;
}

body.docs .docs-sidebar-title {
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.75rem;
}

body.docs .docs-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-bottom: 0.25rem;
}

body.docs .docs-sidebar-links a {
  color: var(--text-muted);
  padding: 0.35rem 0.45rem;
  border-radius: 10px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

body.docs .docs-sidebar-links a:hover {
  color: var(--text);
  background: var(--code-bg);
}

body.docs .docs-sidebar-links a[aria-current="page"] {
  color: var(--text);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
}

body.docs .docs-content {
  flex: 1;
  min-width: 0;
}

body.docs .markdown h1 {
  font-size: 2.25rem;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
}

body.docs .markdown h2 {
  margin-top: 2.5rem;
}

body.docs .markdown h3 {
  margin-top: 1.75rem;
  font-size: 1.2rem;
}

body.docs .markdown p {
  margin: 0.85rem 0;
}

body.docs .markdown ul,
body.docs .markdown ol {
  margin: 0.85rem 0 0.85rem 1.25rem;
}

body.docs .markdown li {
  margin: 0.25rem 0;
}

body.docs .markdown hr {
  border: 0;
  border-top: 1px solid var(--divider);
  margin: 2rem 0;
}

body.docs .markdown blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--divider);
  background: var(--surface);
  border-radius: 10px;
}

body.docs .markdown blockquote p {
  margin: 0;
  color: var(--text);
}

/* --- Hero Section --- */

.hero {
  text-align: center;
  padding: 6rem 0 5rem;
}

.hero-title {
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code",
    "Fira Code", "Droid Sans Mono", "Source Code Pro", monospace;
  font-size: 4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--heading);
  margin-bottom: 0.75rem;
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-weight: 400;
}

.hero-gif-wrap {
  margin: 0 auto 2.5rem;
  max-width: 640px;
}

.hero-gif-wrap img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--gif-shadow);
  display: block;
}

.hero-code {
  max-width: 520px;
  margin: 0 auto 1.5rem;
  text-align: left;
}

.hero-subtext {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

.hero-subtext code {
  font-size: 0.9em;
  color: var(--accent);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* --- Section Shared --- */

.section {
  padding: 5rem 0;
  border-top: 1px solid var(--divider);
}

.section-header {
  margin-bottom: 2.5rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: 0.25rem;
}

/* --- Two-Column Layout (code + GIF) --- */

.split {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}

.split-code {
  flex: 1;
  min-width: 0;
}

.split-gif {
  flex: 1;
  min-width: 0;
}

.split-gif img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--gif-shadow);
  display: block;
}

/* GIF placeholder — styled alt text fallback */
.split-gif img,
.hero-gif-wrap img {
  background: var(--code-bg);
  min-height: 120px;
}

/* Reversed layout: GIF left, code right */
.split--reverse {
  flex-direction: row-reverse;
}

/* --- Code Blocks --- */

pre[class*="language-"] {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  box-shadow: var(--code-shadow);
  margin: 0;
}

pre.painted-output {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  box-shadow: var(--code-shadow);
  margin: 0;
}

.code-copy {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  border: 1px solid var(--code-border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, border-color 0.15s ease;
}

pre[class*="language-"]:hover .code-copy,
pre[class*="language-"]:focus-within .code-copy {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.code-copy:hover {
  border-color: var(--accent);
}

pre[class*="language-"] + pre[class*="language-"] {
  margin-top: 1rem;
}

code[class*="language-"] {
  background: none;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
  color: var(--text);
}

/* Inline code */
:not(pre) > code {
  font-size: 0.9em;
  color: var(--accent);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--code-border);
}

/* --- Prism Token Overrides (no Prism theme loaded) --- */

.token.keyword { color: var(--prism-keyword); }
.token.string, .token.attr-value { color: var(--prism-string); }
.token.function { color: var(--prism-function); }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--prism-comment); font-style: italic; }
.token.number { color: var(--prism-number); }
.token.operator { color: var(--prism-operator); }
.token.class-name { color: var(--prism-class); }
.token.builtin { color: var(--prism-builtin); }
.token.punctuation { color: var(--prism-punctuation); }
.token.boolean { color: var(--prism-boolean); }
.token.decorator { color: var(--prism-decorator); }
.token.parameter { color: var(--prism-parameter); }
.token.triple-quoted-string { color: var(--prism-string); }

/* Bash tokens */
.token.function.bash { color: var(--prism-function); }
.token.shebang { color: var(--prism-comment); }

/* --- Install Section --- */

.install-section {
  text-align: center;
  padding: 5rem 0;
  border-top: 1px solid var(--divider);
}

.install-command {
  display: inline-block;
  background: var(--install-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 1rem 2rem;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code",
    "Fira Code", "Droid Sans Mono", "Source Code Pro", monospace;
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.install-command .install-prefix {
  color: var(--text-muted);
  user-select: none;
}

.install-note {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--divider);
  padding: 3rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

/* --- Responsive (< 768px) --- */

@media (max-width: 768px) {
  .top-nav {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 1.25rem;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
    gap: 1rem;
  }

  .hero {
    padding: 4rem 0 3rem;
  }

  .hero-title {
    font-size: 2.75rem;
  }

  .hero-tagline {
    font-size: 1.1rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  h2 {
    font-size: 1.4rem;
  }

  .split,
  .split--reverse {
    flex-direction: column;
    gap: 2rem;
  }

  .split-gif {
    order: -1;
  }

  pre[class*="language-"] {
    font-size: 0.8rem;
    padding: 1rem 1.25rem;
  }

  .install-command {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
  }

  body.docs .docs-shell {
    flex-direction: column;
    gap: 1.25rem;
    padding: 1.5rem 0 2.5rem;
  }

  body.docs .docs-sidebar {
    width: 100%;
    flex: 0 0 auto;
    position: static;
  }
}
