/*
	Справочники /apps — общие стили поверх Bootstrap 6.
	Только переменные --bs-*, поэтому светлая и тёмная темы работают без правок.
*/

/* ---------- Заголовок страницы ---------- */
.app-head { margin-bottom: 1.5rem; }
.app-head .breadcrumb { margin-left: -.75rem; margin-bottom: .5rem; }
.app-head h1 { font-weight: 700; margin-bottom: .5rem; text-wrap: balance; }
.app-lead { color: var(--bs-fg-3); max-width: 68ch; margin-bottom: 0; }

.app-section-title {
	display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
	margin: 2.5rem 0 1rem;
}
.app-section-title h2 { font-size: 1.25rem; font-weight: 700; margin: 0; }

/* ---------- Карточки на главной ---------- */
.app-tile { height: 100%; transition: box-shadow .2s ease, transform .2s ease; }
.app-tile:hover { box-shadow: var(--bs-box-shadow-lg, 0 .5rem 1.5rem rgba(0,0,0,.08)); transform: translateY(-2px); }
.app-tile .card-body { gap: .35rem; }
.app-tile-title { font-weight: 700; line-height: 1.25; }
.app-tile-text { color: var(--bs-fg-3); font-size: .875rem; margin: 0; }
.app-tile-img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: var(--bs-bg-2); }

.app-icon {
	width: 3rem; height: 3rem; flex-shrink: 0;
	display: inline-flex; align-items: center; justify-content: center;
	border-radius: var(--bs-radius-7);
	background: var(--bs-primary-bg-subtle); color: var(--bs-primary-fg);
	font-size: 1.5rem; line-height: 1;
	margin-bottom: .5rem;
}
.app-icon svg { width: 1.5rem; height: 1.5rem; }

@media (width < 768px) {
	.app-tile-row { flex-direction: row; align-items: center; }
	.app-tile-row .app-tile-img { width: 7rem; aspect-ratio: 1; }
}

/* ---------- Панели калькулятора ---------- */
.app-panel { border-radius: var(--bs-radius-9); }
.app-panel > .card-body { gap: 1rem; }
.app-panel-title { font-size: 1rem; font-weight: 700; margin: 0; }

.app-field .form-label { margin-bottom: .35rem; }
.app-field .form-text { color: var(--bs-fg-3); font-size: .8125rem; margin-top: .35rem; }

@media (width >= 1024px) {
	.app-sticky { position: sticky; top: 1rem; }
}

