/* ==========================================================================
   BetAhoy Sportline — базовый слой
   Токены, типографика, каркас секций, кнопки, таблицы, списки.
   Правило по теме: colander печатает :root инлайном ПОСЛЕ wp_head, поэтому
   переменные переопределяем через html:root (специфичность выше).
   ========================================================================== */

html:root {
	/* Поверхности. Базовый #13273d приходит из ACF в inline style у body — не трогаем его,
	   глубину даём слоями темнее и светлее. */
	--bh-base: #13273d;
	--bh-deep: #0b1728;
	--bh-deep-2: #0f2134;
	--bh-surface: #1a3350;
	--bh-surface-2: #22405f;

	--bh-line: rgba(255, 255, 255, .10);
	--bh-line-2: rgba(255, 255, 255, .20);

	--bh-orange: #f7843e;
	--bh-orange-700: #e2661b;
	--bh-orange-300: #ffb277;
	--bh-glow: rgba(226, 102, 27, .34);

	--bh-text: #f2f7fc;
	--bh-dim: #adc3d8;
	--bh-yes: #46d69a;
	--bh-no: #ff7a7a;

	--bh-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
	--bh-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--bh-r-sm: 6px;
	--bh-r: 12px;
	--bh-r-lg: 18px;
	--bh-skew: -14deg;
	--bh-notch: 12px;
	--bh-ease: cubic-bezier(.2, .7, .3, 1);
	--bh-shadow: 0 18px 40px rgba(0, 0, 0, .38);
	--bh-measure: 72ch;
	--bh-measure-wide: 1080px;

	/* Тема читает --body-font из ACF (список ограничен Montserrat/Roboto/Poppins),
	   свой шрифт подставляем здесь. */
	--body-font: "Inter";
	/* Поля color_burger в ACF-группе colander нет — на тёмной шапке полоски бургера
	   уходят в фолбэк accent_color_text и становятся невидимыми. */
	--burger-color: #f7843e;
}

/* --------------------------------------------------------------------------
   1. База
   -------------------------------------------------------------------------- */

body {
	font-family: var(--bh-body);
	font-size: 17px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	/* Тема включает hyphens:auto — на английском тексте это рваные переносы. */
	-ms-hyphens: manual;
	hyphens: manual;
}

main {
	position: relative;
	background-color: var(--bh-base);
}

/* Фоновая подсветка страницы: свет с левого верха, глубина к низу. */
main::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background:
		radial-gradient(70% 45% at 8% 0%, rgba(247, 132, 62, .10) 0%, transparent 60%),
		radial-gradient(60% 40% at 100% 12%, rgba(90, 150, 210, .08) 0%, transparent 65%);
}

main > * {
	position: relative;
	z-index: 1;
}

body .container {
	max-width: 1280px;
}

/* Якорные переходы не должны прятать заголовок под липкой шапкой. */
main [id],
.section-tag[id] {
	scroll-margin-top: 96px;
}

:focus-visible {
	outline: 2px solid var(--bh-orange);
	outline-offset: 3px;
	border-radius: 2px;
}

::selection {
	background: var(--bh-orange);
	color: var(--bh-deep);
}

/* --------------------------------------------------------------------------
   2. Типографика
   -------------------------------------------------------------------------- */

main h1,
main h2,
main h3,
main h4,
main h5,
main h6,
main .title {
	font-family: var(--bh-display);
	color: var(--bh-text);
	text-transform: uppercase;
	letter-spacing: .01em;
	text-wrap: balance;
}

main h1,
main .media-text__heading h1.title {
	font-size: clamp(2.3rem, 1.5rem + 2.6vw, 3.4rem);
	font-weight: 700;
	line-height: 1.04;
	letter-spacing: -.005em;
}

main h2,
main .media-text__heading h2.title {
	font-size: clamp(1.85rem, 1.35rem + 1.5vw, 2.5rem);
	font-weight: 700;
	line-height: 1.08;
}

main h3 {
	font-size: clamp(1.3rem, 1.15rem + .5vw, 1.55rem);
	font-weight: 600;
	line-height: 1.15;
}

