/* BucketBrowser download page.
   Self-contained: no @import, no web fonts, no remote resources.
   Colours are checked for WCAG AA (>= 4.5:1 body text, >= 3:1 UI borders)
   in both the light and the dark theme. */

:root {
  color-scheme: light dark;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --radius: 8px;
  --radius-sm: 4px;
  --measure: 68ch;
  --page-max: 60rem;

  /* Light theme */
  --bg: #ffffff;
  --surface: #f2f5f8;
  --surface-2: #e7ecf1;
  --fg: #16202a;
  --fg-muted: #4f5b67;
  --border: #c3ccd6;
  --border-strong: #8d99a6;
  --accent: #0b5fb0;
  --accent-fg: #ffffff;
  --accent-hover: #084a8a;
  --focus: #0b5fb0;
  --callout-note: #0b5fb0;
  --callout-warn: #9a4a00;
  --callout-danger: #a3121b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151b;
    --surface: #1a222b;
    --surface-2: #232d38;
    --fg: #e8edf2;
    --fg-muted: #a4b1bd;
    --border: #3a4652;
    --border-strong: #6b7885;
    --accent: #6cb6ff;
    --accent-fg: #10151b;
    --accent-hover: #9acbff;
    --focus: #6cb6ff;
    --callout-note: #6cb6ff;
    --callout-warn: #f0a85e;
    --callout-danger: #ff9a9a;
  }
}

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

html {
  /* Anchor targets are not hidden under the sticky site nav. */
  scroll-padding-top: var(--space-7);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

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

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--space-4) var(--space-8);
}

section {
  margin-top: var(--space-7);
  scroll-margin-top: var(--space-5);
}

p,
li {
  max-width: var(--measure);
}

/* ---------- Typography ---------- */

h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
  margin: 0 0 var(--space-3);
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
  margin-top: 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-5);
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9375em;
}

code {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
  /* Object keys, hashes and keys are long and must never force a
     horizontal scrollbar on a 360 px viewport. */
  overflow-wrap: anywhere;
}

kbd {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 0.05em 0.4em;
  font-size: 0.875em;
  white-space: nowrap;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin: 0 0 var(--space-4);
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  overflow-wrap: normal;
  white-space: pre;
}

ol,
ul {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

/* ---------- Focus and skip link ---------- */

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--focus);
  border-radius: var(--radius);
  transform: translateY(-250%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Site nav ---------- */

.site-nav {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.site-nav ul {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-2) var(--space-4);
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-size: var(--text-sm);
}

.site-nav li {
  margin: 0;
  max-width: none;
}

.site-nav a {
  display: inline-block;
  padding: var(--space-1) 0;
}

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

.hero {
  margin-top: var(--space-6);
}

.hero > p:first-of-type {
  font-size: var(--text-lg);
  color: var(--fg-muted);
}

.release-meta {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  margin-bottom: var(--space-5);
}

.downloads {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-5);
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.downloads > li {
  margin: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.btn {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-hover);
  color: var(--accent-fg);
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--border-strong);
  text-decoration: underline;
}

.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--accent-hover);
}

/* Set by os-detect.js on the card matching the visitor's platform.
   Marked with text, not colour alone (see .detected-tag). */
.downloads > li.is-detected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.detected-tag {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.file-meta {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.file-meta code {
  color: var(--fg);
}

/* ---------- Callouts ---------- */

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--callout-note);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space-4);
  margin: 0 0 var(--space-5);
  max-width: var(--measure);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: var(--space-1);
}

.callout-warn {
  border-left-color: var(--callout-warn);
}

.callout-danger {
  border-left-color: var(--callout-danger);
}

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--space-4);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: var(--text-sm);
}

caption {
  text-align: left;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  padding-bottom: var(--space-2);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

thead th {
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

tbody th {
  font-weight: 600;
}

td code {
  background: none;
  padding: 0;
  color: var(--fg);
}

/* ---------- Figures ---------- */

figure {
  margin: 0 0 var(--space-5);
  max-width: 34rem;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Real OS dialog screenshots are small; show them at their own size
   (never upscaled and blurred), shrinking only on narrow screens. */
.figure-dialog img {
  width: auto;
  max-width: 100%;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  padding-top: var(--space-2);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* ---------- Small screens ---------- */

@media (max-width: 30rem) {
  :root {
    --text-3xl: 1.75rem;
    --text-2xl: 1.375rem;
    --text-xl: 1.125rem;
  }

  .page {
    padding: 0 var(--space-3) var(--space-7);
  }

  .site-nav ul {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  table {
    min-width: 0;
  }
}

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