/* =====================================================================
   EQX: maths the way the teacher writes it. Standalone formulas become a
   chalkboard in a wooden frame, every line aligned on its = sign; math
   inside a sentence becomes a pen-highlighted chip. All real text.
   ===================================================================== */

/* the board */
.eqx-board { display: grid; grid-template-columns: minmax(0, max-content) max-content minmax(0, 1fr); column-gap: 12px; row-gap: 10px; align-items: center; justify-content: center; background: radial-gradient(120% 140% at 30% 20%, #17493a, #0e3227 70%); border: 7px solid #7c5433; border-radius: 12px; box-shadow: inset 0 0 40px rgba(0, 0, 0, .35), 0 8px 26px rgba(20, 33, 58, .18); padding: 22px 28px; margin: 1.7em auto; max-width: 640px; font-family: 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', 'Kalam', cursive; font-size: 1.22em; color: #f2f7f0; text-shadow: 0 0 6px rgba(242, 247, 240, .28); overflow-x: auto; }
.eqx-board + .eqx-board { margin-top: -1.35em; border-top: 0; border-radius: 0 0 12px 12px; }
.eqx-board:has(+ .eqx-board) { border-bottom: 2px dashed rgba(124, 84, 51, .6); border-radius: 12px 12px 0 0; margin-bottom: 0; }
.eqx-row { display: contents; }
.eqx-l { text-align: right; justify-self: end; }
.eqx-l--full { grid-column: 1 / -1; text-align: center; }
.eqx-eq { color: #ffd166; font-weight: 700; text-shadow: 0 0 8px rgba(255, 209, 102, .5); }
.eqx-r { text-align: left; justify-self: start; }
.eqx-board i { font-style: italic; }
.eqx-board .eqx-txt, .eqx-board .eqx-fn2 { font-style: normal; }
.eqx-fn2 { margin-right: 2px; }
.eqx-br { display: inline-block; transform: scaleY(1.35); margin: 0 1px; }

/* stacked fractions: real characters, the slash hidden but copyable */
.eqx-f { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: 0 3px; line-height: 1.15; }
.eqx-fn { border-bottom: 2px solid currentColor; padding: 0 5px 1px; }
.eqx-fs { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.eqx-fd { padding: 1px 5px 0; }
.eqx-f .eqx-fn, .eqx-f .eqx-fd { font-size: .82em; }

/* roots */
.eqx-sqrt { white-space: nowrap; }
.eqx-rad { border-top: 2px solid currentColor; padding: 0 3px; margin-left: 1px; }

/* super/sub sizing on the board and in chips */
.eqx-board sup, .eqx-i sup { font-size: .62em; }
.eqx-board sub, .eqx-i sub { font-size: .62em; }

/* the reveal: lines chalk themselves in as the board scrolls into view */
.eqx-board[data-eqx] .eqx-row > * { opacity: 0; transform: translateY(6px); transition: opacity .55s ease, transform .55s ease; }
.eqx-board.eqx-on .eqx-row > * { opacity: 1; transform: none; }

/* inline math: the pen chip */
.eqx-i { display: inline-block; font-family: Georgia, 'Times New Roman', serif; font-style: normal; background: linear-gradient(120deg, rgba(255, 209, 102, .28), #da5600); border-bottom: 2px solid rgba(180, 83, 9, .45); border-radius: 6px 6px 2px 2px; padding: 1px 8px; margin: 0 2px; font-size: 1.06em; color: #ffffff; white-space: nowrap; }
.eqx-i i { font-style: italic; }
.eqx-i .eqx-f { margin: 0 2px; line-height: 1.05; }
.eqx-i .eqx-fn { border-bottom-width: 1.5px; }

@media (max-width: 560px) { .eqx-board { padding: 16px 14px; font-size: 1.05em; border-width: 5px; } }
@media (prefers-reduced-motion: reduce) { .eqx-board[data-eqx] .eqx-row > * { opacity: 1; transform: none; transition: none; } }

/* the notebook slip: ruled paper and ink for formulas living in lists and
   tables - the board's little sibling */
.eqx-slip { display: inline-grid; grid-template-columns: minmax(0, max-content) max-content minmax(0, max-content); column-gap: 10px; row-gap: 8px; align-items: center; background: repeating-linear-gradient(180deg, #fffdf5 0 26px, #e8f0fa 26px 27px), #fffdf5; border: 1px solid #e6dfc9; border-left: 3px solid #e88c8c; border-radius: 8px; padding: 10px 18px 10px 22px; font-family: Georgia, 'Times New Roman', serif; font-size: 1.12em; color: #1a3a8f; box-shadow: 0 3px 10px rgba(20, 33, 58, .08); }
.eqx-slip .eqx-eq { color: #b3372a; font-weight: 700; text-shadow: none; }
.eqx-slip .eqx-row { display: contents; }
.eqx-slip .eqx-fn { border-bottom-width: 1.5px; }
td .eqx-slip { box-shadow: none; }
