/* ==========================================
   With Silex — Apple Dark-Glass Design System
   Optical Typography & Translucent Surfaces
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-dark: #05070b;
  --bg-card: rgba(14, 18, 25, 0.74);
  --bg-input: rgba(10, 14, 20, 0.88);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(57, 255, 20, 0.30);
  --text-main: #f4f4f5;
  --text-body: #d4d4d8;
  --text-muted: #a1a1aa;
  --accent-cyan: #39ff14;
  --accent-soft: #6ee7b7;
  --accent-glow: rgba(57, 255, 20, 0.12);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Plus Jakarta Sans', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.58;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: 110px;
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image:
    radial-gradient(ellipse 75% 42% at 50% -10%, rgba(57, 255, 20, 0.075) 0%, transparent 62%),
    radial-gradient(ellipse 52% 38% at 15% 42%, rgba(56, 189, 248, 0.045) 0%, transparent 58%);
  background-attachment: fixed;
}

/* Phase 10.2W: Prevent flex-column intrinsic max-content blowout masked by overflow-x:hidden */
body > main,
body > header,
body > section,
body > article,
body > footer,
body > nav,
body > div {
  max-width: 100%;
  min-width: 0;
}

main,
section,
article,
aside,
.wrap,
.shell {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

:not(pre) > code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

h1 {
  font-size: 2.25rem;
  font-size: clamp(1.65rem, 3.6vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--text-main);
  overflow-wrap: break-word;
}

h2 {
  font-size: 1.45rem;
  font-size: clamp(1.22rem, 2.2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.22;
  color: var(--text-main);
  overflow-wrap: break-word;
}

h3 {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

/* --- Unified Apple Translucent Header (Zero-CLS Reserved Slots) --- */
body:has(#sx-global-nav) #sx-tv-remote-nav {
  position: relative;
  top: auto;
  z-index: 940;
  height: 43px;
  min-height: 43px;
  overflow: hidden;
  padding: 5px 18px;
  box-sizing: border-box;
}
body:has(#sx-global-nav) #sx-tv-remote-nav .sx-tv-brand,
body:has(#sx-global-nav) #sx-tv-remote-nav .sx-tv-doors {
  display: none;
}

.sx-lumen-glass-bar {
  max-width: 860px;
  width: 100%;
  margin: 16px auto;
  padding: 12px 14px;
  border-radius: 18px;
  background-color: #07120c;
  background: rgba(7, 18, 12, 0.90);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1.5px solid rgba(57, 255, 20, 0.42);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sx-lumen-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}
.sx-lumen-bar-input {
  flex: 1 1 200px;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(57, 255, 20, 0.34);
  background: #050a07;
  color: #ffffff;
  font-size: 0.92rem;
  box-sizing: border-box;
}
.sx-lumen-btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 0;
  background: #39ff14;
  color: #050807;
  font-weight: 900;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}
.sx-lumen-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(57, 255, 20, 0.46);
  background: #08120c;
  color: #39ff14;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
}
.sx-lumen-voice-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(56, 189, 248, 0.5);
  background: #07131d;
  color: #e2e8f0;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .sx-lumen-glass-bar { padding: 10px; }
  .sx-lumen-bar-row { flex-direction: column; align-items: stretch; }
  .sx-lumen-btn-neon, .sx-lumen-btn-ghost, .sx-lumen-voice-pill { width: 100%; }
}

#sx-global-nav {
  width: 100%;
  min-height: 59px;
  box-sizing: border-box;
  display: flow-root;
}

