/* ---------- CSS Variables & Design Tokens ---------- */
:root {
  --bg: #070708;
  --panel: #0d0d0f;
  --panel-2: #121215;
  --line: #1c1c21;
  --line-soft: #141417;
  
  --ink: #f5f5f7;
  --ink-dim: #a1a1aa;
  --ink-mute: #52525b;
  
  --amber: #f1b83f;
  --amber-dim: #c5912a;
  --amber-glow: rgba(241, 184, 63, 0.12);
  --green: #4ade80;
  --red: #f47174;
  --blue: #3b82f6;
  
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius: 12px;
  --radius-sm: 6px;
  --maxw: 1100px;
  --header-h: 64px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: all 0.25s var(--ease-out);

  /* One lit top edge, reused by every raised surface. On a near-black UI this
     single hairline is what separates a "card" from a "rectangle" — it reads as
     a surface catching light from above rather than a flat fill. */
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --lift: 0 24px 48px -20px rgba(0, 0, 0, 0.7);
}

/* ---------- Global Reset & Background Aura ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  /* The header is sticky, so an un-padded anchor jump parks the target
     underneath it. Every in-page link depends on this. */
  scroll-padding-top: calc(var(--header-h) + 1.25rem);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/*
 * Deep background ambient glow.
 * Must stay `fixed`, not `absolute`: `overflow-x: hidden` on body propagates to
 * the viewport, which leaves body itself non-clipping, so an absolutely
 * positioned 1000px-wide child overflows the scroll area and produces a
 * horizontal scrollbar on narrow screens. Fixed elements don't extend it.
 */
body::before {
  content: '';
  position: fixed;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 600px;
  background: radial-gradient(circle, rgba(241, 184, 63, 0.05) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

/*
 * Film grain.
 * Large flat fields of near-black band badly on 8-bit panels — the aurora
 * gradients behind the hero are exactly the case that shows it. A few percent
 * of static noise dithers those ramps away and gives the whole surface a
 * material quality. It sits above the header so the treatment is uniform, and
 * below the skip link so focus is never veiled. Non-interactive by definition.
 */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Reading position for a page that is now long enough to get lost in. Painted
   above the header, hairline-thin, and purely ambient — it is never the only
   signal for where you are (see the scrollspy nav state). */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 120;
  pointer-events: none;
  background: transparent;
}

.scroll-progress i {
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--amber), #ff8c00 65%, var(--green));
  box-shadow: 0 0 12px -2px rgba(241, 184, 63, 0.55);
}

/* Where supported this runs on the compositor off a scroll timeline, with no
   scroll listener at all. landing.js only takes over when it isn't. */
@supports (animation-timeline: scroll()) {
  .scroll-progress i {
    animation: scroll-progress linear both;
    animation-timeline: scroll(root block);
  }
}

@keyframes scroll-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(241, 184, 63, 0.2);
  color: var(--ink);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-mute);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Accessibility Primitives ---------- */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  background: var(--amber);
  color: #0a0a0b;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 0.75rem;
}

/*
 * Motion is decorative throughout this site — every animation either loops
 * ambiently or illustrates a feature that is also described in text. Users who
 * opt out lose nothing but movement, so we hard-stop all of it.
 */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Header & Navigation ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 7, 8, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

/* At the top of the page the header should feel weightless and merge into the
   hero; once content is scrolling under it, it earns its border and shadow.
   landing.js toggles .stuck. */
header.stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.9);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

nav {
  display: flex;
  gap: 1.75rem;
  align-items: center;
}

nav a {
  font-size: 0.8rem;
  color: var(--ink-dim);
  transition: var(--transition);
  font-weight: 500;
  position: relative;
  padding: 0.35rem 0;
}

nav a:hover {
  color: var(--ink);
}

/* Scrollspy underline. Scales from the centre so it reads as the link
   activating rather than a bar sliding in from one side. */
nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease-out);
}

nav a[aria-current="true"] {
  color: var(--ink);
}

nav a[aria-current="true"]::after {
  transform: scaleX(1);
}

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

.nav-doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  color: var(--ink-dim);
}

.nav-doc-icon:hover {
  border-color: var(--ink-mute);
  color: var(--ink);
}

