/*
 * 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.modal-open {
  overflow: hidden;
}

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 {
  position: relative;
  padding: 32px;
  padding-bottom: 112px;
  border-radius: 28px;
}

/* ── Hero hamburger menu ─────────────────────────────────────────────
 * Three-dash icon in the upper-right of the hero card. Toggles a
 * dropdown with secondary service links (Signatures, Videos, Stocks,
 * Kubernetes). Primary CTA (Logistics) stays visible outside the menu.
 */
.hero-menu-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s;
}
.hero-menu-toggle:hover {
  background: var(--paper-border);
}
.hero-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
/* Animate to X when open */
.hero-menu-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.hero-menu-toggle.open span:nth-child(2) {
  opacity: 0;
}
.hero-menu-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hero-menu {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.hero-menu.open {
  display: flex;
  animation: hero-menu-slide 0.25s ease-out;
}
@keyframes hero-menu-slide {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.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 {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 32px;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 0;
}

.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);
}

button.secondary-link,
button.primary-link {
  cursor: pointer;
}

button.primary-link {
  border: 0;
  appearance: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* 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 "video slot" on
 * the site. Each slot gets its config from a separate admin endpoint (e.g.
 * /api/public/video-slot/main-page-video-1). Clone the <section class="video-card">
 * and matching <script> block to add a video anywhere. See admin console for controls.
 *
 * Deploy source: git → Cloudflare Pages (wrangler pages deploy site) */
.video-card {
  margin-top: 24px;
  margin-bottom: 32px;
  min-height: 200px;
}

.video-card .video-placeholder-text {
  color: var(--muted);
  text-align: center;
  padding: 48px 24px;
  font-size: 1.06rem;
}

.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 0;
}

/* 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.
 *
 * Deploy source: git → Cloudflare Pages (wrangler pages deploy site) */
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);
}

.contact-section {
  margin-top: 24px;
  gap: 20px;
}

.contact-section-copy p:last-child {
  margin-bottom: 0;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.contact-field span,
.contact-captcha-label,
.contact-email-reveal span {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.contact-field-full {
  grid-column: 1 / -1;
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  padding: 14px 16px;
  font: inherit;
  resize: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--muted);
}

.contact-field input:focus-visible,
.contact-field textarea:focus-visible,
.contact-submit-button:focus-visible,
.hero-contact-button:focus-visible,
.contact-modal-close:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.contact-captcha-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
}

.contact-captcha-block > div {
  width: min(100%, 340px);
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

#contact-form-altcha-host,
#contact-reveal-altcha-host {
  min-height: 72px;
}

.contact-form-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.contact-submit-button {
  margin-top: 4px;
}

.contact-submit-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.contact-form-status,
.contact-reveal-status {
  margin: 0;
  color: var(--muted);
}

.contact-form-status[data-state="error"],
.contact-reveal-status[data-state="error"] {
  color: #ffb4b4;
}

.contact-form-status[data-state="success"],
.contact-reveal-status[data-state="success"] {
  color: var(--mint);
}

.contact-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
}

.contact-modal[hidden] {
  display: none;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 10, 14, 0.72);
  backdrop-filter: blur(6px);
}

.contact-modal-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 24px;
  background: var(--paper);
  border: 1px solid var(--paper-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.contact-modal-copy {
  margin-top: 0;
  margin-bottom: 16px;
}

.contact-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.contact-modal-panel #contact-reveal-altcha-host {
  width: min(100%, 340px);
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.contact-reveal-status {
  margin-top: 14px;
}

.contact-email-reveal {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.contact-email-reveal strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
}

.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;
  }

  .hero {
    padding-bottom: 28px;
  }

  .hero-actions {
    position: static;
    margin-top: 16px;
  }

  .hero-actions {
    flex-wrap: wrap;
  }

  .content-grid {
    gap: 14px;
    margin-top: 0;
  }

  .app-card {
    padding: 20px;
  }

  .contact-field-full {
    grid-column: auto;
  }
}

@media (min-width: 860px) {
  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
