/* Vix — site stylesheet
 *
 * Built on Lily Design System's class hooks (headless: no CSS ships with
 * the components — this file supplies the page's own look). Pages are
 * prerendered static HTML served from GitHub Pages.
 *
 * Colour/radius/font primitives (--color-*, --radius-*, --lily-*) are NOT
 * declared here: they live in assets/themes/<slug>.css, one of Lily's 57
 * reference theme stylesheets from the @lilydesignsystem/themes package
 * (copied in at build time by scripts/copy-lily-themes.js), loaded
 * exclusively by PickerBar's ThemePicker via its managed <link> — see
 * src/app.html and +layout.svelte. Each theme also styles Lily's own
 * components inside `@layer lily` with zero-specificity :where() rules,
 * which is what draws the header's pickers. This file only owns the tokens
 * that don't vary by theme, a small set of --vix-* aliases onto the active
 * theme's tokens (kept so the rules below read one consistent vocabulary),
 * and every page rule that consumes tokens by var(); being unlayered, any
 * rule here wins over a theme's layered one.
 */

:root {
  /* Layout — not a Lily token, a page-width decision this site makes. */
  --vix-content-max: 72rem;
  --vix-prose-max: 42rem;

  /* --vix-* aliases onto the active Lily theme's tokens (see
   * assets/themes/<slug>.css — --color-* are the theme's raw primitives,
   * --lily-* are Lily's derived semantic layer built on top of them).
   * Swapping the theme stylesheet swaps every one of these at once.
   */
  --vix-primary: var(--color-primary);
  /* Lily's own hover convention (see any theme's `.button:hover` rule):
     shift to the secondary brand colour, not a darkened primary. */
  --vix-primary-hover: var(--color-secondary);
  --vix-on-primary: var(--color-primary-content);
  --vix-page-bg: var(--lily-surface);
  --vix-card-bg: var(--lily-surface-alt);
  --vix-text: var(--lily-text);
  --vix-text-muted: var(--lily-text-muted);
  --vix-border: var(--lily-border);
  --vix-border-strong: var(--lily-border-strong);
  /* Soft primary-tinted surface: active nav item, secondary-button hover,
     inline code background. Derived (not a Lily token) so it still tracks
     whichever theme is active. */
  --vix-tint-bg: color-mix(in oklch, var(--color-primary) 12%, var(--lily-surface));
  --vix-code-text: var(--color-primary);
  --vix-radius: var(--lily-radius-md);
  --vix-radius-lg: var(--lily-radius-lg);
  --vix-shadow: var(--lily-shadow-sm);
  --vix-shadow-lg: var(--lily-shadow-lg);
  --vix-font-sans: var(--lily-font-body);
  --vix-font-mono: var(--lily-font-mono);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--vix-font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--vix-text);
  background: var(--vix-page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--vix-primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--vix-primary-hover); }
a:focus-visible {
  outline: 3px solid var(--vix-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin: 2rem 0 1rem;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }

p { margin: 0 0 1rem; }

code, pre {
  font-family: var(--vix-font-mono);
  font-size: 0.9em;
}
code {
  background: var(--vix-tint-bg);
  color: var(--vix-code-text);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--vix-radius);
  overflow-x: auto;
  line-height: 1.5;
}
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.terminal-mock {
  border: 1px solid var(--vix-border-strong);
  box-shadow: var(--vix-shadow-lg);
}

/* Header & navigation */

.site-header {
  background: var(--vix-card-bg);
  border-bottom: 1px solid var(--vix-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--vix-shadow);
}

.site-header-inner {
  max-width: var(--vix-content-max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--vix-text);
  text-decoration: none;
}
.site-brand:hover { color: var(--vix-primary); }
.site-brand-mark { width: 1.75rem; height: 1.75rem; border-radius: 4px; display: inline-block; vertical-align: middle; }

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--vix-text-muted);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--vix-radius);
  font-size: 0.95rem;
  transition: background 150ms;
}
.site-nav a:hover { background: var(--vix-border); color: var(--vix-text); }
.site-nav a[aria-current="page"] {
  color: var(--vix-primary);
  font-weight: 600;
  background: var(--vix-tint-bg);
}

.site-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Main content */

