/*
 * Purple Industries — Main site stylesheet (CANONICAL REFERENCE)
 * ==============================================================
 * This is the design system source of truth. All other pages
 * (privacy, operator, signer, logistics, stocks) must stay aligned.
 *
 * LAYOUT
 *   Shell:    .page-shell — width min(1120px, calc(100vw - 24px)), centered, pad 24px 0 40px
 *   Hero:     .hero — pad 32px, radius 28px, backdrop-filter blur(16px), bg --paper, border --paper-border
 *   Cards:    .app-card — pad 24px, radius 24px, 3×1fr grid ≥860px, single col below
 *   Footer:   .site-footer — "Purple Industries © 2026", 0.78rem, centered, muted
 *
 * UTILITY-LINKS ROW (above hero, every page)
 *   .utility-links — flex, gap 14px, mb 12px, 0.88rem weight 400
 *   Left: "Purple Industries" + "Privacy Policy" links (color --muted)
 *   Right: theme toggle (margin-left auto, same 0.88rem, no uppercase)
 *
 * COLOURS — purple accent in BOTH modes, no orange anywhere
 *   Dark:  --purple #a78bfa  --accent-text #a78bfa  CTA gradient #a78bfa→#8b5cf6
 *   Light: --purple #7c3aed  --accent-text #7a2bc0  CTA gradient #7c3aed→#6d28d9
 *   --ink #f4f7fb / #1b2430    --muted #c7d2df / #5c6472
 *
 * TYPOGRAPHY
 *   Font stack:  "Avenir Next", "Segoe UI", sans-serif (on html)
 *   Eyebrow:     0.78rem, weight 700, letter-spacing 0.14em, uppercase, color --purple
 *   Hero h1:     clamp(2.4rem, 7vw, 4.8rem), line-height 0.95, letter-spacing -0.05em
 *   Hero copy:   1.06rem
 *   Card h2:     1.55rem
 *   Footer:      0.78rem
 *
 * BACKGROUND (dark canonical)
 *   radial-gradient(circle at top left, rgba(255,155,105,0.18), transparent 28%),
 *   radial-gradient(circle at top right, rgba(159,173,255,0.16), transparent 26%),
 *   linear-gradient(180deg, #16212c 0%, #0c1219 44%, #090d12 100%)
 *
 * SHADOW
 *   --shadow: 0 24px 60px rgba(0,0,0,0.38) dark / rgba(22,35,45,0.14) light
 *
 * THEME
 *   Dark mode default (:root). Light mode via :root[data-theme="light"].
 *   Theme toggle uses shared theme.js with cross-subdomain cookie.
 */
