/* ── PixlStash shared stylesheet: "The Quiet Darkroom" ──
   Dark-led, warm neutrals, one amber safelight accent. Unified brand palette:
   the accent/olive/raspberry/teal + status are the same in both themes; only the
   neutrals switch under [data-theme="light"]. Matches frontend/DESIGN.md. */

/* ── Design tokens ── */
:root {
  color-scheme: dark;
  /* neutrals (dark, default) */
  --bg: #1b1f24;
  --bg-2: #1b1f24;
  --panel: #23282f;
  --panel-strong: #2b3138;
  --border: #363d45;
  --divider: #2c323a;
  --text: #f2e5da;
  --muted: rgba(242, 229, 218, 0.6);
  --shadow: rgba(0, 0, 0, 0.5);
  --toolbar: #23282f;
  --toolbar-text: #f2e5da;
  --hover-wash: rgba(196, 122, 30, 0.12);
  /* brand + status (unified across both themes) */
  --accent: #c47a1e; /* amber, the one safelight */
  --accent-2: #e08a2a; /* brighter amber, glow / gradient end */
  --accent-3: #2a7d3e; /* success (e.g. "Copied") */
  --on-accent: #f7f1ea; /* warm-white label on any brand fill */
  --primary: #567309; /* olive, commit / go */
  --secondary: #bb3566; /* raspberry, category */
  --tertiary: #46707a; /* teal, quiet category */
  --logo-accent: #c47a1e; /* "Stash" wordmark = accent */
  --warning: #e8912f;
  /* type + shape */
  --mono: "IBM Plex Mono", "SFMono-Regular", "Consolas", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --radius-lg: 16px;
  --radius-md: 10px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f7;
  --bg-2: #faf9f7;
  --panel: #ffffff;
  --panel-strong: #efede9;
  --border: #d8d3c8;
  --divider: #e8e4dc;
  --text: #23211d;
  --muted: rgba(35, 33, 29, 0.6);
  --shadow: rgba(28, 22, 12, 0.18);
  --toolbar: #f0ede9;
  --toolbar-text: #23211d;
  --hover-wash: rgba(196, 122, 30, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  /* Warm canvas with one faint amber safelight glow, no cool greens. */
  background:
    radial-gradient(
      circle at 15% -5%,
      color-mix(in srgb, var(--accent) 14%, transparent),
      transparent 42%
    ),
    radial-gradient(
      circle at 92% 3%,
      color-mix(in srgb, var(--accent) 8%, transparent),
      transparent 40%
    ),
    var(--bg);
}

h1,
h2 {
  font-family: var(--display);
}

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

/* ── Shell ── */
.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px 16px 80px;
}

/* ── Nav ──
   DOM order (nav.js): brand (the home link), Home (direct child), .nav-links
   (the rest), .nav-actions. Desktop packs left after the brand, actions pushed
   right. Mobile: brand, theme toggle and Try demo on row 1; the page links
   wrap onto two centred rows below. */
.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  background: var(--toolbar);
  color: var(--toolbar-text);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 10px var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--toolbar-text);
  flex-shrink: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand-name {
  font-family: "Tiny5", monospace;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--toolbar-text);
}

/* "Stash" half of the wordmark in the amber accent. */
.brand-stash {
  color: var(--logo-accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.95rem;
  color: var(--toolbar-text);
}

.nav-link,
.nav-links a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  white-space: nowrap;
  transition:
    color 0.12s ease,
    background 0.12s ease;
}

.nav-link:hover,
.nav-links a:hover {
  color: var(--text);
  background: var(--hover-wash);
}