.site-main {
  max-width: var(--vix-content-max);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.prose { max-width: var(--vix-prose-max); }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li { margin-bottom: 0.25rem; }

/* Hero */

.site-hero {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  max-width: 48rem;
  margin: 0 auto;
}
.site-hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  margin: 0.5rem 0 1rem;
}
.site-hero-tagline {
  font-size: 1.25rem;
  color: var(--vix-text-muted);
  margin: 0 auto 2rem;
  max-width: 36rem;
}

/* Buttons */

.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--vix-radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 150ms;
  line-height: 1.2;
}
.button-primary {
  background: var(--vix-primary);
  color: var(--vix-on-primary);
  border-color: var(--vix-primary);
}
.button-primary:hover {
  background: var(--vix-primary-hover);
  border-color: var(--vix-primary-hover);
  color: var(--vix-on-primary);
}
.button-secondary {
  background: var(--vix-card-bg);
  color: var(--vix-primary);
  border-color: var(--vix-primary);
}
.button-secondary:hover {
  background: var(--vix-tint-bg);
}

.button-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.5rem 0;
}

/* Card grids */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.card {
  background: var(--vix-card-bg);
  border: 1px solid var(--vix-border);
  border-radius: var(--vix-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--vix-shadow);
  transition: transform 150ms, box-shadow 150ms;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--vix-shadow-lg);
}
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
.card-description {
  margin: 0;
  color: var(--vix-text-muted);
}

a.card { color: inherit; text-decoration: none; }
a.card:hover { color: inherit; }
.card a { text-decoration: none; }

/* Sections */

.section {
  margin: 4rem 0;
}
.section-heading {
  text-align: center;
  margin-bottom: 2rem;
}
.section-heading h2 {
  margin: 0;
}

/* Keys */

kbd {
  font-family: var(--vix-font-mono);
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--vix-border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--vix-card-bg);
  color: var(--vix-text);
  white-space: nowrap;
}

/* Copyable command (src/lib/CopyCommand.svelte) */

.copy-command {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin: 0 0 1rem;
  text-align: start;
}
.copy-command pre {
  flex: 1;
  margin: 0;
  min-width: 0;
}
.clipboard-copy-button {
  flex: none;
  font: inherit;
  font-weight: 600;
  padding: 0 1rem;
  border: 2px solid var(--vix-primary);
  border-radius: var(--vix-radius);
  background: var(--vix-card-bg);
  color: var(--vix-primary);
  cursor: pointer;
}
.clipboard-copy-button:hover { background: var(--vix-tint-bg); }
.clipboard-copy-button:focus-visible {
  outline: 3px solid var(--vix-primary);
  outline-offset: 2px;
}

.site-hero-install {
  max-width: 40rem;
  margin: 0 auto;
}
.site-hero-install-note {
  font-size: 0.95rem;
  color: var(--vix-text-muted);
}

/* Screenshots and demos */

.screenshot,
.demo {
  margin: 0;
}
.screenshot img,
.demo img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--vix-border-strong);
  border-radius: var(--vix-radius);
  box-shadow: var(--vix-shadow-lg);
  background: #262626;
}
.screenshot {
  max-width: 60rem;
  margin: 1rem auto 0;
}
.screenshot figcaption,
.demo figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: var(--vix-text-muted);
}
.screenshot figcaption { text-align: center; }

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 2rem;
}

/* Theme gallery (src/lib/ThemeGallery.svelte). The slides sit in Lily's
   `.carousel`, which the themes already style as a scroll-snap row; this
   only sizes each slide to the full row and lays out the controls. */

.site-theme-gallery {
  max-width: 60rem;
  margin: 1.5rem auto 0;
}
.site-theme-gallery .carousel {
  position: relative;
  gap: 0;
  scrollbar-width: thin;
}
.site-theme-gallery .site-theme-slide {
  flex: 0 0 100%;
  padding: 0 0 0.75rem;
}
.site-theme-slide figcaption { text-align: center; }
.site-theme-gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.site-theme-gallery-controls .button { padding: 0.5rem 1rem; }
.site-theme-gallery-status {
  margin: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.site-theme-gallery-status span {
  font-size: 0.9rem;
  color: var(--vix-text-muted);
}
.site-theme-gallery-names {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.site-theme-gallery-name {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--vix-radius);
  border: 1px solid var(--vix-border-strong);
  background: var(--vix-card-bg);
  color: var(--vix-text);
  cursor: pointer;
}
.site-theme-gallery-name:hover { background: var(--vix-tint-bg); }
.site-theme-gallery-name[aria-pressed='true'] {
  background: var(--vix-primary);
  border-color: var(--vix-primary);
  color: var(--vix-on-primary);
}

/* Small layout helpers */

.centered { margin-left: auto; margin-right: auto; }

/* At-a-glance numbers under the hero. */

/* Home-page comparison slice. */
.table-scroll { overflow-x: auto; }
.compare-table { width: 100%; border-collapse: collapse; }
.compare-table th, .compare-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--vix-border);
}
.compare-table td, .compare-table thead th { text-align: center; }
.compare-table tbody th { text-align: left; font-weight: normal; }

