/* ==========================================================================
   NVYLO BRAND SYSTEM — CAPSULE BOARD STYLESHEET
   Aesthetic, Human-Directed Capsule Color Palette & Interconnected Ribbon
   ========================================================================== */

:root {
  /* Brand Accents */
  --color-bright-cyan:   #40B6FA;
  --color-electric-blue: #0D7CFA;
  --color-royal-blue:    #2D65F6;
  --color-deep-blue:     #1D2F77;
  --color-violet:        #706CF8;
  --color-pink:          #CA7BFA;

  /* Brand Neutrals */
  --color-primary-black: #0A0A0B;
  --color-soft-black:    #141416;
  --color-dark-gray:     #18181B;
  --color-medium-gray:   #71717A;
  --color-light-gray:    #E5E7EB;
  --color-off-white:     #F7F7F8;
  --color-white:         #FFFFFF;

  /* Signature Gradient */
  --brand-gradient: linear-gradient(
    135deg,
    #40B6FA 0%,
    #0D7CFA 28%,
    #2D65F6 55%,
    #706CF8 78%,
    #CA7BFA 100%
  );

  /* Page & UI Chrome */
  --bg-page: #FBFBFC;
  --surface-card: #FFFFFF;
  --border-subtle: #ECECED;
  --border-strong: #DCDCDE;
  --text-primary: #0A0A0B;
  --text-secondary: #71717A;
  --text-muted: #A1A1AA;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Radii & Shadows */
  --radius-capsule: 9999px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-subtle: 0 4px 20px -2px rgba(10, 10, 11, 0.04), 0 2px 6px -1px rgba(10, 10, 11, 0.02);
  --shadow-capsule: 0 12px 28px -6px rgba(10, 10, 11, 0.1), 0 4px 12px -2px rgba(10, 10, 11, 0.04);
  --shadow-hover: 0 20px 38px -8px rgba(45, 101, 246, 0.22), 0 6px 16px -2px rgba(10, 10, 11, 0.06);
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ==========================================================================
   HEADER WITH NVYLO LOGO & QUICK CONTROLS
   ========================================================================== */
.brand-header {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.logo-box {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-shadow: 0 8px 20px -4px rgba(45, 101, 246, 0.15);
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-box:hover {
  transform: scale(1.05) rotate(-2deg);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-royal-blue);
  margin-bottom: 0.35rem;
}

.brand-name {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-primary-black);
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.brand-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 650px;
}

/* Controls Toolbar */
.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.format-picker {
  display: flex;
  align-items: center;
  background: var(--color-off-white);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.picker-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 0.5rem 0 0.4rem;
}

.picker-btn {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.picker-btn:hover {
  color: var(--text-primary);
}

.picker-btn.active {
  background: var(--color-white);
  color: var(--color-royal-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-white);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-tool:hover {
  border-color: var(--color-royal-blue);
  color: var(--color-royal-blue);
  box-shadow: 0 2px 6px rgba(45, 101, 246, 0.1);
}

/* ==========================================================================
   PALETTE STAGE CARDS
   ========================================================================== */
.palette-stage-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2.5rem;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.stage-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stage-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  align-self: flex-start;
}

.stage-badge.accent {
  background: rgba(45, 101, 246, 0.1);
  color: var(--color-royal-blue);
}

.stage-badge.gradient {
  background: rgba(112, 108, 248, 0.12);
  color: var(--color-violet);
}

.stage-badge.neutral {
  background: var(--color-off-white);
  color: var(--color-dark-gray);
  border: 1px solid var(--border-subtle);
}

.stage-badge.code {
  background: var(--color-primary-black);
  color: #FFFFFF;
}

.stage-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-primary-black);
}

.stage-tip {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--color-off-white);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   THE CAPSULE BOARD (COLUMNS: CAPSULE -> HEX -> SPHERE)
   Matching User's Reference Layout
   ========================================================================== */
.capsule-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 2rem 1.5rem;
  justify-items: center;
  padding: 1rem 0;
}

.capsule-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 150px;
  gap: 1.25rem;
  position: relative;
}

/* 1. The Tall Vertical Capsule Pill */
.capsule-pill-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.capsule-pill {
  width: 100%;
  height: 260px;
  border-radius: var(--radius-capsule);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-capsule);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.capsule-pill:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.capsule-pill:active {
  transform: translateY(-2px) scale(0.99);
}