main h4,
main h5,
main h6 {
	font-size: 1.15rem;
	font-weight: 600;
	line-height: 1.2;
}

main p,
main li {
	font-family: var(--bh-body);
	font-size: 1.0625rem;
	font-weight: 400;
	line-height: 1.72;
	color: var(--bh-dim);
	text-transform: none;
	letter-spacing: 0;
}

main .media-text__content p,
main .hidden-text__content p,
main .howto__text p {
	margin: 0 0 1.1rem;
}

main .media-text__content p:last-child,
main .hidden-text__content p:last-child,
main .howto__text p:last-child {
	margin-bottom: 0;
}

/* Ссылки в прозе: без сплошного подчёркивания, с анимированной чертой. */
main .media-text__content a:not(.site-button),
main .hidden-text__content a:not(.site-button),
main .howto__text a:not(.site-button) {
	color: var(--bh-orange);
	font-weight: 600;
	text-decoration: none;
	background-image: linear-gradient(var(--bh-orange), var(--bh-orange));
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 100% 1px;
	transition: background-size .2s var(--bh-ease), color .2s;
}

main .media-text__content a:not(.site-button):hover,
main .hidden-text__content a:not(.site-button):hover,
main .howto__text a:not(.site-button):hover {
	color: var(--bh-orange-300);
	background-size: 100% 2px;
}

/* Списки: маркер-ромб вместо круглой точки темы. */
main ul:not(:where(.mc-catalog *)) li,
main ol:not(:where(.mc-catalog *)) li {
	margin: .55rem 0;
}

main .media-text__content ul li,
main .hidden-text__content ul li {
	padding-left: 30px;
}

main .media-text__content ul li::after,
main .hidden-text__content ul li::after {
	width: 9px;
	height: 9px;
	top: .62em;
	border-radius: 1px;
	background-color: var(--bh-orange);
	transform: skewX(var(--bh-skew));
}

main .media-text__content ol,
main .hidden-text__content ol {
	padding-left: 0;
	list-style: none;
	counter-reset: bh-ol;
}

main .media-text__content ol li,
main .hidden-text__content ol li {
	counter-increment: bh-ol;
	padding-left: 46px;
	position: relative;
}

main .media-text__content ol li::before,
main .hidden-text__content ol li::before {
	content: counter(bh-ol);
	position: absolute;
	left: 0;
	top: -1px;
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--bh-display);
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--bh-orange);
	background: rgba(247, 132, 62, .12);
	border: 1px solid rgba(247, 132, 62, .35);
	border-radius: var(--bh-r-sm);
	transform: skewX(var(--bh-skew));
}

main .media-text__content ol li::marker,
main .hidden-text__content ol li::marker {
	content: "";
}

/* --------------------------------------------------------------------------
   3. Секции и заголовки разделов
   -------------------------------------------------------------------------- */

main > .section-tag {
	padding: 2.75rem 0;
}

/* Заголовок раздела: скошенная оранжевая метка слева + затухающая линия под ним.
   Тема центрует заголовок флексом обёртки, а не text-align — перебиваем в её же форме. */
main .media-text__heading-top .media-text__heading {
	justify-content: flex-start;
	width: 100%;
	margin-bottom: 1.7rem;
}

main .section-tag .media-text__heading .title {
	position: relative;
	padding-left: 26px;
	margin-bottom: 0;
}

main .section-tag .media-text__heading .title::before {
	content: "";
	position: absolute;
	left: 0;
	top: .1em;
	bottom: .12em;
	width: 9px;
	background: linear-gradient(180deg, var(--bh-orange-300), var(--bh-orange-700));
	transform: skewX(var(--bh-skew));
}

/* Тема вешает короткую оранжевую полосу на любой h2 внутри секции, включая заголовки
   шагов how-to. Снимаем её везде и рисуем свою только у заголовков разделов. */
main .section-tag h2:not(:where(.mc-catalog *))::after {
	content: none;
}

main .section-tag .media-text__heading .title::after {
	content: "";
	position: absolute;
	left: 0;
	top: calc(100% + 14px);
	width: 100%;
	max-width: none;
	height: 2px;
	transform: none;
	background: linear-gradient(90deg, var(--bh-orange) 0, rgba(247, 132, 62, .05) 62%, transparent 100%);
}