.sx-navbar {
  position: relative;
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 0 20px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  background-color: #080b10;
  background: rgba(8, 11, 16, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.sx-nav-brand {
  font-family: 'Space Grotesk', 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-weight: 800;
  font-size: 1.02rem;
  color: #f8faf9;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.03em;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.sx-nav-brand .sx-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 7px;
  background: rgba(57, 255, 20, 0.14);
  border: 1.5px solid rgba(57, 255, 20, 0.68);
  color: #39ff14;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.28);
  flex-shrink: 0;
}

.sx-nav-brand .sx-brand-wordmark {
  color: #f8faf9;
  font-family: 'Space Grotesk', 'Outfit', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.sx-nav-brand strong,
.sx-nav-brand .sx-brand-accent {
  color: #39ff14;
  font-weight: 800;
}

.sx-nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.85rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.sx-nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.16s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.sx-nav-links button,
.sx-nav-links span {
  flex-shrink: 0;
  white-space: nowrap;
}

.sx-nav-links a:hover,
.sx-nav-links a.active {
  color: var(--text-main);
}

/* --- Hero Architecture --- */
.sx-hero {
  text-align: center;
  max-width: 1120px;
  width: 100%;
  padding: 40px 20px 24px;
  margin: 0 auto 24px;
}

.sx-logo {
  font-size: 2.4rem;
  font-size: clamp(1.85rem, 4.4vw, 3.45rem);
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(180deg, #ffffff 30%, #a7f3d0 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.sx-tagline {
  font-size: 1.25rem;
  font-size: clamp(1.08rem, 2.2vw, 1.55rem);
  font-weight: 500;
  color: #e4e4e7;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.sx-description {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.62;
}

/* --- Precision Trust Metrics --- */
.sx-trust-bar {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.sx-trust-metric {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sx-trust-metric strong {
  color: var(--accent-soft);
  font-weight: 600;
  font-family: var(--font-mono);
}

/* --- Clean, Centered Main Container --- */
.sx-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

#sx-sandbox-container {
  width: 100% !important;
  margin: 15px auto 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  position: relative !important;
}

#sx-sandbox-container .silex-gate,
#sx-sandbox-container .silex-card,
#sx-sandbox-container .silex-modal {
  margin: 0 auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  position: relative !important;
}

#sx-sandbox-container .silex-content {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.sx-demo-section,
.sx-generator-section {
  background-color: #0e1219;
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 30px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 22px 54px rgba(0, 0, 0, 0.52);
  transition: border-color 0.2s ease, transform 0.2s ease;
  max-width: 100%;
  min-width: 0;
}

.sx-demo-section:hover,
.sx-generator-section:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.sx-section-title {
  font-size: 1.35rem;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.sx-section-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.56;
}

/* --- Form Architecture --- */
.sx-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sx-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sx-input-group label,
.sx-output-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.sx-input-group input,
.sx-input-group textarea,
.sx-input-group select {
  background-color: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  padding: 13px 15px;
  color: var(--text-main);
  font-size: 0.94rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.16s ease;
}

.sx-input-group input:focus,
.sx-input-group textarea:focus,
.sx-input-group select:focus {
  border-color: rgba(57, 255, 20, 0.45);
  box-shadow: 0 0 0 3px rgba(57, 255, 20, 0.12);
}

/* --- Selection Cards --- */
.sx-card-select-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.sx-card-option,
.sx-showcase-tile {
  position: relative;
  background: rgba(14, 18, 25, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease;
  text-align: left;
}

.sx-card-option input[type="radio"] {
  display: none;
}

.sx-card-option:hover,
.sx-showcase-tile:hover {
  border-color: rgba(57, 255, 20, 0.30);
  transform: translateY(-2px);
}

.sx-card-option.active,
.sx-showcase-tile.active {
  border-color: rgba(57, 255, 20, 0.45);
  background: rgba(57, 255, 20, 0.07);
}

.sx-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
}

.sx-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Primary Action CTA --- */
.silex-unlock-btn,
.sx-pay-btn {
  width: 100%;
  background: #39ff14;
  color: #050807;
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
  box-shadow: 0 6px 20px rgba(57, 255, 20, 0.22);
  letter-spacing: -0.01em;
}

.silex-unlock-btn:hover,
.sx-pay-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.silex-link-btn {
  background: none;
  border: none;
  color: var(--accent-soft);
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: 500;
  transition: opacity 0.16s ease;
}

.silex-link-btn:hover {
  opacity: 0.85;
  text-decoration: underline;
}

/* --- Code Blocks --- */
.sx-output-group pre {
  background-color: #070a0f;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.sx-output-group code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #6ee7b7;
}

/* --- Footer --- */
.sx-footer {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
  max-width: 1120px;
  margin: 48px auto 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sx-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.16s ease;
}

.sx-footer a:hover {
  color: var(--accent-soft);
}

@media (max-width: 860px) {
  #sx-global-nav {
    min-height: 88px;
  }
  .sx-generator-section,
  .sx-demo-section {
    padding: 20px 16px;
  }
}

/* Phase 10.2W — Universal Viewport Fit (280px Fold / 320px iPod -> Mobile -> HUD -> 4K) */
@media (max-width: 640px), (hover: none) and (pointer: coarse) {
  .sx-search-kbd,
  .sx-cmd-kbd,
  kbd[data-sx-desktop-only] {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .sx-container {
    padding: 0 14px;
  }
  .sx-hero {
    padding: 26px 14px 18px;
  }
  .sx-lumen-btn-neon,
  .sx-lumen-btn-ghost,
  .sx-lumen-voice-pill {
    white-space: normal;
    text-align: center;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  .sx-container {
    padding: 0 10px;
  }
  .sx-hero {
    padding: 20px 10px 14px;
  }
  .sx-generator-section,
  .sx-demo-section {
    padding: 16px 12px;
  }
  .sx-card-select-group {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 300px) {
  .sx-container {
    padding: 0 8px;
  }
  .sx-generator-section,
  .sx-demo-section {
    padding: 12px 10px;
  }
}

/* Smart Glasses HUD, E-Ink & Reduced-Motion / High-Contrast Compatibility */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: more) {
  html,
  body {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
  }
  .sx-navbar,
  .sx-demo-section,
  .sx-generator-section,
  .sx-lumen-glass-bar,
  .sx-card-option,
  .sx-showcase-tile {
    background: #000000 !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: 2px solid #34d399 !important;
    color: #ffffff !important;
    box-shadow: none !important;
  }
  .sx-logo {
    background: none !important;
    -webkit-text-fill-color: #ffffff !important;
    color: #ffffff !important;
  }
  p,
  li,
  .sx-description,
  .sx-section-subtitle,
  .sx-card-desc,
  .sx-trust-metric {
    color: #ffffff !important;
  }
  a,
  .sx-trust-metric strong,
  .silex-link-btn {
    color: #34d399 !important;
  }
}