/* ---------- Результаты ---------- */
.app-stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.app-stats-2 { grid-template-columns: 1fr 1fr; }
.app-stats-3 { grid-template-columns: repeat(3, 1fr); }
@media (width < 576px) { .app-stats-3 { grid-template-columns: 1fr 1fr; } }
.app-stat {
	padding: .875rem 1rem;
	border-radius: var(--bs-radius-7);
	background: var(--bs-bg-1);
	border: 1px solid var(--bs-border-color);
	min-width: 0;
}
.app-stat-label { display: block; color: var(--bs-fg-3); font-size: .8125rem; margin-bottom: .2rem; }
.app-stat-value { display: block; font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.app-stat-sub { display: block; color: var(--bs-fg-3); font-size: .8125rem; margin-top: .2rem; }

.app-stat.is-main { background: var(--bs-primary-bg-subtle); border-color: transparent; }
.app-stat.is-main .app-stat-value { font-size: 2rem; color: var(--bs-primary-fg); }
.app-stat.is-ok     { background: var(--bs-success-bg-subtle); border-color: transparent; }
.app-stat.is-warn   { background: var(--bs-warning-bg-subtle); border-color: transparent; }
.app-stat.is-danger { background: var(--bs-danger-bg-subtle);  border-color: transparent; }

.app-formula {
	font-family: var(--bs-font-mono); font-size: .875rem;
	background: var(--bs-bg-1); border-radius: var(--bs-radius-5);
	padding: .5rem .75rem; color: var(--bs-fg-2);
}

.app-mono { font-family: var(--bs-font-mono); font-variant-numeric: tabular-nums; }
.app-nowrap { white-space: nowrap; }

/* Подсветка вычисленного поля */
.app-computed .form-control { background: var(--bs-success-bg-subtle); border-color: var(--bs-success-fg); }

/* ---------- Текстовая часть (SEO) ---------- */
.app-article { max-width: 75ch; }
.app-article h2 { font-size: 1.375rem; font-weight: 700; margin-top: 2rem; }
.app-article h3 { font-size: 1.125rem; font-weight: 700; margin-top: 1.5rem; }
.app-article p, .app-article li { color: var(--bs-fg-2); }

/* ---------- Таблицы ---------- */
.app-table th { font-size: .8125rem; color: var(--bs-fg-3); font-weight: 600; white-space: nowrap; }
.app-table td { font-variant-numeric: tabular-nums; }
.app-table tr.is-active td { background: var(--bs-primary-bg-subtle); }
.app-table-scroll { max-height: 32rem; overflow: auto; }
.app-table-scroll thead th { position: sticky; top: 0; background: var(--bs-bg-body); z-index: 1; }

/* ---------- Резистор (SVG) ---------- */
.res-svg { width: 100%; height: auto; display: block; user-select: none; }
.res-band { cursor: pointer; transition: filter .15s ease; }
.res-band:hover { filter: brightness(1.15); }
.res-band-hit { fill: transparent; cursor: pointer; }
.res-band-mark { fill: none; stroke: var(--bs-primary-base); stroke-width: 3; rx: 4; opacity: 0; transition: opacity .15s; }
.res-band-group.is-active .res-band-mark { opacity: 1; }
.res-band-label { font-size: 13px; fill: var(--bs-fg-3); text-anchor: middle; }
.res-band-group.is-active .res-band-label { fill: var(--bs-primary-fg); font-weight: 700; }

/* Палитра цветов полосы */
.res-palette { display: flex; flex-wrap: wrap; gap: .5rem; }
.res-swatch {
	--sw: #000;
	display: inline-flex; align-items: center; gap: .4rem;
	padding: .3rem .65rem .3rem .3rem;
	border-radius: 2rem;
	border: 1px solid var(--bs-border-color);
	background: var(--bs-bg-body); color: var(--bs-fg-body);
	font-size: .8125rem; cursor: pointer; line-height: 1.2;
}
.res-swatch::before {
	content: ""; width: 1.25rem; height: 1.25rem; border-radius: 50%;
	background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.res-swatch:hover { background: var(--bs-bg-1); }
.res-swatch.is-active { border-color: var(--bs-primary-base); box-shadow: 0 0 0 2px var(--bs-primary-bg-subtle); font-weight: 600; }
.res-swatch small { color: var(--bs-fg-3); }

.res-chips { display: inline-flex; gap: 3px; vertical-align: middle; }
.res-chips i { width: .7rem; height: 1.25rem; border-radius: 2px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }

/* ---------- SMD резистор ---------- */
.smd-chip {
	position: relative; display: flex; align-items: stretch;
	max-width: 22rem; margin: 0 auto;
	filter: drop-shadow(0 .5rem 1rem rgba(0,0,0,.15));
}
.smd-chip-pad { width: 14%; background: linear-gradient(180deg, #e3e3e3, #a9a9a9 50%, #dcdcdc); border-radius: .5rem 0 0 .5rem; }
.smd-chip-pad:last-child { border-radius: 0 .5rem .5rem 0; }
.smd-chip-body { flex: 1; background: linear-gradient(180deg, #2b2b2b, #111); padding: 1.5rem .75rem; }
.smd-chip-input {
	width: 100%; border: 0; outline: 0; background: transparent;
	color: #f2f2f2; text-align: center; text-transform: uppercase;
	font: 700 clamp(2rem, 7vw, 3rem)/1 var(--bs-font-mono); letter-spacing: .15em;
	caret-color: var(--bs-primary-base);
}
.smd-chip-input::placeholder { color: #5b5b5b; }

/* ---------- Схемы (делитель, светодиод, параллель) ---------- */
.app-schema { width: 100%; height: auto; display: block; color: var(--bs-fg-2); }
.app-schema .wire { stroke: currentColor; stroke-width: 2.5; fill: none; stroke-linecap: round; }
.app-schema .part { fill: var(--bs-bg-1); stroke: currentColor; stroke-width: 2.5; }
.app-schema .part-accent { fill: var(--bs-primary-bg-subtle); stroke: var(--bs-primary-fg); stroke-width: 2.5; }
.app-schema text { fill: currentColor; font-size: 14px; font-family: var(--bs-font-mono); }
.app-schema .val { fill: var(--bs-primary-fg); font-weight: 700; }
.app-schema .dot { fill: currentColor; }

/* LED светится, когда расчёт корректен */
.led-glow { opacity: 0; transition: opacity .3s; }
.is-lit .led-glow { opacity: .55; }

/* ---------- Список резисторов (параллель) ---------- */
.par-row { display: flex; align-items: center; gap: .5rem; }
.par-row .badge { min-width: 2.25rem; justify-content: center; }

/* ---------- Компрессоры ---------- */
.cmp-card { height: 100%; }
.cmp-card .card-body { gap: .5rem; padding: 1rem; }
.cmp-model { font: 700 1.125rem/1.2 var(--bs-font-mono); }
.cmp-brand { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-fg-3); }
.cmp-specs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .75rem; font-size: .8125rem; }
.cmp-specs span { color: var(--bs-fg-3); }
.cmp-specs b { font-variant-numeric: tabular-nums; }
.cmp-card.is-exact { border-color: var(--bs-primary-base); }

/* ---------- Мобильные ---------- */
@media (width < 768px) {
	.app-scroll-x { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--bs-gutter-x, 1.5rem) * -.5); padding-inline: calc(var(--bs-gutter-x, 1.5rem) * .5); }
	.app-scroll-x::-webkit-scrollbar { display: none; }
	.app-scroll-x > * { white-space: nowrap; flex-shrink: 0; }
	.app-section-title a { white-space: nowrap; }
}

/* ---------- Реклама (js/ads.js) ---------- */
.ad-card { display: flex; gap: 1rem; align-items: center; padding: .9rem 1rem; border: 1px solid var(--bs-border-color); border-radius: var(--bs-radius-9, 1rem); background: var(--bs-bg-1); color: var(--bs-fg-body); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.ad-card:hover { border-color: var(--bs-primary-bg, #0d6efd); box-shadow: 0 .5rem 1.25rem rgba(0,0,0,.06); }
.ad-card img { width: 6rem; height: 6rem; object-fit: contain; border-radius: .6rem; flex-shrink: 0; background: #fff; }
.ad-card-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ad-card-body small { color: var(--bs-fg-3); font-size: .75rem; }
.ad-card-body b { font-size: 1.0625rem; line-height: 1.3; }
.ad-card-body > span:not(.btn-sm) { color: var(--bs-fg-1); font-size: .9375rem; }
.ad-site_content { margin: 1.5rem 0; }
.ad-site_sidebar .ad-card { flex-direction: column; align-items: stretch; }
.ad-site_sidebar .ad-card img { width: 100%; height: 9rem; }
@media (max-width: 575.98px) { .ad-card img { width: 4.5rem; height: 4.5rem; } }