/* --------------------------------------------------------------------------
   4. Первый экран (#intro есть на каждой странице сайта)
   -------------------------------------------------------------------------- */

main > #intro {
	padding: 3.75rem 0 3.5rem;
	overflow: hidden;
	border-bottom: 1px solid var(--bh-line);
	background:
		radial-gradient(90% 120% at 10% -10%, rgba(247, 132, 62, .20) 0%, transparent 58%),
		linear-gradient(180deg, var(--bh-deep) 0%, var(--bh-base) 92%);
}

/* Диагональная штриховка справа — фирменный «спортивный» акцент. */
main > #intro::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: repeating-linear-gradient(104deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 24px);
	-webkit-mask-image: linear-gradient(90deg, transparent 45%, #000 100%);
	mask-image: linear-gradient(90deg, transparent 45%, #000 100%);
}

main > #intro > .container {
	position: relative;
	z-index: 1;
}

main > #intro .media-text__heading {
	margin-bottom: 1.6rem;
}

main > #intro .media-text__content p {
	color: #cbdcec;
	font-size: 1.125rem;
	line-height: 1.7;
}

main > #intro .media-text__content p:first-of-type {
	font-size: 1.22rem;
	line-height: 1.6;
	color: var(--bh-text);
	font-weight: 500;
}

/* --------------------------------------------------------------------------
   5. Кнопки
   -------------------------------------------------------------------------- */

main .site-button,
.header-panel .site-button,
.page-header .site-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 0;
	padding: .85rem 1.9rem;
	border: none;
	border-radius: var(--bh-r-sm);
	font-family: var(--bh-display);
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: .045em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--bh-deep);
	background: linear-gradient(180deg, var(--bh-orange-300) -25%, var(--bh-orange) 45%, var(--bh-orange-700) 135%);
	box-shadow: 0 10px 24px rgba(226, 102, 27, .26);
	clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--bh-notch)), calc(100% - var(--bh-notch)) 100%, 0 100%);
	transition: transform .18s var(--bh-ease), box-shadow .18s var(--bh-ease), filter .18s;
}

main .site-button:hover,
main .site-button:focus,
.header-panel .site-button:hover,
.page-header .site-button:hover {
	color: var(--bh-deep);
	border: none;
	background: linear-gradient(180deg, var(--bh-orange-300) -10%, var(--bh-orange) 55%, var(--bh-orange-700) 145%);
	box-shadow: 0 14px 30px var(--bh-glow);
	transform: translateY(-2px);
	filter: brightness(1.05);
}

main .site-button:active {
	transform: translateY(0);
	box-shadow: 0 6px 14px rgba(226, 102, 27, .3);
}

/* Вторая кнопка в паре — вторичная: на экране один основной CTA. */
main .media-text__buttons .site-button:nth-of-type(2),
main .media-text__buttons .site-button:nth-of-type(3) {
	background: rgba(247, 132, 62, .08);
	color: var(--bh-orange-300);
	box-shadow: inset 0 0 0 2px rgba(247, 132, 62, .55);
}

main .media-text__buttons .site-button:nth-of-type(2):hover,
main .media-text__buttons .site-button:nth-of-type(3):hover {
	background: rgba(247, 132, 62, .16);
	color: #fff;
	box-shadow: inset 0 0 0 2px var(--bh-orange), 0 12px 26px rgba(0, 0, 0, .3);
}

/* --------------------------------------------------------------------------
   6. Таблицы
   -------------------------------------------------------------------------- */

main .wp-block-table {
	margin: 1.9rem 0;
	border-radius: var(--bh-r);
	border: 1px solid var(--bh-line);
	background: var(--bh-surface);
	box-shadow: var(--bh-shadow);
	overflow: hidden;
}

main .wp-block-table table {
	border-collapse: collapse;
	width: 100%;
}

body[data-change-theme] .wp-block-table thead,
body[data-change-theme] .wp-block-table tfoot {
	border: none;
}

