/* FunnelStory pitch deck. the principle chain and its sections.
   Colors read from tokens.css only, so both themes stay correct. */

/* --------------------------------------------------------------------------
   Lead-in line above the chain
   -------------------------------------------------------------------------- */
/* Clear the fixed theme switch at the top right. */
.role-target { padding-top: var(--space-7); }

.principle-lead {
  margin-top: var(--space-6);
  margin-bottom: var(--space-5);
  font-size: var(--text-lead);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   The chain. Each word is the tab for its section.
   -------------------------------------------------------------------------- */
.chain {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: clamp(0.35rem, 1.2vw, 0.9rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.chain > li { display: flex; align-items: baseline; }

.chain-word {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.4vw, 3.5rem);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-display);
  color: var(--text-subtle);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

.chain-word:hover { color: var(--text-muted); }
.chain-word:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: var(--radius-sm); }

.chain-word[aria-selected="true"] {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  border-bottom-color: var(--accent-magenta);
}

.chain-sep {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 3.6vw, 2.25rem);
  font-weight: var(--weight-medium);
  line-height: var(--leading-display);
  color: var(--text-subtle);
  user-select: none;
}

/* --------------------------------------------------------------------------
   The section under discussion
   -------------------------------------------------------------------------- */
.chain-deck {
  display: flex;
  flex-direction: column;
  min-height: min(70svh, 720px);
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* The open panel takes the height that the prev / next row leaves. */
.chain-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  margin: 0;
  min-width: 0;
}

/* The flex rule above beats the browser default for [hidden], so restate it. */
.chain-panel[hidden] { display: none; }

/* Section content runs the full width of the card. */
.chain-panel-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.chain-panel-body > p + p { margin-top: var(--space-3); }

.chain-placeholder {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: 12rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-subtle);
  text-align: center;
  padding: var(--space-5);
}

/* --------------------------------------------------------------------------
   Prev / next at the foot of the section
   -------------------------------------------------------------------------- */
.chain-steps {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.chain-step {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.chain-step:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.chain-step:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chain-step:disabled { opacity: 0.35; cursor: not-allowed; }
.chain-step svg { width: 20px; height: 20px; }

.chain-count {
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Tablet and small laptop
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .chain-deck {
    min-height: min(64svh, 560px);
    margin-bottom: var(--space-7);
    padding: var(--space-5);
  }
  .principle-lead { margin-bottom: var(--space-4); }
}

/* --------------------------------------------------------------------------
   Phone. The chain wraps, because one line cannot hold four words.
   -------------------------------------------------------------------------- */
@media (max-width: 560px) {
  /* The theme switch drops to icons only, so it needs less room. */
  .theme-label { display: none; }
  .theme-toggle button { padding: 0.45rem; }
  .role-target { padding-top: var(--space-6); }

  .chain {
    flex-wrap: wrap;
    row-gap: var(--space-1);
    column-gap: var(--space-3);
  }
  .chain-word { font-size: clamp(1.625rem, 8.5vw, 2.25rem); }
  .chain-sep { font-size: clamp(1.125rem, 5vw, 1.5rem); }

  .chain-deck {
    min-height: min(58svh, 460px);
    padding: var(--space-4);
    border-radius: var(--radius-md);
  }
  .chain-placeholder { min-height: 10rem; padding: var(--space-4); }
  .chain-steps { margin-top: var(--space-5); }
}

/* Short screens, such as a phone in landscape. */
@media (max-height: 520px) {
  .chain-deck { min-height: 0; }
  .chain-placeholder { min-height: 8rem; }
}
