/* Fables Library · Color Garden legacy adapter
   Bridges this mature Garden's existing class names to the shared Learning Bot UI tokens.
   Garden-specific illustrations, experiments, level control, and state logic remain local.

   Cascade contract:
   - This file loads after the Garden <style> blocks and the global UI system.
   - Equal-specificity rules here win. Later ID or !important rules in the Garden still win.
   - Do not combine :hover and :focus-visible in one declaration when both set box-shadow.
     The hover shadow otherwise deletes the focus ring.
   - Accepted local exceptions: picture-guide and animal-color entry cards keep their card chrome;
     #grayActivitySection quiz buttons stay compact (ID + !important); the level send control stays a circle. */

/* Shell / overflow safety supplied by the global system. */
body.fl-bot,
.fl-shell,
.fl-content { min-width: 0; max-width: 100%; }

/* Existing Color Garden command buttons adopt the shared command grammar.
   Entry cards already carry .secondary, so they never match this primary rule.
   Do not add further :not() exclusions here: each one raises specificity and
   lets this rule beat the later choice override. */
.action-btn {
  max-width: 100%;
  min-width: 0;
  min-height: var(--fl-control-height);
  border-radius: var(--fl-radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fl-inline-gap);
  font-family: 'Nunito Sans', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .01em;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.action-btn:not(.secondary) {
  border: 1.5px solid var(--fl-primary-bg);
  background: var(--fl-primary-bg);
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,58,46,.16);
}
.action-btn:not(.secondary):hover:not(:disabled) {
  border-color: var(--fl-primary-hover);
  background: var(--fl-primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26,58,46,.20);
}
.action-btn:not(.secondary):active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26,58,46,.14);
}

.action-btn.secondary {
  border: 1.5px solid var(--fl-secondary-border);
  background: var(--fl-secondary-bg);
  color: var(--fl-forest-dark);
  box-shadow: none;
}
.action-btn.secondary:hover:not(:disabled) {
  border-color: var(--fl-secondary-border-hover);
  background: var(--fl-secondary-hover);
  color: var(--fl-forest-deep);
  transform: translateY(-1px);
  box-shadow: none;
}
.action-btn.secondary:active:not(:disabled) {
  transform: translateY(0);
}

.action-btn:disabled {
  opacity: .52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Peer answers are choices, not competing primary actions. */
.choice-button-group .action-btn,
.artist-secret-choice-row .action-btn {
  position: relative;
  border: 1.5px solid var(--fl-choice-border);
  border-radius: var(--fl-radius-choice);
  background: var(--fl-choice-bg);
  color: var(--fl-forest-dark);
  box-shadow: none;
}
.choice-button-group .action-btn:hover:not(:disabled),
.artist-secret-choice-row .action-btn:hover:not(:disabled) {
  border-color: var(--fl-gold);
  background: var(--fl-choice-bg-hover);
  color: var(--fl-forest-deep);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(26,58,46,.06);
}
.choice-button-group .action-btn:active:not(:disabled),
.artist-secret-choice-row .action-btn:active:not(:disabled) {
  transform: translateY(0);
}
.choice-button-group .action-btn[aria-pressed="true"],
.artist-secret-choice-row .action-btn[aria-pressed="true"] {
  border-color: var(--fl-choice-selected-border);
  background: var(--fl-choice-selected-bg);
  color: var(--fl-forest-deep);
  box-shadow: 0 0 0 2px var(--fl-choice-selected-ring);
  transform: none;
}
.choice-button-group .action-btn[aria-pressed="true"]::after,
.artist-secret-choice-row .action-btn[aria-pressed="true"]::after {
  content: " \2713";
  font-weight: 900;
  white-space: nowrap;
}

/* Existing compact navigation uses quiet-control geometry, floored at 44px. */
.back-button {
  min-height: max(44px, var(--fl-control-height-quiet));
  padding: 8px 13px;
  border-radius: var(--fl-radius-control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fl-inline-gap);
  font-family: 'Nunito Sans', system-ui, sans-serif;
  line-height: 1.25;
}

/* Keep the approved Color Garden grown-up content shell, while inheriting global overflow safety. */
.grownup-note,
.grownup-note > *,
.grownup-list,
.grownup-list > * {
  min-width: 0;
  max-width: 100%;
}

/* Shared focus treatment. Specificity matches the Garden rules that set outline: none. */
.action-btn:focus-visible,
.back-button:focus-visible,
.color-level-send-btn:focus-visible,
.color-cami-story-bridge__link:focus-visible,
.picture-guide-list .action-btn.picture-guide-entry:focus-visible,
.animal-color-guide-list .action-btn.secondary.animal-color-guide-entry:focus-visible {
  outline: 3px solid var(--fl-forest-deep);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--fl-gold-faint);
}

