/* Справочник ОГЭ (templates/courses/oge_reference.html): карточки с формулами в стиле сайта. */

.ref-print { margin-left: 8px; font-size: var(--fs-small); vertical-align: middle; }

.ref-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: max(14px, calc(20 * var(--u))) 0 max(28px, calc(40 * var(--u)));
}

.ref-toc .pill { font-size: max(13px, calc(17 * var(--u))); padding: 4px 14px; }

.ref-section { margin-bottom: max(28px, calc(44 * var(--u))); scroll-margin-top: 20px; }

.ref-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: max(12px, calc(18 * var(--u)));
    font-family: var(--font-display);
    font-size: var(--fs-large);
    text-transform: lowercase;
}

/* цветной кружок у заголовка раздела — как кружки в заголовках сайта */
.ref-dot { flex: none; width: 0.9em; height: 0.9em; border-radius: 50%; }
.ref-dot--red { background: var(--red); }
.ref-dot--blue { background: var(--blue); }
.ref-dot--green { background: var(--green); }
.ref-dot--yellow { background: var(--yellow); }

.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 0 max(14px, calc(20 * var(--u)));
}

.ref-grid--three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }

.card.ref-card { font-size: var(--fs-small); }

.ref-card h3 {
    margin: 0 0 10px;
    font-family: var(--font-text);
    font-size: var(--fs-body);
    font-weight: 600;
}

.ref-card h3 + .ref-list { margin-top: 0; }
.ref-card .ref-list + h3 { margin-top: 18px; }

/* формулы: переменные — курсивом с засечками, как в учебнике */
.ref-card i {
    font-family: 'Cambria Math', Cambria, 'Times New Roman', serif;
    font-size: 1.12em;
    font-style: italic;
}

.ref-list { list-style: none; }

.ref-list li {
    position: relative;
    padding: 7px 0 7px 18px;
    line-height: 1.7;
    border-bottom: 1.5px dashed rgba(0, 0, 0, 0.12);
}

.ref-list li:last-child { border-bottom: 0; }

.ref-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.05em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pink);
}

.ref-list--columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    column-gap: 28px;
}

.ref-list--columns li:last-child { border-bottom: 1.5px dashed rgba(0, 0, 0, 0.12); }

.ref-cond { color: rgba(0, 0, 0, 0.6); font-size: 0.9em; white-space: nowrap; }
.inner .ref-note { margin: 10px 0 0; color: rgba(0, 0, 0, 0.7); }
.ref-paren { font-size: 1.6em; line-height: 1; vertical-align: middle; }

/* дробь: числитель над знаменателем */
.fr {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 0.15em;
    font-size: 0.92em;
    line-height: 1.25;
    text-align: center;
}

.fr > span { padding: 0 0.2em; white-space: nowrap; }
.fr > span:first-child { border-bottom: 1.5px solid currentColor; }

/* корень: черта над подкоренным выражением */
.rt { white-space: nowrap; }
.rt > span { border-top: 1.5px solid currentColor; padding: 0 0.1em; margin-left: 0.05em; }

/* таблицы */
.ref-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.ref-squares,
.ref-trig {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
}

.ref-squares th,
.ref-squares td,
.ref-trig th,
.ref-trig td {
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    text-align: center;
    white-space: nowrap;
}

.ref-squares thead th,
.ref-trig thead th { background: var(--yellow); }

.ref-squares tbody th,
.ref-trig tbody th { background: rgba(79, 150, 216, 0.18); font-weight: 600; }

.ref-squares tbody tr:nth-child(even) td { background: rgba(0, 0, 0, 0.03); }
.ref-squares td { font-size: max(13px, calc(17 * var(--u))); }
.ref-trig { margin-bottom: 14px; }
.ref-trig td { padding: 8px 10px; font-size: var(--fs-small); }

@media (max-width: 700px) {
    .ref-print { display: none; }
    .ref-squares th, .ref-squares td { padding: 5px 6px; font-size: 13px; }
}

/* печать: только справочник, без шапки и украшений, компактно */
@media print {
    .site-header, .decor, .m-decor, .ref-toc, .ref-print, .messages { display: none !important; }
    body, .page { background: #fff !important; }
    .card.ref-card { border-width: 1.5px; border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; break-inside: avoid; background: #fff; }
    .ref-section { margin-bottom: 14px; break-inside: avoid-page; }
    .ref-list li { padding: 3px 0 3px 14px; line-height: 1.5; }
    .ref-squares, .ref-trig { border-radius: 0; }
}
