/* mate.css — extiende study.css con paleta menta y componentes de matemáticas */

:root {
    --mate-mint: #5EBFB0;
    --mate-mint-deep: #3A8E82;
    --mate-mint-soft: #DCF1ED;
    --mate-amber: #E8B14A;
}

/* === OVERRIDES: rose → mint para mate === */
body.mate { background: var(--cream); }
body.mate .back-link:hover { color: var(--mate-mint-deep); }
body.mate .hero::before { background: radial-gradient(circle, var(--mate-mint-deep) 0%, transparent 65%); opacity: 0.22; }
body.mate .hero-tag { color: var(--mate-mint); border-bottom-color: rgba(94, 191, 176, 0.35); }
body.mate .hero h1 em { color: var(--mate-mint); }
body.mate .hero-quote { border-left-color: var(--mate-mint); background: linear-gradient(135deg, rgba(94, 191, 176, 0.10) 0%, rgba(94, 191, 176, 0.02) 100%); }
body.mate .hero-quote-label { color: var(--mate-mint); }
body.mate .section-num { color: var(--mate-mint-deep); }
body.mate .section-title em { color: var(--mate-mint-deep); }
body.mate .ctx-card:hover, body.mate .pillar:hover, body.mate .fact-card:hover { border-color: var(--mate-mint); }
body.mate .ctx-year, body.mate .pillar-num { color: var(--mate-mint-deep); }
body.mate .fact-number, body.mate .pillar-num { color: var(--mate-mint-soft); }
body.mate .fact-card .punch, body.mate .fact-card .detail strong { color: var(--mate-mint-deep); }
body.mate .lang-fab:hover { background: var(--mate-mint-deep); box-shadow: 0 16px 40px rgba(58, 142, 130, 0.35); }
body.mate .lang-fab .pill { background: var(--mate-mint); color: var(--navy); }

/* === MATERIA TAG (top of hero) === */
.materia-crumb { display: flex; align-items: center; gap: 10px; font-family: 'Fraunces', serif; font-style: italic; color: var(--ink-soft); font-size: 14px; }
.materia-crumb a { color: var(--ink-soft); text-decoration: none; transition: color 0.2s; }
.materia-crumb a:hover { color: var(--mate-mint-deep); }
.materia-crumb-sep { color: var(--line); }

/* === IDEA CLAVE BLOCK === */
.idea-clave { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--mate-mint); border-radius: 10px; padding: 36px 42px; margin-bottom: 32px; }
.idea-clave .label { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--mate-mint-deep); font-weight: 700; margin-bottom: 14px; }
.idea-clave h3 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; line-height: 1.25; color: var(--navy); margin: 0 0 16px 0; }
.idea-clave p { font-size: 16.5px; line-height: 1.7; color: var(--ink); margin: 0 0 12px 0; }
.idea-clave p:last-child { margin-bottom: 0; }
.idea-clave .analogy { background: var(--mate-mint-soft); border-radius: 8px; padding: 18px 22px; margin-top: 18px; font-family: 'Fraunces', serif; font-style: italic; font-size: 17px; color: var(--mate-mint-deep); line-height: 1.6; }
.idea-clave .rule { background: var(--navy); color: var(--cream); border-radius: 8px; padding: 18px 22px; margin-top: 14px; font-size: 15.5px; line-height: 1.6; }
.idea-clave .rule strong { color: var(--mate-mint); font-weight: 600; }

