/*
Theme Name:   Школа № 33 (Kadence Child)
Theme URI:    https://sg33.edu.kg
Description:  Дочерняя тема Kadence для сайта школы № 33 им. К. Токаева: цвета и настроение старого сайта.
Template:     kadence
Version:      2.4
Text Domain:  sg33
*/

/* ---------- Цвета ---------- */
html body {
	--sg-navy:   #0E4274;  /* синий эмблемы: заголовки, ссылки */
	--sg-blue:   #2B6FAD;  /* фон страницы, как на старом сайте */
	--sg-menu:   #0E4274;  /* полоса меню — тёмно-синяя */
	--sg-orange: #F5B440;  /* оранжевая полоса */
	--sg-gold:   #D9A43A;
	--sg-green:  #21844A;
	--sg-red:    #D2342E;
	--sg-beige:  #F3EFE3;  /* шапка */
	--sg-side:   #C9E2F4;  /* правая колонка */

	/* Палитра Kadence */
	--global-palette1: var(--sg-navy);
	--global-palette2: var(--sg-green);
	--global-palette3: #1A1A1A;
	--global-palette4: #2B2B2B;
	--global-palette5: #4A4A4A;
	--global-palette6: #6F6F6F;
	--global-palette7: #EAF3FA;
	--global-palette8: #F7FAFD;
	--global-palette9: #FFFFFF;
}

body {
	background: var(--sg-blue);
	font-size: 17px;
	line-height: 1.6;
}

/* ---------- Шапка ---------- */
#masthead .site-top-header-wrap .site-header-row-container-inner,
#masthead .site-main-header-wrap .site-header-row-container-inner {
	background: var(--sg-beige);
}
/* Верхняя строка (кыргызское название) — синяя, без обводок */
#masthead .site-title,
#masthead .site-title a { color: var(--sg-navy); font-weight: 700; text-shadow: none; }
/* Нижняя строка (русское название) — синяя, над ней золотая линия */
#masthead .site-description {
	color: var(--sg-navy);
	text-shadow: none;
	border-top: 2px solid var(--sg-gold);
	padding-top: 6px;
}
#masthead .custom-logo { height: 160px; max-height: none; width: auto; max-width: none; }

/* Полоса меню */
#masthead .site-bottom-header-wrap .site-header-row-container-inner {
	background: var(--sg-menu);
}
#masthead .site-bottom-header-wrap .main-navigation .primary-menu-container > ul > li > a {
	color: #fff;
	font-weight: 600;
}
#masthead .site-bottom-header-wrap .main-navigation .primary-menu-container > ul > li > a:hover,
#masthead .site-bottom-header-wrap .main-navigation .primary-menu-container > ul > li.current-menu-item > a,
#masthead .site-bottom-header-wrap .main-navigation .primary-menu-container > ul > li.current-menu-ancestor > a {
	background: var(--sg-green);
	color: #fff;
}
#masthead .main-navigation ul ul { background: var(--sg-navy); }
#masthead .main-navigation ul ul li a { color: #fff; }
#masthead .main-navigation ul ul li a:hover { background: var(--sg-green); }

/* Оранжевая полоса под шапкой */
#masthead::after {
	content: "";
	display: block;
	height: 14px;
	background: var(--sg-orange);
}

/* ---------- Контент ---------- */
#primary .content-bg,
.content-area .entry.content-bg,
.loop-entry.content-bg {
	background: #fff;
}
.site-main .entry-title,
.site-main h1, .site-main h2, .site-main h3 { color: var(--sg-navy); }
.entry-content a { color: var(--sg-navy); }
.entry-content a:hover { color: var(--sg-red); }

/* Правая колонка */
#secondary.primary-sidebar {
	background: var(--sg-side);
	padding: 20px;
	border-radius: 4px;
}
#secondary .widget-title {
	color: var(--sg-navy);
	border-bottom: 3px solid var(--sg-orange);
	padding-bottom: 6px;
}

