/* The notebook kit of campus (Gaudí, 26 October 2026): the marks a teacher makes on a notebook, for the player of the
   open course «Cómo funciona Moodle» (pieza.html). Pure CSS; cuaderno.js draws the marks that are strokes (the ring,
   the tick, the cross) and places them. It uses the player's tokens (--paper, --surface, --sunk, --ink, --ink-2, --line,
   --line-2, --accent, --accent-ink) and adds its own, prefixed --cq-, with light and dark values. Light by default; dark
   with :root[data-theme="dark"] (as pieza.html) or on any element with .cq-oscuro. With reduced motion nothing moves:
   every mark shows at once, in its final state. */

:root, .cq-claro {
  --cq-pen: #c8392b;            /* the teacher's red pen: marks and big words only, 4.7:1 on --paper, 5.2:1 on white */
  --cq-pen-soft: rgba(200, 57, 43, .12);
  --cq-gold: #e8b64a;           /* the star sticker */
  --cq-gold-2: #c98f12;
  --cq-gold-hi: #fff6c9;
  --cq-postit: #fff3a6;
  --cq-postit-ink: #3d3200;     /* 11.3:1 on the post-it */
  --cq-tape: #3a76d6;           /* the tape's colour; set it per course or route */
  --cq-rule: rgba(58, 118, 214, .16);
  --cq-margin: #e2725b;
  --cq-shadow: 0 1px 0 var(--line, rgba(23, 24, 27, .1)), 0 18px 32px -24px rgba(23, 24, 27, .45);
}
:root[data-theme="dark"], .cq-oscuro {
  --cq-pen: #ff7a66;            /* 6.9:1 on the dark surface */
  --cq-pen-soft: rgba(255, 122, 102, .14);
  --cq-gold: #f0c35e;
  --cq-gold-2: #d7a432;
  --cq-gold-hi: #fff3c4;
  --cq-postit: #4a4220;
  --cq-postit-ink: #fff3c2;     /* 9.0:1 on the dark post-it */
  --cq-tape: #74a3f0;
  --cq-rule: rgba(116, 163, 240, .07);
  --cq-margin: rgba(240, 138, 99, .5);
  --cq-shadow: 0 1px 0 var(--line, rgba(236, 234, 229, .1)), 0 18px 32px -24px rgba(0, 0, 0, .9);
}