/* === VIDEO EMBED === */
.video-block { background: var(--navy); border-radius: 16px; padding: 36px; position: relative; overflow: hidden; }
.video-block::before { content: ''; position: absolute; bottom: -100px; right: -100px; width: 300px; height: 300px; background: radial-gradient(circle, var(--mate-mint) 0%, transparent 70%); opacity: 0.15; border-radius: 50%; pointer-events: none; }
.video-meta { color: var(--cream); margin-bottom: 24px; position: relative; }
.video-meta .source { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--mate-mint); font-weight: 700; margin-bottom: 10px; }
.video-meta h3 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; margin: 0; }
.video-frame { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 10px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* === TRAMPAS / ERRORES COMUNES === */
.traps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.trap-card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 28px 32px; border-top: 3px solid var(--mate-amber); transition: all 0.3s ease; }
.trap-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 27, 61, 0.06); }
.trap-card .trap-label { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--mate-amber); font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.trap-card h4 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 19px; color: var(--navy); margin: 0 0 12px 0; line-height: 1.3; }
.trap-card p { font-size: 15px; line-height: 1.6; color: var(--ink); margin: 0 0 8px 0; }
.trap-card .wrong { color: #C9303C; font-family: 'JetBrains Mono', monospace; font-size: 14px; background: #FBEBED; padding: 6px 10px; border-radius: 4px; display: inline-block; margin: 4px 0; }
.trap-card .right { color: var(--mate-mint-deep); font-family: 'JetBrains Mono', monospace; font-size: 14px; background: var(--mate-mint-soft); padding: 6px 10px; border-radius: 4px; display: inline-block; margin: 4px 0; }

/* === EXERCISE CARD === */
.exercise-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 38px 42px; margin-bottom: 24px; transition: border-color 0.3s; }
.exercise-card:hover { border-color: var(--mate-mint); }
.exercise-card.exam-exercise { border-left: 6px solid var(--mate-mint-deep); }
.exercise-tag { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--mate-mint-deep); font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.exercise-tag .badge { background: var(--mate-mint-soft); color: var(--mate-mint-deep); padding: 4px 10px; border-radius: 100px; font-size: 10px; }
.exercise-tag .badge.exam { background: var(--navy); color: var(--cream); }
.exercise-card h4 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 20px; color: var(--navy); margin: 0 0 18px 0; line-height: 1.35; }
.exercise-statement { background: var(--cream-warm); border-radius: 8px; padding: 24px 28px; margin: 0 0 22px 0; font-size: 18px; line-height: 1.7; color: var(--navy); }
.exercise-statement .katex { font-size: 1.1em; }
.exercise-hint { font-size: 13.5px; color: var(--ink-soft); font-style: italic; margin: 0 0 18px 0; line-height: 1.5; }

/* === REVEAL BUTTON === */
.reveal-btn { background: var(--navy); color: var(--cream); border: none; border-radius: 100px; padding: 14px 28px; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; letter-spacing: 0.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; transition: all 0.25s ease; }
.reveal-btn:hover { background: var(--mate-mint-deep); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(58, 142, 130, 0.3); }
.reveal-btn[aria-expanded="true"] { background: var(--mate-mint-deep); }
.reveal-btn .icon { font-size: 16px; transition: transform 0.3s; }
.reveal-btn[aria-expanded="true"] .icon { transform: rotate(45deg); }
.reveal-btn .label-hide { display: none; }
.reveal-btn[aria-expanded="true"] .label-show { display: none; }
.reveal-btn[aria-expanded="true"] .label-hide { display: inline; }

/* === SOLUTION STEPS (collapsed by default) === */
.solution { display: none; margin-top: 24px; border-top: 1px dashed var(--line); padding-top: 24px; }
.solution.open { display: block; animation: fadeSlide 0.35s ease; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.step { display: grid; grid-template-columns: 80px 1fr; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); align-items: start; }
.step:last-child { border-bottom: none; }
.step-marker { font-family: 'Fraunces', serif; font-style: italic; color: var(--mate-mint-deep); font-size: 14px; font-weight: 600; letter-spacing: 1px; padding-top: 2px; }
.step-marker .num { display: block; font-size: 28px; line-height: 1; margin-bottom: 4px; }
.step-body .why { font-size: 14.5px; color: var(--ink-soft); line-height: 1.6; margin: 0 0 10px 0; font-style: italic; }
.step-body .do { font-size: 16px; color: var(--ink); line-height: 1.65; margin: 0 0 10px 0; }
.step-body .math { background: var(--cream-warm); border-radius: 6px; padding: 14px 18px; margin: 8px 0 0 0; overflow-x: auto; }
.step-body .math .katex-display { margin: 0; }

.step.result { background: linear-gradient(135deg, var(--mate-mint-soft) 0%, var(--cream) 100%); border-radius: 10px; padding: 22px 26px; margin-top: 16px; border-bottom: none; }
.step.result .step-marker { color: var(--mate-mint-deep); }
.step.result .step-marker .num { font-size: 18px; }
.step.result .step-body .do { font-size: 18px; font-weight: 600; color: var(--navy); }
.step.result .math { background: var(--white); border: 1px solid var(--mate-mint); }