/* Таблицы (расписания, достижения) */
.entry-content table { border-collapse: collapse; width: 100%; }
.entry-content th { background: var(--sg-navy); color: #fff; }
.entry-content th, .entry-content td { border: 1px solid #cfdbe6; padding: 6px 10px; }
.entry-content tr:nth-child(even) td { background: #f3f8fc; }

/* ---------- Подвал ---------- */
#colophon .site-footer-row-container-inner {
	background: var(--sg-navy);
	color: #fff;
}
#colophon a { color: var(--sg-orange); }
#colophon::before {
	content: "";
	display: block;
	height: 6px;
	background: var(--sg-orange);
}

@media (max-width: 767px) {
	body { font-size: 16px; }
	#masthead .custom-logo { height: 84px; }
}

/* ---------- Карточки людей и партнёров ---------- */
.sg-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 24px;
	margin: 0 0 2em;
}
.sg-card {
	margin: 0;
	background: #fff;
	border: 1px solid #dbe6f0;
	border-top: 4px solid var(--sg-orange);
	border-radius: 6px;
	padding: 14px;
	text-align: center;
}
.sg-card img {
	width: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	border-radius: 4px;
	margin-bottom: 10px;
}
.sg-card figcaption { font-size: 15px; line-height: 1.4; color: #333; }
.sg-card figcaption strong { display: block; color: var(--sg-navy); margin-bottom: 4px; }
/* логотипы партнёров не обрезаем */
.page-slug-partnery-shkoly .sg-card img,
.sg-cards.logos .sg-card img { aspect-ratio: auto; object-fit: contain; max-height: 140px; }

/* ---------- Документы и PDF ---------- */
.sg-file a {
	display: inline-block;
	background: var(--sg-navy);
	color: #fff !important;
	padding: 8px 16px;
	border-radius: 4px;
	text-decoration: none;
}
.sg-file a:hover { background: var(--sg-green); }
.sg-file span { color: #666; font-size: 14px; }
.sg-pdf { width: 100%; height: 85vh; border: 1px solid #cfdbe6; margin-bottom: 2em; }
@media (max-width: 767px) { .sg-pdf { display: none; } }

.sg-table { overflow-x: auto; margin-bottom: 1.5em; }
.sg-npa li { margin-bottom: 10px; }
.sg-npa-links a { font-weight: 600; }
.entry-content iframe { max-width: 100%; }

/* ---------- v0.3: полоса меню (усиленно) ---------- */
body #masthead .site-bottom-header-wrap,
body #masthead .site-bottom-header-wrap .site-header-row-container-inner {
	background: var(--sg-menu) !important;
	border: 0 !important;
}
body #masthead .site-bottom-header-wrap .site-header-row { min-height: 52px; }
body #masthead .site-bottom-header-wrap .header-navigation .menu > li > a,
body #masthead .site-bottom-header-wrap .main-navigation .primary-menu-container > ul > li > a {
	color: #fff !important;
	font-weight: 600;
	padding-top: 14px;
	padding-bottom: 14px;
}
body #masthead .site-bottom-header-wrap .header-navigation .menu > li > a:hover,
body #masthead .site-bottom-header-wrap .header-navigation .menu > li.current-menu-item > a,
body #masthead .site-bottom-header-wrap .header-navigation .menu > li.current-menu-ancestor > a {
	background: var(--sg-green) !important;
	color: #fff !important;
}
body #masthead .header-navigation .sub-menu { background: var(--sg-navy) !important; }
body #masthead .header-navigation .sub-menu a { color: #fff !important; }
body #masthead .header-navigation .sub-menu a:hover { background: var(--sg-green) !important; }

/* Название и подпись в шапке */
#masthead .site-branding .site-title { font-size: 26px; line-height: 1.2; }
#masthead .site-branding .site-description { font-size: 26px; line-height: 1.2; font-weight: 700; margin-top: 6px; }

/* Компактный заголовок страницы вместо большого блока */
.entry-hero .entry-hero-container-inner { background: var(--sg-beige) !important; }
.entry-hero .entry-header { min-height: 0 !important; padding: 22px 0 !important; }
.entry-hero .entry-title { color: var(--sg-navy); font-size: 30px; }

/* ---------- Новости школы в правой колонке: каждая в рамке ---------- */
#secondary .wp-block-latest-posts { padding: 0; margin: 0; }
#secondary .wp-block-latest-posts li {
	list-style: none;
	background: #fff;
	border-left: 4px solid var(--sg-orange);
	border-radius: 4px;
	padding: 10px 12px;
	margin-bottom: 12px;
	box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
#secondary .wp-block-latest-posts li a { color: var(--sg-navy); font-weight: 600; text-decoration: none; }
#secondary .wp-block-latest-posts__post-date { display: block; color: #666; font-size: 13px; }

@media (max-width: 1024px) {
	#masthead .site-branding .site-title { font-size: 20px; }
	#masthead .site-branding .site-description { font-size: 20px; }
}

/* ---------- v0.7: пункты меню как зелёные вкладки ---------- */
body #masthead .site-bottom-header-wrap .header-navigation .menu > li > a {
	border-radius: 6px 6px 0 0;
	margin-top: 6px;
	transition: background .15s;
}
body #masthead .site-bottom-header-wrap .header-navigation .menu > li > a:hover,
body #masthead .site-bottom-header-wrap .header-navigation .menu > li.current-menu-item > a,
body #masthead .site-bottom-header-wrap .header-navigation .menu > li.current-menu-ancestor > a {
	background: var(--sg-green) !important;
}

