/* ============================================================
   agent-layer.css — styles for the live lab strip + read-along
   chip. Light, paper-toned. Sits inside the notebook aesthetic.
   ============================================================ */

/* ── Lab pulse strip ─────────────────────────────────────── */
.lab-pulse-host {
  background:
    linear-gradient(to bottom, transparent 0, transparent 50%, var(--paper-2) 50%, var(--paper-2) 100%),
    var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  overflow: hidden;
  position: relative;
}
.lab-pulse-host::before {
  /* tiny ruled-paper texture lines */
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 23px,
    rgba(26, 24, 18, 0.04) 23px,
    rgba(26, 24, 18, 0.04) 24px
  );
  pointer-events: none;
  opacity: 0.5;
}
.lab-pulse-host > .lp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  padding: 9px 22px;
  border-bottom: 1px dashed var(--rule);
  position: relative;
  z-index: 1;
}
.lab-pulse-host > .lp-row:last-child { border-bottom: none; }

.lp-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.lp-exp { font-weight: 500; }
.lp-k {
  color: var(--ink-4);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
}
.lp-v { color: var(--ink); }
.lp-soft { color: var(--ink-2); font-weight: 400; }
.lp-meta { color: var(--rule); }

.lp-led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  position: relative;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .lp-led { animation: lp-led-pulse 1.8s ease-in-out infinite; }
}
@keyframes lp-led-pulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 12%, transparent); }
}
.lp-led--ping {
  animation: lp-led-ping 0.35s ease-out;
}
@keyframes lp-led-ping {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.6); }
  100% { transform: scale(1); }
}

/* progress bar (mini) */
.lp-progress { display: inline-flex; align-items: center; gap: 8px; }
.lp-bar {
  display: inline-block;
  width: 110px;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.lp-bar-fill {
  display: block;
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 0.6s ease-out;
}

/* tick animation when a counter changes */
.lp-tick {
  transition: color 0.4s;
}

/* agent list */
.lp-agent-list {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.lp-agent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 11px;
}
.lp-agent-dot {
  width: 5px; height: 5px;
  background: var(--ink-3);
  border-radius: 50%;
  display: inline-block;
}
.lp-agent-task {
  color: var(--ink-3);
  font-weight: 400;
}
.lp-agent--fresh .lp-agent-dot {
  background: var(--accent);
  animation: lp-agent-fresh 1.4s ease-out;
}
@keyframes lp-agent-fresh {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@media (max-width: 900px) {
  .lab-pulse-host > .lp-row { gap: 14px; }
  .lp-agent-list { gap: 10px; }
  .lp-bar { width: 70px; }
}
@media (max-width: 640px) {
  .lp-agent:nth-child(n+3) { display: none; }
  .lp-cell { font-size: 10.5px; }
}

/* ── Read-along chip (floating, bottom-left) ─────────────── */
.ra-chip {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 80;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 12px 7px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.08);
  letter-spacing: 0.02em;
  transition: transform .2s, opacity .2s;
}
.ra-chip-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
@media (prefers-reduced-motion: no-preference) {
  .ra-chip-dot { animation: ra-dot 1.4s ease-in-out infinite; }
}
@keyframes ra-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.ra-chip-id { font-weight: 500; }
.ra-chip-sep { color: var(--rule); }
.ra-chip-task { color: var(--ink-2); }
.ra-chip-x {
  background: transparent;
  border: none;
  color: var(--ink-4);
  font-size: 16px;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}
.ra-chip-x:hover { color: var(--ink); }
.ra-chip--fresh { animation: ra-fresh 0.7s ease-out; }
@keyframes ra-fresh {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}
.ra-chip--hide {
  opacity: 0;
  transform: translateY(20px);
}
@media (max-width: 640px) {
  .ra-chip { left: 16px; bottom: 16px; font-size: 10.5px; }
}

/* ── Open-desk strip (tabs row) ──────────────────────────── */
.open-desk {
  margin: 14px 0 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.open-desk-k {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  margin-right: 6px;
}
.od-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-bottom: none;
  padding: 4px 10px 5px;
  border-radius: 3px 3px 0 0;
  color: var(--ink-2);
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
  top: 1px;
}
.od-tab:hover { background: var(--paper); color: var(--ink); }
.od-tab.active {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ink);
}
.od-tab .od-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
  display: inline-block;
}
.od-tab.dirty .od-dot { background: var(--accent); }

