/* La Forja de Ideas · componentes
   Medidas tomadas del tablero "7 · Sistema de componentes" de Claude Design. */

/* ---------- Logo ---------- */
.logo { color: var(--text); }
.logo--sm { width: 29px; height: 24px; }
.logo--md { width: 48px; height: 40px; }
.logo--lg { width: 86px; height: 72px; }

/* ---------- Bolita de yunque ---------- */
.dot {
  display: inline-block; flex-shrink: 0;
  width: 12px; height: 12px;
  border-radius: var(--r-pill);
  background: var(--dot, var(--text-2));
}
.dot--sm { width: 8px; height: 8px; }
.dot--xs { width: 6px; height: 6px; }
.dot--lg { width: 14px; height: 14px; }
.dot--later { background: none; width: 6px; height: 6px; border: 1.5px solid var(--text-2); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 48px; padding: 0 20px;
  border-radius: var(--r-pill); border: none;
  font-size: 15px; font-weight: 600;
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { opacity: .86; }
.btn--secondary { background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.btn--secondary:hover { background: var(--surface); }
.btn--ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: none; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
}
.btn--ghost:hover { color: var(--text); }
.btn--ghost svg { width: 18px; height: 18px; }
.btn--lg { height: 52px; width: 100%; font-size: 16px; }
.btn--block { flex: 1; }

.btn-icon {
  position: relative;
  width: 40px; height: 40px; flex-shrink: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); border: none;
  background: transparent; color: var(--text);
}
.btn-icon::after { content: ""; position: absolute; inset: -2px; } /* área táctil 44 */
.btn-icon svg { width: 22px; height: 22px; }
.btn-icon--44 { width: 44px; height: 44px; }
.btn-icon--outline { border: 1px solid var(--line); }
.btn-icon--ink { background: var(--ink); color: #fff; }
.btn-icon--ink svg { width: 20px; height: 20px; }
.btn-icon:disabled,
.btn-icon--ink:disabled { background: var(--disabled-bg); color: var(--disabled-fg); cursor: default; }
.btn-icon--muted { color: var(--text-2); }

.fab {
  position: fixed; right: 16px;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); border: none;
  background: var(--ink); color: #fff;
  box-shadow: var(--sh-float);
}
.fab svg { width: 24px; height: 24px; }