/* === MANUEL TIP BLOCK === */
.manuel-tip { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%); color: var(--cream); border-radius: 14px; padding: 38px 42px; position: relative; overflow: hidden; }
.manuel-tip::before { content: ''; position: absolute; top: -100px; right: -100px; width: 300px; height: 300px; background: radial-gradient(circle, var(--mate-mint) 0%, transparent 70%); opacity: 0.12; border-radius: 50%; pointer-events: none; }
.manuel-tip .tip-label { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--mate-mint); font-weight: 700; margin-bottom: 14px; position: relative; }
.manuel-tip h3 { font-family: 'Fraunces', serif; font-weight: 500; font-size: 26px; margin: 0 0 18px 0; position: relative; }
.manuel-tip ul { list-style: none; padding: 0; margin: 0; position: relative; }
.manuel-tip li { padding: 10px 0 10px 28px; position: relative; font-size: 15.5px; line-height: 1.65; color: rgba(255, 251, 247, 0.92); }
.manuel-tip li::before { content: '→'; position: absolute; left: 0; color: var(--mate-mint); font-weight: 700; }
.manuel-tip li strong { color: var(--mate-mint); font-weight: 600; }

/* === KaTeX inline tweaks === */
.katex { font-size: 1em !important; }
.katex-display { margin: 12px 0 !important; }

/* === PRACTICE BOARD === */
.practice-block { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 32px 36px; }
.practice-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.chip { background: var(--cream-warm); color: var(--ink); border: 1px solid var(--line); border-radius: 100px; padding: 9px 18px; font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.chip:hover { border-color: var(--mate-mint); color: var(--mate-mint-deep); }
.chip.active { background: var(--mate-mint-deep); color: var(--cream); border-color: var(--mate-mint-deep); }
.btn-primary { background: var(--navy); color: var(--cream); border: none; border-radius: 100px; padding: 10px 20px; font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all 0.25s ease; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover { background: var(--mate-mint-deep); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 100px; padding: 10px 18px; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; }
.btn-ghost:hover { color: var(--mate-mint-deep); border-color: var(--mate-mint); }
.practice-spacer { flex: 1; }
.practice-prompt { background: var(--cream-warm); border-radius: 10px; padding: 26px 30px; font-size: 19px; line-height: 1.7; color: var(--navy); margin-bottom: 18px; min-height: 80px; display: flex; flex-direction: column; justify-content: center; }
.practice-prompt .prompt-label { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--mate-mint-deep); font-weight: 700; margin-bottom: 10px; }
.practice-prompt .prompt-task { font-family: 'Fraunces', serif; font-size: 16px; color: var(--ink-soft); font-style: italic; margin-bottom: 12px; }
.practice-prompt .prompt-math { color: var(--navy); }
.practice-canvas-wrap { position: relative; border: 2px dashed var(--line); border-radius: 10px; background: var(--white); background-image: linear-gradient(var(--cream-warm) 1px, transparent 1px), linear-gradient(90deg, var(--cream-warm) 1px, transparent 1px); background-size: 28px 28px; overflow: hidden; }
.practice-canvas-wrap.active { border-color: var(--mate-mint); border-style: solid; }
canvas.draw-canvas { display: block; width: 100%; height: 380px; cursor: crosshair; touch-action: none; }
.practice-toolbar { display: flex; gap: 10px; padding: 12px 14px; background: rgba(255,251,247,0.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.practice-toolbar-spacer { flex: 1; }
.tool-btn { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font-size: 13px; color: var(--ink-soft); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.tool-btn:hover { color: var(--mate-mint-deep); border-color: var(--mate-mint); }
.tool-btn.active { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.practice-solution { display: none; margin-top: 18px; background: linear-gradient(135deg, var(--mate-mint-soft) 0%, var(--cream) 100%); border-radius: 10px; padding: 22px 26px; border: 1px solid var(--mate-mint); }
.practice-solution.open { display: block; animation: fadeSlide 0.35s ease; }
.practice-solution .sol-label { font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--mate-mint-deep); font-weight: 700; margin-bottom: 10px; }
.practice-solution .sol-math { font-size: 18px; color: var(--navy); }
.practice-stats { font-size: 13px; color: var(--ink-soft); text-align: center; margin-top: 14px; font-family: 'Fraunces', serif; font-style: italic; }
.practice-stats strong { color: var(--mate-mint-deep); font-weight: 600; }

/* === VIDEOS GRID (galería compacta) === */
.videos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.videos-grid .video-block { padding: 24px 26px; }
.videos-grid .video-meta { margin-bottom: 14px; }
.videos-grid .video-meta .source { font-size: 10px; margin-bottom: 6px; }
.videos-grid .video-meta h3 { font-size: 17px; line-height: 1.3; }
.videos-grid .video-block::before { width: 200px; height: 200px; bottom: -80px; right: -80px; }