/* Border for pure white and off-white capsules so they are distinct on light canvas */
.capsule-pill.bordered {
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.06);
}

/* Floating copy chip inside capsule on hover */
.capsule-copy-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  white-space: nowrap;
}

.capsule-pill:hover .capsule-copy-chip {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.capsule-pill.text-dark .capsule-copy-chip {
  background: #0A0A0B;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.capsule-pill.text-light .capsule-copy-chip {
  background: #FFFFFF;
  color: #0A0A0B;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 2. Middle Row: Value & Name */
.capsule-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  gap: 0.2rem;
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.capsule-meta:hover {
  background: var(--color-off-white);
}

.capsule-code {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-primary-black);
  transition: color 0.15s ease;
}

.capsule-meta:hover .capsule-code {
  color: var(--color-royal-blue);
}

.capsule-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.capsule-role {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* 3. Bottom Row: Gradient Circles / Spheres (from user's image) */
.capsule-sphere-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.capsule-sphere {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 16px -2px rgba(10, 10, 11, 0.1);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.capsule-sphere:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 24px -3px rgba(45, 101, 246, 0.28);
}

.capsule-sphere.bordered {
  border: 1.5px solid var(--border-strong);
}

.sphere-caption {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   CONTINUOUS INTERCONNECTED GRADIENT RIBBON
   ========================================================================== */
.btn-copy-gradient-strip {
  background: var(--color-primary-black);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-gradient-strip:hover {
  background: var(--color-royal-blue);
}

.continuous-ribbon-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.continuous-ribbon-bar {
  width: 100%;
  height: 140px;
  border-radius: var(--radius-lg);
  background: var(--brand-gradient);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ribbon-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  background: rgba(10, 10, 11, 0.45);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.ribbon-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.ribbon-code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

/* Interconnected Connected Blocks (0 gaps, contiguous) */
.interconnected-blocks-row {
  display: flex;
  width: 100%;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-subtle);
}

.interconnected-block {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: flex-grow 0.25s ease, filter 0.2s ease;
}

.interconnected-block:hover {
  flex-grow: 1.4;
  filter: brightness(1.05);
  z-index: 2;
}

.interconnected-block-hex {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.interconnected-block:hover .interconnected-block-hex {
  opacity: 1;
}

.interconnected-block.text-dark .interconnected-block-hex {
  color: #0A0A0B;
  background: rgba(255, 255, 255, 0.85);
}

.interconnected-block.text-light .interconnected-block-hex {
  color: #FFFFFF;
  background: rgba(10, 10, 11, 0.7);
}

/* ==========================================================================
   70 / 20 / 10 VISUAL RATIO
   ========================================================================== */
.ratio-pill-bar {
  display: flex;
  height: 72px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-subtle);
  border: 1px solid var(--border-subtle);
}

.ratio-part {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  color: #FFFFFF;
}

.neutral-part {
  background: var(--color-primary-black);
}

.blue-part {
  background: var(--color-royal-blue);
}

.gradient-part {
  background: var(--brand-gradient);
}

.ratio-num {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}

.ratio-title {
  font-size: 0.82rem;
  font-weight: 700;
}

.ratio-desc {
  font-size: 0.68rem;
  opacity: 0.8;
}

/* ==========================================================================
   CODE EXPORT TABS
   ========================================================================== */
.export-tabs {
  display: flex;
  background: var(--color-off-white);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.export-tab {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.export-tab.active {
  background: #FFFFFF;
  color: var(--color-royal-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  font-weight: 700;
}

.code-box {
  background: var(--color-primary-black);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #27272A;
}

.code-box-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background: var(--color-soft-black);
  border-bottom: 1px solid #27272A;
}

.code-box-filename {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #A1A1AA;
}

.btn-copy-snippet {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-snippet:hover {
  background: var(--color-royal-blue);
  border-color: var(--color-royal-blue);
}

.code-pre {
  padding: 1.25rem;
  margin: 0;
  overflow-x: auto;
  max-height: 280px;
}

.code-pre code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #F8FAFC;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.board-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem 0 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.footer-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--color-primary-black);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transform: translateY(120px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.26s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.toast-body {
  display: flex;
  flex-direction: column;
}

.toast-title {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.toast-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #A1A1AA;
}

.toast-chip {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
@media (max-width: 840px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .capsule-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .ratio-pill-bar {
    height: auto;
    flex-direction: column;
  }

  .ratio-part {
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 520px) {
  .capsule-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    justify-content: space-between;
  }
}