/* ---------- Avatar y barra superior ---------- */
.appbar {
  height: var(--appbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 0 20px;
}
.avatar {
  width: 36px; height: 36px; padding: 0;
  border-radius: var(--r-pill); border: none;
  background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 600;
}

/* ---------- Píldora de captura (composer) ---------- */
.composer {
  height: 56px;
  display: flex; align-items: center; gap: 4px;
  padding: 0 8px 0 22px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--sh-composer);
  transition: height var(--t-base) var(--ease), border-radius var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.composer__input {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent;
  font-size: var(--fs-body); color: var(--text);
}
.composer__input::placeholder { color: var(--text-2); }

/* Grabando */
.composer.is-recording { border-color: var(--text); padding: 0 8px; gap: 10px; }
.composer__time { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stop-icon { width: 12px; height: 12px; border-radius: 3px; background: #fff; }

/* Transcrito */
.composer.is-multiline {
  height: auto;
  flex-direction: column; align-items: stretch;
  padding: 14px 8px 8px 20px;
  border-radius: var(--r-lg);
}
.composer__textarea {
  border: none; outline: none; resize: none;
  padding: 0 12px 0 0; margin: 0; background: transparent;
  font-size: var(--fs-body); line-height: var(--lh-body);
}
.composer__row { display: flex; align-items: center; gap: 4px; }
.composer__meta { flex: 1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); }

/* Onda de audio */
.wave { flex: 1; min-width: 0; height: 40px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.wave span {
  display: block; flex-shrink: 0; width: 3px;
  height: var(--h, 16px);
  border-radius: var(--r-pill);
  background: var(--text);
  transform-origin: center;
  animation: fj-wave var(--d, 1s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes fj-wave { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes fj-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.rec-dot { width: 8px; height: 8px; border-radius: var(--r-pill); background: var(--text); animation: fj-pulse 1.2s ease-in-out infinite; }

/* ---------- Enlace píldora ("5 chispas esperando") ---------- */
.chip-link {
  align-self: flex-start;
  height: 32px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  text-decoration: none;
  font-size: var(--fs-xs); font-weight: 500;
}
.chip-link svg { width: 16px; height: 16px; }
.chip-link__chevron { color: var(--text-2); }

/* ---------- Chispa: fila (Inicio) ---------- */
.spark-list__label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.spark-row {
  height: 36px;
  display: flex; align-items: center; gap: 12px;
  color: var(--text-2); text-decoration: none;
}
.spark-row__title { flex: 1; min-width: 0; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spark-row__time { flex-shrink: 0; font-size: var(--fs-xs); }

/* ---------- Chispa: tarjeta (bandeja) ---------- */
.spark-card {
  width: 152px; height: 84px; flex-shrink: 0;
  padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  border-radius: var(--r-md); border: none;
  background: var(--surface); color: var(--text);
  text-align: left;
  touch-action: none;
}
.spark-card__title {
  font-size: var(--fs-sm); line-height: 19px; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.spark-card__meta { font-size: var(--fs-2xs); color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.spark-card__meta svg { width: 13px; height: 13px; }
.spark-card.is-placeholder { background: none; border: 1.5px dashed var(--dash); }
.spark-card.is-dragging {
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: var(--sh-drag);
  transform: rotate(-5deg);
  pointer-events: none;
}

/* ---------- Chispa: entrada (hoja) ---------- */
.spark-entry { padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); }
.spark-entry__title { font-size: 15px; font-weight: 500; }
.spark-entry__text { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); margin-top: 2px; }
.spark-entry__meta { font-size: var(--fs-2xs); color: var(--text-2); margin-top: 6px; }
.spark-entry--audio { display: flex; align-items: center; gap: 12px; }

/* ---------- Tarjeta de yunque ---------- */
.anvil-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .anvil-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.anvil-card {
  height: 132px; padding: 16px;
  display: flex; flex-direction: column; align-items: flex-start;
  border-radius: var(--r-md); border: none;
  background: var(--surface); color: var(--text);
  text-decoration: none; text-align: left;
}
.anvil-card__name { margin-top: auto; font-size: 16px; font-weight: 600; line-height: 22px; }
.anvil-card__stat { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); display: flex; align-items: center; }
.anvil-card__embers { display: inline-flex; gap: 3px; margin-right: 6px; }

.anvil-card.is-new { background: var(--bg); border: 1.5px dashed var(--dash); }
.anvil-card__plus {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.anvil-card.is-later {
  grid-column: 1 / -1; height: 76px;
  flex-direction: row; align-items: center; gap: 12px;
  background: var(--text); color: #fff;
}
.anvil-card.is-later .anvil-card__name { margin-top: 0; }
.anvil-card.is-later .anvil-card__stat { color: rgba(255,255,255,.64); }

/* ---------- Cabecera de yunque, migas y pestañas ---------- */
.topbar { height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.page-title {
  margin: 0; height: 40px; padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
  font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em;
}
.tabs {
  height: 45px; flex-shrink: 0;
  display: flex; gap: 24px; padding: 0 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs__tab {
  height: 44px; padding: 0 2px;
  border: none; border-bottom: 2px solid transparent;
  background: transparent;
  font-size: 16px; font-weight: 500; color: var(--text-2);
}
.tabs__tab[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--text); }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs [aria-current] { color: var(--text); font-weight: 500; }

/* ---------- Mapa radial ---------- */
.map { position: relative; height: 460px; flex-shrink: 0; touch-action: none; }
.map__links { position: absolute; inset: 0; width: 100%; height: 100%; }
.map__links line { stroke: var(--line); stroke-width: 1.5; }

.bubble {
  position: absolute;
  width: 84px; height: 84px; padding: 8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); border: none;
  background: var(--ember-0); color: #fff;
  font-size: var(--fs-xs); line-height: 16px; font-weight: 500; text-align: center;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.bubble__label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; hyphens: auto; }
.bubble[data-ember="1"] { background: var(--ember-1); }
.bubble[data-ember="2"] { background: var(--ember-2); color: var(--text); }
.bubble[data-ember="3"] { background: var(--ember-3); color: var(--text); }
.bubble__count {
  position: absolute; top: -2px; right: -2px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-size: var(--fs-2xs); font-weight: 600;
}
.bubble.is-drop-target {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--text), 0 0 0 18px rgba(13,13,13,.08);
}
.bubble--center {
  width: 120px; height: 120px;
  flex-direction: column; gap: 6px;
  background: var(--bg); color: var(--text);
  border: 2px solid var(--text);
  font-size: 17px; font-weight: 600;
}
.drop-hint { position: absolute; font-size: var(--fs-2xs); font-weight: 600; color: var(--text); }

/* ---------- Bandeja ---------- */
.tray { border-top: 1px solid var(--line); padding: 12px 0 16px; }
.tray__head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 20px 10px; }
.tray__title { font-size: 15px; font-weight: 600; }
.tray__title span { font-weight: 400; color: var(--text-2); }
.tray__track {
  display: flex; gap: 12px; padding: 0 20px;
  overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
}
.tray__track > * { scroll-snap-align: start; }

/* ---------- Hoja inferior ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 44; background: var(--scrim);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-sheet) var(--ease);
}
.scrim.is-open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; top: 76px; z-index: 45;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-sheet);
  transform: translateY(100%);
  transition: transform var(--t-sheet) var(--ease);
}
.sheet.is-open { transform: translateY(0); }
@media (min-width: 900px) { .sheet { left: 50%; width: 640px; margin-left: -320px; } }

.sheet__handle { display: block; width: 36px; height: 4px; margin: 8px auto 0; border-radius: var(--r-pill); background: var(--dash); }
.sheet__body { flex: 1; overflow-y: auto; padding: 12px 20px 24px; }
.sheet__title {
  width: 100%; border: none; outline: none; padding: 0; margin: 8px 0 4px;
  font-size: var(--fs-title); line-height: var(--lh-title); font-weight: 600; letter-spacing: -.01em;
}
.sheet__actions {
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
}
.sheet__actions-row { display: flex; gap: 8px; }

.tag {
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-xs);
}

.check { display: flex; align-items: center; gap: 12px; min-height: 36px; font-size: 15px; }
.check input {
  appearance: none; margin: 0; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid var(--disabled-fg);
  display: grid; place-content: center;
}
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translateY(-1px) rotate(-45deg);
}
.check input:checked + span { color: var(--text-2); text-decoration: line-through; }

/* ---------- Overlay de delegación ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  padding: 56px 8px calc(28px + env(safe-area-inset-bottom, 0px));
  background: var(--overlay);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  color: #fff;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast) var(--ease);
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
.overlay__head { padding: 0 16px 24px; }
.overlay__label { font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.56); }
.overlay__spark-title { font-size: 17px; font-weight: 600; margin-top: 8px; }
.overlay__excerpt { font-size: var(--fs-sm); line-height: 20px; color: rgba(255,255,255,.64); margin-top: 4px; }
.overlay__question { font-size: var(--fs-sm); color: rgba(255,255,255,.56); margin-top: 24px; }
.overlay__list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.overlay-row {
  height: 60px; padding: 0 16px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  border: none; border-radius: var(--r-md);
  background: transparent; color: #fff;
  font-size: var(--fs-overlay); font-weight: 500; text-align: left;
  opacity: 0; transform: translateY(8px);
}
.overlay.is-open .overlay-row {
  opacity: 1; transform: none;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  transition-delay: calc(var(--i, 0) * 30ms);
}
.overlay-row:hover, .overlay-row:focus-visible { background: rgba(255,255,255,.08); }
.overlay-row.is-suggested { background: rgba(255,255,255,.08); }
.overlay-row__badge {
  margin-left: auto;
  height: 24px; padding: 0 10px;
  display: inline-flex; align-items: center;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.16);
  font-size: var(--fs-2xs); font-weight: 600;
}
.overlay-row--muted { color: rgba(255,255,255,.64); }
.overlay-row--later { margin-top: auto; }

/* ---------- Aviso (toast) ---------- */
.toast {
  position: relative; overflow: hidden;
  height: 48px; padding: 0 6px 0 18px;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-pill);
  background: var(--text); color: #fff;
  box-shadow: var(--sh-float);
  font-size: var(--fs-sm);
}
.toast__msg { flex: 1; display: flex; align-items: center; gap: 8px; }
.toast__msg strong { font-weight: 600; }
.toast__sep { color: rgba(255,255,255,.4); }
.toast__action {
  height: 36px; padding: 0 14px;
  border: none; border-radius: var(--r-pill);
  background: rgba(255,255,255,.14); color: #fff;
  font-size: var(--fs-sm); font-weight: 600;
}
.toast__bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: rgba(255,255,255,.5);
  transform-origin: left;
  animation: fj-countdown 5s linear forwards;
}
@keyframes fj-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Navegación ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.tabbar__item {
  flex: 1 1 0; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-2); text-decoration: none;
  font-size: var(--fs-nav); font-weight: 500;
}
.tabbar__item svg { width: 24px; height: 24px; }
.tabbar__item[aria-current="page"] { color: var(--text); font-weight: 600; }

@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; width: var(--sidebar-w); height: auto;
    flex-direction: column; gap: 4px; padding: 20px 12px;
    border-top: none; border-right: 1px solid var(--line);
  }
  .tabbar__item {
    flex: 0 0 auto; height: 44px; padding: 0 12px;
    flex-direction: row; justify-content: flex-start; gap: 12px;
    border-radius: var(--r-md); font-size: 15px;
  }
  .tabbar__item[aria-current="page"] { background: var(--surface); }
  .fab { bottom: 24px; right: 24px; }
}