/* The strokes that cuaderno.js draws: an SVG laid over a box, never taking the pointer. */
.cq-trazo { position: absolute; pointer-events: none; overflow: visible; z-index: 5; }
.cq-trazo path { fill: none; stroke: var(--cq-pen); stroke-linecap: round; stroke-linejoin: round; filter: url(#cq-aspero); }
.cq-dibuja path { stroke-dasharray: 1; animation: cq-dibujar .45s cubic-bezier(.4, 0, .2, 1) both; }
.cq-dibuja path + path { animation-delay: .18s; }
@keyframes cq-dibujar { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.cq-dibuja path.cq-hecho { stroke-dasharray: none; animation: none; }

/* The small tick for a list or a step dot: a span, drawn with borders. */
.cq-visto-mini { display: inline-block; width: .5em; height: .95em; border: solid var(--cq-pen); border-width: 0 .18em .18em 0;
  transform: translateY(-.1em) rotate(40deg); border-radius: 1px; vertical-align: middle; }

/* The margin note: a few words in red pen, handwritten-looking («Ahí no», «Estaba aquí», «¡Muy bien!»). */
.cq-nota { font: italic 800 1.25rem/1.15 "Atkinson", system-ui, sans-serif; color: var(--cq-pen); transform: rotate(-5deg);
  display: inline-block; white-space: nowrap; }

/* The stamp: a word in a rubber-stamp frame. */
.cq-sello { display: inline-block; font: 800 2.1rem/1 "Bricolage", "Atkinson", system-ui, sans-serif; color: var(--cq-pen);
  border: .12em solid var(--cq-pen); border-radius: .35em; padding: .17em .45em .22em; letter-spacing: .02em; text-transform: uppercase;
  transform: rotate(-8deg); opacity: .92; filter: url(#cq-aspero); white-space: nowrap; }
.cq-sello.cq-pone { animation: cq-sellar .26s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes cq-sellar { from { transform: rotate(-14deg) scale(1.6); opacity: 0; } 70% { opacity: .92; } to { transform: rotate(-8deg) scale(1); opacity: .92; } }

/* The gold star sticker (cuaderno.js draws its SVG; this is its box and how it lands). */
.cq-estrella { display: inline-block; width: 4.5rem; height: 4.5rem; transform: rotate(12deg); filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); }
.cq-estrella svg { width: 100%; height: 100%; display: block; }
.cq-estrella.cq-pone { animation: cq-pegar .38s cubic-bezier(.2, .9, .3, 1.4) both; }
@keyframes cq-pegar { from { transform: rotate(-20deg) scale(.3); opacity: 0; } to { transform: rotate(12deg) scale(1); opacity: 1; } }
/* A row of star stickers as a score (3 of 5): the empty ones are grey. */
.cq-estrellas { display: inline-flex; gap: .3rem; }
.cq-estrellas i { width: 2.1rem; height: 2.1rem; background: var(--line-2, rgba(23, 24, 27, .18));
  clip-path: polygon(50% 4%, 62% 36%, 95% 38%, 69% 58%, 78% 92%, 50% 73%, 22% 92%, 31% 58%, 5% 38%, 38% 36%); }
.cq-estrellas i.on { background: radial-gradient(circle at 35% 30%, var(--cq-gold-hi), var(--cq-gold) 45%, var(--cq-gold-2)); }

/* The post-it: a hint stuck on the page. Put it inside a positioned box and place it with top/left. */
.cq-posit { position: absolute; z-index: 6; background: var(--cq-postit); color: var(--cq-postit-ink); padding: .75rem 1rem .85rem;
  font: 700 1.05rem/1.35 "Atkinson", system-ui, sans-serif; box-shadow: 0 10px 18px -12px rgba(0, 0, 0, .55); transform: rotate(-2deg);
  width: max-content; max-width: min(17rem, 80vw); }
.cq-posit small { display: block; font-weight: 400; font-size: .9rem; opacity: .9; }
.cq-posit.cq-grande { font: 800 1.35rem/1.25 "Bricolage", "Atkinson", system-ui, sans-serif; padding: .7rem 1.2rem; }
.cq-posit.cq-pone { animation: cq-posar .3s ease-out both; }
@keyframes cq-posar { from { transform: rotate(-6deg) translateY(-8px); opacity: 0; } to { transform: rotate(-2deg) translateY(0); opacity: 1; } }

/* The tape: a translucent strip holding a sheet by a corner. Inside a positioned sheet; --cq-tape sets its colour. */
.cq-celo { position: absolute; z-index: 3; width: 92px; height: 26px; pointer-events: none;
  background: color-mix(in srgb, var(--cq-tape) 38%, transparent);
  border-left: 2px dotted rgba(255, 255, 255, .35); border-right: 2px dotted rgba(255, 255, 255, .35); }
.cq-celo.cq-izq { left: -26px; top: 8px; transform: rotate(-38deg); }
.cq-celo.cq-der { right: -26px; top: 8px; transform: rotate(38deg); }
.cq-celo.cq-arriba { left: 50%; top: -13px; transform: translateX(-50%) rotate(-3deg); }

/* The page corner: a link to the next page, with its corner folded. */
.cq-esquina { position: relative; display: flex; flex-direction: column; gap: .1rem; padding: .85rem 1.2rem; text-decoration: none;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; min-height: 44px; }
.cq-esquina small { color: var(--ink-2); font-size: .82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.cq-esquina b { font-size: 1.05rem; }
.cq-esquina.cq-siguiente { text-align: right; border-color: var(--ink); clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%); }
.cq-esquina.cq-siguiente::after { content: ""; position: absolute; right: 0; top: 0; width: 22px; height: 22px; border-bottom-left-radius: 4px;
  background: linear-gradient(225deg, var(--paper) 50%, var(--sunk) 50%); box-shadow: -2px 2px 3px rgba(0, 0, 0, .12); }
.cq-esquina:hover, .cq-esquina:focus-visible { background: var(--sunk); }

/* The tear-off strip: a band under a sheet with a perforated edge (where «Ahora tú» starts). */
.cq-tira { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 1.1rem; align-items: center; padding: 1.1rem 1.25rem;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: var(--cq-shadow); margin-top: 1.4rem; }
.cq-tira::before { content: ""; position: absolute; left: 14px; right: 14px; top: -10px; border-top: 2px dashed var(--line-2); }
.cq-tira > * { min-width: 0; }
@media (max-width: 560px) { .cq-tira { grid-template-columns: auto 1fr; } .cq-tira > :last-child { grid-column: 1 / -1; } }

/* The ruled paper with the red margin, for a sheet or a card: background only. */
.cq-pautado { background: linear-gradient(to right, transparent 0 calc(var(--cq-mx, 46px) - 1px), var(--cq-margin) calc(var(--cq-mx, 46px) - 1px) var(--cq-mx, 46px), transparent var(--cq-mx, 46px)),
  repeating-linear-gradient(to bottom, transparent 0 27px, var(--cq-rule) 27px 28px), var(--surface); }

@media (prefers-reduced-motion: reduce) {
  .cq-dibuja path, .cq-sello.cq-pone, .cq-estrella.cq-pone, .cq-posit.cq-pone { animation: none; }
  .cq-dibuja path { stroke-dasharray: none; }
}
@media (forced-colors: active) {
  .cq-trazo path { stroke: CanvasText; filter: none; }
  .cq-sello { color: CanvasText; border-color: CanvasText; filter: none; }
  .cq-posit { border: 2px solid CanvasText; }
}