/* FAQ disclosure list. */
.faq details { border-bottom: 1px solid var(--vix-border); padding: 0.75rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.5rem 0 0; }

/* Closing call to action. */
.cta { text-align: center; }
.section-more { text-align: center; margin-top: 1.5rem; }
.small-print { font-size: 0.95rem; color: var(--vix-text-muted); }

.key-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}
.key-table th,
.key-table td {
  text-align: start;
  vertical-align: top;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--vix-border);
}
.key-table td:first-child { white-space: nowrap; }

.link-grid {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 48rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.75rem;
}
.link-grid a {
  display: block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--vix-border);
  border-radius: var(--vix-radius);
  background: var(--vix-card-bg);
  font-weight: 600;
  text-decoration: none;
}
.link-grid a:hover { background: var(--vix-tint-bg); }

.toc ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* Footer */

.site-footer {
  background: var(--vix-card-bg);
  border-top: 1px solid var(--vix-border);
  margin-top: 4rem;
  padding: 2rem 1.5rem;
}
.site-footer-inner {
  max-width: var(--vix-content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  color: var(--vix-text-muted);
}
.site-footer p { margin: 0; }
.site-footer-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* PickerBar (header controls: search, theme, language, text size, share)
 *
 * Every picker's button, popup, option, tooltip and search field is styled
 * by the active Lily theme stylesheet (its `@layer lily` picker rules), so
 * the bar follows the chosen theme without overrides here. This file only
 * lays the bar out in the header and visually hides the theme and share
 * pickers' status lines, which would otherwise push the row out of line.
 */

.picker-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--lily-space-sm);
}

/* The theme and share pickers' aria-live statuses: informative, not page content, and the
   header is tight on space — kept in the accessibility tree but visually
   hidden rather than dropped. */
.theme-picker-status,
.share-picker-status,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Text size (data-text-size on <html>, set by TextSizePicker)
 *
 * The seven-step scale PickerBar defaults to (DEFAULT_SIZES); "normal"
 * is the 100% baseline every other step scales from.
 */

:root[data-text-size="smallest"] { font-size: 80%; }
:root[data-text-size="smaller"] { font-size: 90%; }
:root[data-text-size="small"] { font-size: 95%; }
:root[data-text-size="normal"] { font-size: 100%; }
:root[data-text-size="large"] { font-size: 112.5%; }
:root[data-text-size="larger"] { font-size: 125%; }
:root[data-text-size="largest"] { font-size: 150%; }

/* Skip link */

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--vix-primary);
  color: var(--vix-on-primary);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  z-index: 100;
  transition: top 150ms;
}
.skip-link:focus {
  top: 1rem;
  color: var(--vix-on-primary);
}

/* Responsive helpers */

@media (max-width: 640px) {
  .site-header-right { width: 100%; justify-content: space-between; }
  .site-nav { width: 100%; justify-content: flex-start; }
  .site-main { padding: 2rem 1rem; }
  .site-hero { padding: 2rem 1rem 1rem; }
  .copy-command { flex-direction: column; }
  .clipboard-copy-button { padding: 0.5rem 1rem; }
  .demo-grid { grid-template-columns: 1fr; }
  .key-table td:first-child { white-space: normal; }
}

/* Reduced motion */

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

/* Home page Install section: one entry per front end (vix-tui, then the GUIs). */
.frontend-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
  max-width: 72rem;
  margin: 1.5rem auto 0;
}
.frontend {
  background: var(--vix-card-bg);
  border: 1px solid var(--vix-border);
  border-radius: var(--vix-radius-lg);
  box-shadow: var(--vix-shadow);
  padding: 1.25rem 1.5rem;
  min-width: 0;
}
.frontend h3 { margin: 0 0 0.5rem; font-family: var(--vix-font-mono); }
.frontend p { margin: 0 0 0.75rem; }
.frontend .copy-command { margin-top: 0.5rem; }