/* ---------- v1.0: текст на всю ширину и по ширине ---------- */
.entry-content.single-content > *,
.entry-content > p,
.entry-content > ul,
.entry-content > ol,
.entry-content > h2,
.entry-content > h3 {
	max-width: none !important;
}
.entry-content p,
.entry-content li {
	text-align: justify;
	hyphens: auto;
	-webkit-hyphens: auto;
}
.entry-content .sg-card figcaption,
.entry-content .sg-file,
.entry-content td,
.entry-content th { text-align: left; hyphens: manual; }
.entry-content .sg-card figcaption { text-align: center; }

/* ---------- v1.1: карточки одинаковой высоты ---------- */
.sg-cards {
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	align-items: stretch;
}
.sg-card {
	height: 100%;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}
.sg-card figcaption { flex: 1; }
.sg-card figcaption strong { display: block; }

/* ---------- v1.2: новости сплошной лентой, как на старом сайте ---------- */
.sg-news { margin-top: 2em; }
.sg-news-heading { border-bottom: 3px solid var(--sg-orange); padding-bottom: 6px; }
.sg-news-item { padding: 18px 0; border-bottom: 1px solid #dbe6f0; }
.sg-news-title { margin: 0 0 4px; font-size: 22px; }
.sg-news-title a { color: var(--sg-navy); text-decoration: none; }
.sg-news-title a:hover { color: var(--sg-green); }
.sg-news-date { color: #777; font-size: 14px; margin-bottom: 10px; }
.sg-news-body img { max-width: 100%; height: auto; }
.sg-more a { font-weight: 600; color: var(--sg-green); }
.sg-news-pages { margin: 20px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.sg-news-pages .page-numbers { padding: 6px 12px; border: 1px solid #cfdbe6; border-radius: 4px; text-decoration: none; }
.sg-news-pages .current { background: var(--sg-navy); color: #fff; border-color: var(--sg-navy); }

/* Списки рубрик: одна колонка, без карточек-плиток */
.post-archive.grid-cols,
.content-wrap.grid-cols { grid-template-columns: 1fr !important; }
.post-archive .loop-entry {
	box-shadow: none !important;
	border-radius: 0 !important;
	border-bottom: 1px solid #dbe6f0;
}
.post-archive .loop-entry .entry-summary { max-width: none; }
.post-archive .loop-entry .post-thumbnail { display: none; }

/* ---------- v1.3: короткие анонсы новостей ---------- */
.sg-news-item { overflow: hidden; }
.sg-news-thumb { float: left; margin: 4px 18px 8px 0; }
.sg-news-thumb img {
	width: 200px;
	height: 140px;
	object-fit: cover;
	border-radius: 4px;
	display: block;
}
.sg-news-text { margin: 0 0 10px; }
.sg-btn {
	display: inline-block;
	background: var(--sg-green);
	color: #fff !important;
	padding: 6px 16px;
	border-radius: 4px;
	text-decoration: none;
	font-weight: 600;
	font-size: 15px;
}
.sg-btn:hover { background: var(--sg-navy); }
@media (max-width: 600px) {
	.sg-news-thumb { float: none; margin: 0 0 10px; }
	.sg-news-thumb img { width: 100%; height: 180px; }
}

/* ---------- v1.4: крупный заголовок, мелкий анонс ---------- */
.sg-news-title { font-size: 26px; line-height: 1.25; }
.sg-news-date { font-size: 13px; }
.sg-news-text { font-size: 14px; line-height: 1.55; color: #444; }
.sg-btn { font-size: 13px; padding: 5px 14px; }
@media (max-width: 600px) { .sg-news-title { font-size: 21px; } }

/* ---------- v1.5: фото в старых статьях — по две в ряд ---------- */
/* WordPress сам вставляет переносы строк между картинками старого HTML — убираем их */
.single-content a:has(> img) + br,
.single-content img + br { display: none; }
.single-content p > a:has(> img),
.single-content > a:has(> img) {
	display: inline-block;
	width: calc(50% - 8px);
	margin: 0 6px 10px 0;
	vertical-align: top;
}
.single-content a:has(> img) > img {
	width: 100%;
	height: auto;
	border-radius: 4px;
}
@media (max-width: 600px) {
	.single-content p > a:has(> img),
	.single-content > a:has(> img) { width: 100%; margin-right: 0; }
}

/* ---------- v1.6: блок «О школе» на главной ---------- */
.sg-about {
	background: #F7FAFD;
	border: 1px solid #dbe6f0;
	border-left: 5px solid var(--sg-orange);
	border-radius: 0 6px 6px 0;
	padding: 18px 22px;
	overflow: hidden;
	margin-bottom: 1.5em;
}
.sg-about img { float: left; width: 42%; max-width: 420px; height: auto; margin: 0 22px 10px 0; border-radius: 4px; }
.sg-about p:last-child { margin-bottom: 0; }
@media (max-width: 700px) { .sg-about img { float: none; width: 100%; max-width: none; margin: 0 0 12px; } }

/* ---------- «Гордость школы» — сменяющиеся фото ---------- */
.sg-pride { position: relative; aspect-ratio: 3 / 4; background: #fff; border: 1px solid #dbe6f0; border-radius: 4px; overflow: hidden; }
.sg-pride-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s; text-decoration: none; }
.sg-pride-slide.on { opacity: 1; z-index: 1; }
.sg-pride-slide img { width: 100%; height: calc(100% - 46px); object-fit: cover; object-position: top; display: block; }
.sg-pride-slide span {
	display: flex; align-items: center; justify-content: center;
	height: 46px; padding: 0 8px; text-align: center;
	font-family: Georgia, "Times New Roman", serif; font-size: 15px; color: #222; background: #fff;
}

/* v1.7: картинка без ссылки — тоже по две в ряд */
.single-content p > img + img,
.single-content p > img:has(+ img) {
	display: inline-block;
	width: calc(50% - 8px);
	margin: 0 6px 10px 0;
	vertical-align: top;
}

/* ---------- v1.8: исправления ---------- */
/* две картинки в ряд: оставляем запас на пробел между ними */
.single-content p > a:has(> img),
.single-content > a:has(> img),
.single-content p > img + img,
.single-content p > img:has(+ img) {
	width: calc(50% - 14px) !important;
}
/* миниатюры в ленте новостей — маленькие, не на всю ширину */
.sg-news .sg-news-thumb {
	display: block !important;
	float: left;
	width: 200px !important;
	margin: 4px 18px 8px 0 !important;
}
.sg-news .sg-news-thumb img {
	width: 200px !important;
	height: 140px !important;
	object-fit: cover;
}
@media (max-width: 600px) {
	.sg-news .sg-news-thumb { float: none; width: 100% !important; }
	.sg-news .sg-news-thumb img { width: 100% !important; height: 180px !important; }
	.single-content p > a:has(> img),
	.single-content > a:has(> img) { width: 100% !important; }
}

/* v1.9: «Гордость школы» из папки готовых фото (имя уже на фото) */
.sg-pride.sg-pride-folder { aspect-ratio: 2 / 3; max-width: 240px; margin: 0 auto; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.sg-pride-photo img { height: 100% !important; object-fit: cover; }

/* ---------- v2.0: слайд-шоу [sg33_slides] ---------- */
.sg-slides { position: relative; aspect-ratio: 5 / 3; border-radius: 6px; overflow: hidden; background: #e9eef3; margin-bottom: 1em; }
.sg-slide { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: cover; opacity: 0; transition: opacity .9s; }
.sg-slide.on { opacity: 1; }
.sg-slides .sg-prev, .sg-slides .sg-next {
	position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
	width: 36px; height: 36px; border: 0; border-radius: 50%;
	background: rgba(14,66,116,.6); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0;
}
.sg-slides .sg-prev { left: 10px; } .sg-slides .sg-next { right: 10px; }
.sg-slides .sg-prev:hover, .sg-slides .sg-next:hover { background: var(--sg-green); }
.sg-dots { position: absolute; bottom: 10px; left: 0; right: 0; z-index: 2; display: flex; justify-content: center; gap: 6px; }
.sg-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.6); cursor: pointer; }
.sg-dots button.on { background: var(--sg-orange); }
/* В блоке «О школе»: слайдер слева, текст справа */
.sg-about .sg-slides { float: left; width: 46%; margin: 0 24px 10px 0; }
@media (max-width: 800px) { .sg-about .sg-slides { float: none; width: 100%; margin-right: 0; } }

/* v2.3: слайд-шоу вверху обычной страницы — по центру, не шире 720px */
.entry-content > .sg-slides,
.entry-content > p > .sg-slides { max-width: 720px; margin: 0 auto 1.5em; }

/* v2.4: слайд-шоу на страницах — не шире 720px, по центру; в блоке «О школе» — как было */
.sg-slides { max-width: 720px; margin-left: auto; margin-right: auto; }
.sg-about .sg-slides { max-width: none; margin-left: 0; }