.nav-link--whatsnew {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Small amber dot promotes the release link without a second loud color. */
.nav-link--whatsnew::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.nav-link--active {
  color: var(--accent) !important;
  background: var(--hover-wash);
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The two header buttons, with the release-candidate link (nav.js) under
   them while one is in flight. */
.nav-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.nav-cta-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-edge-link {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.12s ease;
}
.nav-edge-link:hover,
.nav-edge-link:focus-visible {
  color: var(--accent);
}

/* Theme toggle: compact icon button; moon in dark, sun in light. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease,
    border-color 0.14s ease;
}
.theme-toggle:hover {
  background: var(--hover-wash);
  color: var(--text);
  border-color: var(--muted);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}
.theme-toggle .ic-sun {
  display: none;
}
.theme-toggle.is-light .ic-sun {
  display: block;
}
.theme-toggle.is-light .ic-moon {
  display: none;
}

.demo-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

/* Secondary: neutral ghost, so amber stays "the thing to do". */
.demo-btn {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.demo-btn:hover {
  background: var(--hover-wash);
  border-color: var(--muted);
}

/* Primary: the one amber safelight action. */
.download-btn {
  background: var(--accent);
  color: var(--on-accent);
}
/* Darken on hover (not brighten), because the amber accent is already near the
   contrast floor, so lightening it would drop the warm-white label below 3:1. */
.download-btn:hover {
  background: color-mix(in srgb, var(--accent) 86%, #000);
}

/* ── Page hero (inner pages) ── */
.page-hero {
  margin-top: 20px;
  margin-bottom: 24px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 14px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.page-hero p {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 auto 24px;
  max-width: 800px;
}

.page-hero .cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── Steps / instructions ── */
.method-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cmd-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.cmd-block code {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--text);
  flex: 1;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.55;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  transition: background 0.15s;
}

.copy-btn:hover {
  background: var(--hover-wash);
}

.copy-btn.copied {
  color: var(--accent-3);
}

.step-note {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}

.step-note a,
.step-note code {
  color: var(--accent);
}

.step-note a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.step-note a:hover {
  color: var(--accent-2);
}

.step-note code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--panel-strong);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ── Callout boxes ── */
.method-warning {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

.method-warning a {
  color: var(--warning);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.method-warning a:hover {
  color: var(--accent-2);
}

.method-info {
  background: color-mix(in srgb, var(--tertiary) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tertiary) 38%, transparent);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.55;
}

/* ── Page footer (inner pages) ── */
.page-footer {
  margin-top: 72px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

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

/* ── Feature sections ── */
.features {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-bottom: 40px;
}

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  max-width: 1000px;
  margin: 0 auto;
}

.feature--reverse {
  direction: rtl;
}

.feature--reverse > * {
  direction: ltr;
}

.feature-text {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.feature-number {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.feature-text h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.feature-text p {
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

/* ── Video card ── */
.video-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
  overflow: hidden;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.video-card video,
.video-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  max-height: 320px;
  object-fit: cover;
}

/* ── Responsive base ── */
@media (max-width: 760px) {
  .shell {
    padding: 8px 12px 60px;
  }

  /* Row 1 is the logo (the home link), the theme toggle and Try demo. Home and
     Install now are desktop-only: the logo already goes home, and the home page
     has its own install buttons. */
  /* Scoped to the header: pages use .download-btn for their own install
     buttons (comfyui.html), which must stay. */
  .nav .nav-link--home,
  .nav .download-btn {
    display: none;
  }
  .nav-actions {
    order: 2;
  }
  /* Only Try demo is left above it, so drop the lead-in to keep the link
     about as wide as that button. */
  .nav-edge-lead {
    display: none;
  }
  /* Every page link visible: wrap onto two centred rows rather than one row
     that scrolls three of them out of sight. */
  .nav-links {
    order: 3;
    flex-basis: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    padding-top: 10px;
    border-top: 1px solid var(--divider);
  }
  .nav-links a {
    padding: 6px 8px;
  }
}

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

  .feature--reverse {
    direction: ltr;
  }
}

@media (max-width: 480px) {
  .brand {
    gap: 8px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .brand-name {
    font-size: 1.4rem;
  }
}

/* Narrow phones (360px is the common Android width): a tighter gap keeps the
   logo, theme toggle and Try demo on one row, and a little less padding with
   the smaller link size keeps the page links to two rows. */
@media (max-width: 400px) {
  .nav {
    column-gap: 8px;
  }
  .nav-links {
    gap: 0;
  }
  .nav-links a {
    padding: 6px;
    font-size: 0.9rem;
  }
}

/* Visually hidden, still read aloud. Used for table captions and any label
   that a sighted reader gets from layout alone. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* App map: one screenshot with numbered pins on where each change lives
   (What's New and the home page launch block). Pins are teal because a pin
   identifies; amber stays on the key action. Positions are percentages of
   the screenshot, so a re-shoot means placing them again. */
.app-map {
  position: relative;
}

.app-map > img {
  display: block;
  width: 100%;
  height: auto;
}

.app-pin {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tertiary);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.app-map .app-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 3px rgba(27, 31, 36, 0.85),
    0 4px 12px var(--shadow);
  pointer-events: none;
}

.app-ring {
  position: absolute;
  border: 2px solid var(--tertiary);
  border-radius: 8px;
  box-shadow: 0 0 0 2px rgba(27, 31, 36, 0.6);
  pointer-events: none;
}

@media (max-width: 700px) {
  .app-map .app-pin {
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
  }
}