body[data-change-theme] .wp-block-table thead th,
body[data-change-theme] .wp-block-table thead td,
body[data-change-theme] .wp-block-table tfoot th,
body[data-change-theme] .wp-block-table tfoot td {
	padding: .95rem 1.15rem;
	font-family: var(--bh-display);
	font-size: 1.12rem;
	font-weight: 700;
	letter-spacing: .05em;
	text-transform: uppercase;
	text-align: left;
	color: var(--bh-deep);
	background: linear-gradient(180deg, var(--bh-orange) 0%, var(--bh-orange-700) 100%);
	border: none;
}

body[data-change-theme] .wp-block-table thead th:not(:last-of-type),
body[data-change-theme] .wp-block-table thead td:not(:last-of-type),
body[data-change-theme] .wp-block-table tfoot th:not(:last-of-type),
body[data-change-theme] .wp-block-table tfoot td:not(:last-of-type) {
	border-right: 1px solid rgba(11, 23, 40, .22);
}

body[data-change-theme] .wp-block-table tbody tr {
	border: none;
	border-top: 1px solid var(--bh-line);
}

body[data-change-theme] .wp-block-table tbody tr:first-child {
	border-top: none;
}

body[data-change-theme] .wp-block-table tbody tr:nth-of-type(2n) td {
	background-color: rgba(255, 255, 255, .035);
}

body[data-change-theme] .wp-block-table tbody td {
	padding: .85rem 1.15rem;
	border: none;
	font-size: 1rem;
	line-height: 1.55;
	color: var(--bh-dim);
	vertical-align: top;
	background-color: transparent;
}

body[data-change-theme] .wp-block-table tbody td:first-child {
	font-family: var(--bh-display);
	font-size: 1.08rem;
	font-weight: 600;
	letter-spacing: .03em;
	text-transform: uppercase;
	color: var(--bh-text);
	white-space: normal;
}

body[data-change-theme] .wp-block-table tbody tr:hover td {
	background-color: rgba(247, 132, 62, .07);
}

/* Таблицы на 4+ колонки живут в 60% колонке блока с картинкой — им нужен более
   плотный набор, иначе заголовки ломаются на три строки. */
main .wp-block-table:has(thead th:nth-child(4)) td,
main .wp-block-table:has(thead th:nth-child(4)) th,
body[data-change-theme] .wp-block-table:has(thead th:nth-child(4)) thead th,
body[data-change-theme] .wp-block-table:has(thead th:nth-child(4)) tbody td {
	padding: .65rem .75rem;
	font-size: .94rem;
}

body[data-change-theme] .wp-block-table:has(thead th:nth-child(4)) thead th {
	font-size: 1rem;
	letter-spacing: .03em;
}

body[data-change-theme] .wp-block-table:has(thead th:nth-child(4)) tbody td:first-child {
	font-size: 1rem;
}

main .wp-block-table figcaption {
	padding: .8rem 1.15rem;
	font-size: .95rem;
	color: var(--bh-dim);
	text-align: left;
	background: rgba(0, 0, 0, .18);
}

/* --------------------------------------------------------------------------
   7. Мелочи и доступность
   -------------------------------------------------------------------------- */

main img {
	max-width: 100%;
	height: auto;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
		scroll-behavior: auto !important;
	}

	main .site-button:hover,
	main .link-block:hover,
	main .icon-block__item:hover {
		transform: none;
	}
}

/* --------------------------------------------------------------------------
   8. Адаптив базового слоя
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
	main > .section-tag {
		padding: 2.5rem 0;
	}

	main > #intro {
		padding: 2.6rem 0 2.4rem;
	}
}

@media (max-width: 700px) {
	body {
		font-size: 16px;
	}

	main .site-button {
		width: 100%;
		padding: .8rem 1.2rem;
	}

	/* Тема держит min-width:450px у таблиц в скролл-режиме — узкие таблицы из-за этого
	   уезжают вбок без причины. Широкие продолжают скроллиться. */
	body[data-table-type-mobile="scroll"] .wp-block-table table {
		min-width: 0;
	}

	body[data-change-theme] .wp-block-table tbody td,
	body[data-change-theme] .wp-block-table thead th {
		padding: .7rem .8rem;
	}
}