.nav-cta {
  font-size: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  color: var(--ink);
  transition: var(--transition);
  font-weight: 500;
  background: transparent;
}

.nav-cta:hover {
  border-color: var(--ink-mute);
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 768px) {
  nav {
    display: none;
  }
}

/* ---------- Hero Section ---------- */
.hero {
  padding: 5.5rem 0 3.5rem;
  text-align: center;
}

.hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 700px;
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.eyebrow::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

/* Balance headings across their lines instead of letting the last line orphan a
   single word — the difference between a typeset headline and a wrapped string.
   `pretty` on body copy does the lighter version of the same job. */
h1, h2, h3, h4 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  color: var(--ink);
}

h1 span {
  display: block;
}

h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #f1b83f 0%, #ff8c00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  color: var(--ink-dim);
  font-size: 1rem;
  max-width: 50ch;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.cta-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 3.5rem;
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  cursor: pointer;
}

.btn-primary {
  background: #141416;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-primary:hover {
  border-color: var(--ink-mute);
  background: #1a1a1c;
}

.btn-secondary {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--ink-mute);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.01);
}


/* ---------- Releases Matrix Table ---------- */
.installer-matrix {
  padding: 4.5rem 0;
  border-top: 1px solid var(--line-soft);
}

.matrix-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.matrix-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
  background: #09090b;
  border: 1px solid var(--line-soft);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.filter-tab {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab:hover {
  color: var(--ink);
}

.filter-tab.active {
  background: var(--panel);
  color: var(--ink);
}

.table-container {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

th {
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #09090b;
}

td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  color: var(--ink-dim);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.table-os-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 0.6rem;
  vertical-align: middle;
}

.table-os-icon img {
  width: 12px;
  height: 12px;
  object-fit: contain;
}

.col-platform {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--ink);
}

.col-link a {
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.col-link a:hover {
  text-decoration: underline;
}

/* ---------- Platform Selection Grid ---------- */
.install {
  padding: 4rem 0;
  border-top: 1px solid var(--line-soft);
}

.install-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.01);
  border-radius: 99px;
  padding: 0.3rem 0.8rem;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.status-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.platform-grid.margin-bottom {
  margin-bottom: 3.5rem;
}

@media (max-width: 800px) {
  .platform-grid {
    grid-template-columns: 1fr;
  }
}

.platform-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--edge);
}

.platform-card:hover {
  transform: translateY(-2px);
  border-color: rgba(241, 184, 63, 0.2);
  box-shadow: var(--edge), var(--lift);
}

.platform-card.detected {
  border-color: var(--amber-dim);
  background: linear-gradient(180deg, rgba(241, 184, 63, 0.04) 0%, var(--panel) 100%);
}

.platform-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.platform-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.platform-icon img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.platform-name {
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--font-display);
  color: var(--ink);
}

.badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--amber);
  border: 1px solid var(--amber);
  background: rgba(241, 184, 63, 0.05);
  border-radius: 99px;
  padding: 0.15rem 0.5rem;
  display: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.platform-card.detected .badge {
  display: inline-block;
}

.platform-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.platform-links {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.link-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.7rem;
  transition: var(--transition);
}

.link-chip:hover {
  color: var(--ink);
  border-color: var(--ink-mute);
  background: rgba(255, 255, 255, 0.04);
}

.btn-download {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
}

.btn-download:hover {
  border-color: var(--ink-mute);
  background: var(--line);
}

.platform-card.detected .btn-download {
  background: var(--amber);
  border-color: var(--amber);
  color: #121215;
}

.platform-card.detected .btn-download:hover {
  background: #f4c764;
  border-color: #f4c764;
}

.linux-btn-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.btn-half {
  flex: 1;
}

.matrix-toggle {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.matrix-toggle:hover {
  border-color: var(--ink-mute);
  color: var(--ink);
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--line-soft);
  padding: 2.5rem 0;
  font-size: 0.78rem;
  color: var(--ink-mute);
  background: #040405;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.footer-links a {
  text-decoration: none;
  color: var(--ink-mute);
  transition: var(--transition);
}

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

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.api-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.api-status-dot.fallback {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

/* Spinner */
.spinner-sm {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
