/* ==========================================================================
   funciones.css — Estilos específicos de los 4 laboratorios de funciones
   ========================================================================== */

.fn-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 14px;
}

@media (min-width: 1280px) {
  .fn-grid {
    grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
  }

  .fn-canvas-card {
    position: sticky;
    top: 4.5rem;
    align-self: start;
  }

  .rad-explain-note {
    display: none;
  }

  .rad-sticky-note {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 1.25rem 1.5rem;
    box-sizing: border-box;
    border: 2px dashed rgba(230, 211, 138, 0.4);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--card) 60%, transparent);
    text-align: center;
  }

  .rad-arrow-svg {
    width: 200px;
    height: 60px;
    flex: none;
    margin-bottom: 0.75rem;
  }

  .rad-sticky-note__text {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    color: var(--yellow);
    line-height: 1.4;
    margin: 0;
    max-width: 28rem;
  }
}

@media (max-width: 1279px) {
  .rad-sticky-note {
    display: none !important;
  }

  .rad-explain-note {
    display: block;
  }
}

@media (max-width: 820px) {
  .fn-grid {
    grid-template-columns: 1fr;
  }
}

.fn-canvas-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  contain: none;
  isolation: auto;
}

.fn-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fn-readout {
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
  transform: rotate(-.8deg);
}

.fn-readout:nth-of-type(even) {
  transform: rotate(.6deg);
}

.fn-readout__title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 8px;
}

.fn-readout__row {
  display: flex;
  justify-content: flex-start;
  align-items: baseline;
  gap: 0.75rem;
  padding: 4px 0;
  border-bottom: none;
}

.fn-readout__row:last-child {
  border-bottom: 0;
}

.fn-lens-panel {
  margin: 0 0 10px;
}

.fn-lens-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 0;
}

@media (min-width: 1280px) {
  .fn-lens-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

.fn-lens-bar .toggle {
  padding: 6px 10px;
  font-size: 0.9375rem;
  text-align: center;
  justify-content: center;
}

.fn-quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.fn-quiz-btn {
  text-align: left;
  width: 100%;
  min-height: 44px;
  padding: 10px 10px;
  line-height: 1.4;
  border-radius: 0;
  border: 0;
  border-image: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
  box-sizing: border-box;
  transition: color 0.15s;
}

@media (hover: hover) {
  .fn-quiz-btn:hover {
    background: transparent;
    color: var(--yellow);
    text-decoration: underline;
    text-underline-offset: 4px;
    border: 0;
    border-image: none;
  }
}

.fn-quiz-btn.is-incorrect,
.fn-quiz-btn.is-correct {
  color: var(--ink);
  border: 0;
  border-image: none;
}

.fn-quiz-btn.is-incorrect .quiz-opt-tag {
  color: var(--pink);
}

.fn-quiz-btn.is-correct .quiz-opt-tag {
  color: var(--yellow);
}

.quiz-opt-tag {
  font-weight: 600;
  display: inline-block;
  margin-right: 6px;
  flex: none;
}

.quiz-opt-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  flex: none;
}

.fn-quiz-btn.is-incorrect .quiz-opt-icon {
  color: var(--pink);
}

.fn-quiz-btn.is-correct .quiz-opt-icon {
  color: var(--green);
}

.fn-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  background: transparent;
  border-radius: 0;
  margin: 8px 0;
}

.fn-pipe-box {
  padding: 2px 6px;
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 1.1rem;
}

.fn-pipe-box--io {
  background: transparent;
  color: var(--blue);
}

.fn-pipe-box--op {
  background: transparent;
  color: var(--yellow);
}

.fn-pipe-box--inv {
  background: transparent;
  color: var(--green);
}

.fn-pipe-arrow {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--muted);
}

.fn-formula-box {
  display: flex;
  flex-direction: column;
  row-gap: 8px;
  padding: 6px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 1rem;
}

.tcp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.tcp-row .math,
.tcp-row strong {
  color: var(--yellow);
}

.fn-shadow-x {
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.85;
}

.fn-shadow-x--pos {
  stroke: var(--blue);
}

.fn-shadow-x--neg {
  stroke: var(--ink);
  stroke-dasharray: 5 4;
}

.fn-shadow-x--pink {
  stroke: var(--pink);
}

.fn-shadow-y {
  stroke: var(--ink);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.85;
}

.fn-laser {
  stroke-width: 2.2;
  stroke-dasharray: 6 4;
}

.fn-secant {
  stroke: var(--yellow);
  stroke-width: 2.2;
  stroke-dasharray: 6 4;
}

.fn-triangle-dx {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.fn-triangle-dy {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.fn-mirror {
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-dasharray: 6 5;
}

.fn-normal {
  stroke: var(--yellow);
  stroke-width: 1.8;
  stroke-dasharray: 4 4;
}

/* ---------- Interacción directa sobre el SVG ---------- */
.plot.is-interactive {
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.plot.is-dragging,
.plot.is-dragging .fn-handle {
  cursor: grabbing;
}

/* Área de agarre amplia e invisible alrededor de los puntos arrastrables */
.fn-handle {
  fill: transparent;
  stroke: none;
  cursor: grab;
}

.fn-handle-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-dasharray: 3 3;
  opacity: .55;
  pointer-events: none;
}

.fn-handle-ring--p1 { color: var(--blue); }
.fn-handle-ring--p2 { color: var(--blue); }

@keyframes fn-pulse {
  0%, 100% { opacity: .25; }
  50% { opacity: .7; }
}

@media (prefers-reduced-motion: no-preference) {
  .fn-handle-ring {
    animation: fn-pulse 2.4s ease-in-out infinite;
  }
}

.fn-hint {
  font-size: 1rem;
  color: var(--muted);
  margin: 8px 4px 0;
}

/* ---------- Lecturas ---------- */
.fn-text-blue {
  color: var(--blue);
}

.fn-text-green {
  color: var(--green);
}

.fn-reveal {
  min-height: 44px;
  font-size: 1rem;
  padding: 6px 14px;
  border-radius: var(--radius);
}

/* ---------- Tubería con valores vivos ---------- */
.fn-pipe-box small {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  opacity: .8;
}

.fn-pipe-box--mid {
  background: transparent;
  color: var(--ink);
  border: none;
}

.fn-pipe-op {
  padding: 2px 6px;
  font-size: 1.1rem;
  font-weight: 600;
  background: transparent;
  color: var(--yellow);
  border: none;
}

.fn-pipe-op--inv {
  background: transparent;
  color: var(--green);
  border: none;
}

.fn-pipeline--inv .fn-pipe-arrow {
  color: var(--green);
}