@media (max-width: 620px) {
  .button-group:not(.choice-button-group) .action-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-btn:hover,
  .back-button:hover,
  .color-cami-story-bridge__link:hover {
    transform: none !important;
  }
}

/* Story/library calls-to-action are command buttons, not pills. */
.color-cami-story-bridge__link {
  max-width: 100%;
  min-width: 0;
  min-height: var(--fl-control-height);
  padding: 10px 16px;
  border: 1.5px solid var(--fl-primary-bg);
  border-radius: var(--fl-radius-control);
  background: var(--fl-primary-bg);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--fl-inline-gap);
  font-family: 'Nunito Sans', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 4px 12px rgba(26,58,46,.16);
  text-decoration: none;
}
.color-cami-story-bridge__link:hover {
  border-color: var(--fl-primary-hover);
  background: var(--fl-primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(26,58,46,.20);
}
.color-cami-story-bridge__link:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26,58,46,.14);
}

/* Cami story bridge artwork: separate asset, responsive card composition. */
.color-cami-story-bridge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 220px);
  gap: 1rem;
  align-items: center;
  min-width: 0;
}

.color-cami-story-bridge__content {
  min-width: 0;
}

.color-cami-story-bridge__image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  overflow: hidden;
  border: 1px solid rgba(210,171,102,.30);
  border-color: color-mix(in srgb, var(--fl-gold) 30%, transparent);
  border-radius: var(--fl-radius-control);
  box-shadow: 0 3px 10px rgba(26,58,46,.08);
}

@media (max-width: 620px) {
  .color-cami-story-bridge {
    grid-template-columns: 1fr;
  }

  .color-cami-story-bridge__image {
    grid-row: 1;
    width: 100%;
  }

  .color-cami-story-bridge__content {
    grid-row: 2;
  }
}

/* Focus-visible shadow precedence.
   These rules intentionally come after hover/active declarations. A control can
   be both :hover and :focus-visible; matching specificity plus later source
   order keeps the keyboard focus halo visible instead of reverting to a hover shadow. */
.action-btn:not(.secondary):focus-visible:not(:disabled) {
  transform: none;
  box-shadow:
    0 4px 12px rgba(26,58,46,.16),
    0 0 0 4px var(--fl-gold-faint);
}

.action-btn.secondary:focus-visible:not(:disabled) {
  transform: none;
  box-shadow: 0 0 0 4px var(--fl-gold-faint);
}

.choice-button-group .action-btn:focus-visible:not(:disabled),
.artist-secret-choice-row .action-btn:focus-visible:not(:disabled) {
  transform: none;
  box-shadow: 0 0 0 4px var(--fl-gold-faint);
}

.choice-button-group .action-btn[aria-pressed="true"]:focus-visible:not(:disabled),
.artist-secret-choice-row .action-btn[aria-pressed="true"]:focus-visible:not(:disabled) {
  box-shadow:
    0 0 0 2px var(--fl-choice-selected-ring),
    0 0 0 6px var(--fl-gold-faint);
}

.color-cami-story-bridge__link:focus-visible {
  transform: none;
  box-shadow:
    0 4px 12px rgba(26,58,46,.16),
    0 0 0 4px var(--fl-gold-faint);
}