:root {
  color-scheme: dark;
  --bg: #0c1219;
  --page-background:
    radial-gradient(circle at top left, rgba(255, 155, 105, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(159, 173, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #16212c 0%, #0c1219 44%, #090d12 100%);
  --paper: rgba(13, 20, 29, 0.9);
  --paper-border: rgba(182, 205, 226, 0.18);
  --surface: rgba(255, 255, 255, 0.05);
  --ink: #f4f7fb;
  --muted: #c7d2df;
  --line: rgba(199, 210, 223, 0.22);
  --purple: #a78bfa;
  --accent-text: #a78bfa;
  --indigo: #9fadff;
  --mint: #7fe5b8;
  --slate: #8ec8eb;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

html {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  overflow-y: scroll; /* canonical — force permanent scrollbar so content never shifts; all sub-sites must match */
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe8;
  --page-background:
    radial-gradient(circle at top left, rgba(204, 93, 52, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(69, 86, 166, 0.14), transparent 26%),
    linear-gradient(180deg, #dce6f2 0%, #f4efe8 42%, #f7f3ee 100%);
  --paper: rgba(255, 252, 248, 0.92);
  --paper-border: rgba(255, 255, 255, 0.6);
  --surface: rgba(255, 255, 255, 0.72);
  --ink: #1b2430;
  --muted: #5c6472;
  --line: rgba(27, 36, 48, 0.14);
  --purple: #7c3aed;
  --accent-text: #7a2bc0;
  --indigo: #4556a6;
  --mint: #1a7d69;
  --slate: #2f4c61;
  --shadow: 0 24px 60px rgba(22, 35, 45, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page-background);
}

body {
  min-height: 100vh;
  color: var(--ink);
}

body,
.hero,
.app-card,
.site-footer,
.primary-link,
.secondary-link,
.theme-toggle,
.admin-console-link {
  transition:
    background-color 120ms ease,
    color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
}

a {
  color: inherit;
}

/* ── Canonical container — all sub-sites must use these exact values ── */
.page-shell {
  width: min(1120px, calc(100vw - 24px)); /* canonical max-width + gutter */
  margin: 0 auto; /* canonical centering */
  padding: 24px 0 40px; /* canonical vertical spacing */
}

.utility-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.utility-links a {
  color: var(--muted);
  text-decoration: none;
}

.utility-links a:hover,
.utility-links a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.utility-links .theme-toggle {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.88rem;
  color: var(--muted);
}

.theme-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent-text);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
  border-radius: 999px;
}

/* ── Canonical card surface — all sub-sites must replicate these four lines ── */
.hero,
.app-card {
  background: var(--paper);
  border: 1px solid var(--paper-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  padding: 32px; /* hero-level padding; toolbars/panels may use 18px but card surface stays the same */
  border-radius: 28px; /* hero radius; cards/panels use 24px */
}

.eyebrow,
.card-tag {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
}

.eyebrow {
  color: var(--purple);
}

/* CHANGED 2026-03-22: Main-page-only exception to canonical eyebrow sizing.
   Doubles "Purple Industries" text above "Intelligent Systems Integration". */
.hero .main-hero-eyebrow {
  font-size: 1.56rem;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-copy {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.primary-link {
  background: linear-gradient(135deg, var(--purple) 0%, #8b5cf6 100%);
  color: white;
}

.secondary-link {
  background: var(--surface);
  border: 1px solid var(--line);
}

/* CHANGED 2026-03-22: Even spacing between hero → video-card → content-grid.
 * All three vertical gaps (hero→video, video→cards) use the same 24px margin
 * so the video section sits centred with equal breathing room above and below.
 * Previously 18px; bumped to 24px to match .page-shell vertical padding.
 *
 * SLOT SYSTEM NOTE: The .video-card class is reusable for any admin-managed
 * video placement on the site. Clone the <section class="video-card"> and
 * matching <script> block to add another placement, then wire it to the
 * appropriate public config endpoint in the worker.
 */
.video-card {
  margin-top: 24px;
  margin-bottom: 24px;
  min-height: 200px;
  overflow: visible;
}

.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: visible;
  border-radius: 0;
}

/*
 * The homepage cards below the featured video should keep the same visual
 * centreline as the video stage. The content grid already lives inside the
 * centred page shell, so we make that alignment explicit here for future edits.
 */
.content-grid {
  margin-left: auto;
  margin-right: auto;
}

/* CHANGED 2026-03-22: Volume-locked state — hides ALL native browser controls
 * when the admin has disabled client volume control. The video still plays
 * audio at the admin-set level, but the viewer has no visible controls.
 * The controls attribute is also removed via JS; this CSS is a double-safety.
 *
 * ADMIN CONFIG: volume (0–100), volumeControlEnabled (boolean).
 * Set from admin console → Main Page Video 1 → "Default volume" slider
 * and "Allow client volume control" checkbox.
 */
video.volume-locked::-webkit-media-controls-volume-slider,
video.volume-locked::-webkit-media-controls-mute-button,
video.volume-locked::-webkit-media-controls-panel,
video.volume-locked::-webkit-media-controls {
  display: none !important;
  -webkit-appearance: none;
}

.content-grid {
  display: grid;
  gap: 16px;
  margin-top: 0;
}

.app-card {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 24px;
}

.app-card > a:last-child {
  margin-top: auto;
}

.app-card h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
}

.app-card p,
.app-card li {
  color: var(--muted);
}

.app-card ul {
  padding-left: 18px;
  margin: 16px 0 20px;
}

.app-card a {
  font-weight: 700;
  text-decoration: none;
}

.accent-purple .card-tag,
.accent-purple a {
  color: var(--accent-text);
}

.accent-purple {
  background:
    linear-gradient(180deg, rgba(167, 139, 250, 0.06), transparent 100%),
    var(--paper);
}

.accent-indigo .card-tag,
.accent-indigo a {
  color: var(--indigo);
}

.accent-indigo {
  background:
    linear-gradient(180deg, rgba(69, 86, 166, 0.06), transparent 100%),
    var(--paper);
}

.accent-mint .card-tag,
.accent-mint a {
  color: var(--mint);
}

.accent-mint {
  background:
    linear-gradient(180deg, rgba(26, 125, 105, 0.08), transparent 100%),
    var(--paper);
}

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.site-footer p {
  margin: 0;
}

.footer-admin-row {
  margin-top: 10px;
}

.admin-console-link {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.28;
  transition: opacity 140ms ease;
}

.admin-console-link:hover,
.admin-console-link:focus-visible {
  opacity: 0.72;
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100vw - 16px);
    padding-top: 16px;
  }

  .video-card {
    margin-top: 20px;
    margin-bottom: 24px;
  }

  .content-grid {
    gap: 14px;
    margin-top: 0;
  }

  .app-card {
    padding: 20px;
  }

  /*
   * Mobile keeps the video stage comfortable to view: the JS swaps configured
   * ultra-wide banners into a cropped viewport-sized frame on small screens, so
   * the shell below should stay tight and centred rather than adding extra drift.
   */
  .content-grid,
  .hero {
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 860px) {
  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