/* ── Scratchpad: open notebook in the page ──────────────── */
.scratchpad {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 24px 28px 28px 40px;
  margin: 24px 0;
  font-family: "Caveat", cursive;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
  transform: rotate(-0.35deg);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    rgba(26, 24, 18, 0.05) 31px,
    rgba(26, 24, 18, 0.05) 32px
  );
  background-position: 0 18px;
  box-shadow: 1px 2px 0 rgba(0,0,0,0.04), 0 1px 0 rgba(0,0,0,0.02);
}
@media (max-width: 800px) {
  .scratchpad { transform: none; }
}
.scratchpad::before {
  content: "";
  position: absolute;
  left: 32px; top: 10px; bottom: 10px;
  width: 1px;
  background: var(--accent-line);
  opacity: 0.55;
}
.scratchpad-head {
  font-family: "Caveat", cursive !important;
  font-size: 17px !important;
  font-weight: 600;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  color: var(--ink-3);
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--rule) !important;
  transform: rotate(-0.5deg);
  transform-origin: left center;
}
.scratchpad ul { list-style: none; padding-left: 30px; margin: 0; }
.scratchpad ul li {
  margin: 0 0 16px;
  padding-left: 0;
  position: relative;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink);
}
.scratchpad ul li:nth-child(1)  { transform: rotate(-0.4deg); transform-origin: left; }
.scratchpad ul li:nth-child(2)  { transform: rotate( 0.3deg); transform-origin: left; padding-left: 2px; }
.scratchpad ul li:nth-child(3)  { transform: rotate(-0.2deg); transform-origin: left; }
.scratchpad ul li:nth-child(4)  { transform: rotate( 0.5deg); transform-origin: left; padding-left: 1px; }
.scratchpad ul li:nth-child(5)  { transform: rotate(-0.3deg); transform-origin: left; }
.scratchpad ul li:nth-child(6)  { transform: rotate( 0.2deg); transform-origin: left; padding-left: 2px; }
.scratchpad ul li:nth-child(7)  { transform: rotate(-0.4deg); transform-origin: left; }
.scratchpad ul li::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 13px;
  height: 13px;
  border: 1.4px solid var(--ink-3);
  border-radius: 1.5px 2.5px 1px 3px;
  transform: rotate(-3deg);
  background: var(--paper);
}
.scratchpad ul li:nth-child(even)::before { transform: rotate(2.5deg); border-radius: 2.5px 1px 3px 1.5px; }
.scratchpad ul li:nth-child(3n)::before  { transform: rotate(-5deg); }
.scratchpad ul li.done::after {
  content: "";
  position: absolute;
  left: -28px;
  top: 4px;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(45deg, transparent 38%, var(--ink) 38%, var(--ink) 46%, transparent 46%) 0 0 / 60% 50% no-repeat,
    linear-gradient(-45deg, transparent 38%, var(--ink) 38%, var(--ink) 46%, transparent 46%) 6px 2px / 70% 70% no-repeat;
  transform: rotate(-6deg) scale(0.95);
  pointer-events: none;
}
.scratchpad ul li.done::before {
  border-color: var(--ink);
  border-width: 1.5px;
}
.scratchpad .done {
  text-decoration: line-through wavy var(--accent-ui) !important;
  text-decoration-thickness: 1.2px !important;
  text-decoration-skip-ink: none !important;
  color: var(--ink-3) !important;
}
.scratchpad small {
  display: block;
  font-family: "Caveat", cursive !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--ink-4) !important;
  margin-top: 1px;
  line-height: 1.2;
  transform: rotate(-0.4deg);
  transform-origin: left center;
}
