/* ==========================================================================
   Raschyotkin — main stylesheet
   Mobile-first, CSS Grid / Flexbox, CSS variables
   ========================================================================== */

:root {
	--primary: #2563eb;
	--primary-dark: #1d4ed8;
	--bg: #f8fafc;
	--card-bg: #ffffff;
	--text: #1e293b;
	--text-light: #64748b;
	--border: #e2e8f0;
	--success: #10b981;
	--accent: #f59e0b;
	--footer-bg: #0f172a;
	--footer-text: #cbd5e1;
	--header-h: 64px;
	--radius: 12px;
	--shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.04);
	--shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
	--font: "Segoe UI", system-ui, -apple-system, sans-serif;
	--transition: 0.25s ease;
	--max: 1120px;
	--calc-max: 700px;
}

[data-theme="dark"] {
	--bg: #0f172a;
	--card-bg: #1e293b;
	--text: #f1f5f9;
	--text-light: #94a3b8;
	--border: #334155;
	--footer-bg: #020617;
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
	--shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.6;
	color: var(--text);
	background: var(--bg);
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}

img,
svg {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: color var(--transition);
}

a:hover {
	color: var(--primary-dark);
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

.visually-hidden,
.skip-link:not(:focus) {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link:focus {
	position: fixed;
	top: 8px;
	left: 8px;
	z-index: 10000;
	background: var(--primary);
	color: #fff;
	padding: 0.75rem 1rem;
	border-radius: 8px;
}

.container {
	width: 100%;
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 1rem;
}

/* ----- Header ----- */
.site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--card-bg);
	box-shadow: var(--shadow);
	height: var(--header-h);
}

.header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	height: var(--header-h);
}

.site-logo {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	color: var(--text);
	font-weight: 700;
	font-size: 1.15rem;
}

.site-logo:hover {
	color: var(--primary);
}

.logo-mark {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: var(--primary);
	color: #fff;
	font-size: 1.1rem;
}

.custom-logo-link img {
	max-height: 44px;
	width: auto;
}

.nav-toggle {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	padding: 8px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	margin-left: auto;
}

.nav-toggle span {
	display: block;
	height: 2px;
	background: var(--text);
	border-radius: 2px;
	transition: var(--transition);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.primary-nav {
	display: none;
	position: absolute;
	top: var(--header-h);
	left: 0;
	right: 0;
	background: var(--card-bg);
	border-bottom: 1px solid var(--border);
	padding: 1rem;
	box-shadow: var(--shadow);
}

.primary-nav.is-open {
	display: block;
}

.nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.nav-list a {
	display: block;
	padding: 0.65rem 0.85rem;
	color: var(--text);
	border-radius: 8px;
	font-weight: 500;
	font-size: 0.95rem;
}

.nav-list a:hover,
.nav-list .current-menu-item > a {
	background: color-mix(in srgb, var(--primary) 10%, transparent);
	color: var(--primary);
}

.theme-toggle {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: transparent;
	cursor: pointer;
	color: var(--text);
	flex-shrink: 0;
}

.theme-toggle svg {
	width: 20px;
	height: 20px;
}

.theme-toggle .icon-moon {
	display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
	display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
	display: block;
}

/* ----- Buttons ----- */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.7rem 1.25rem;
	border: none;
	border-radius: 10px;
	font-weight: 600;
	cursor: pointer;
	transition: background var(--transition), transform 0.15s ease, box-shadow var(--transition);
	text-align: center;
}

.btn:active {
	transform: scale(0.98);
}

.btn-primary {
	background: var(--primary);
	color: #fff;
}

.btn-primary:hover {
	background: var(--primary-dark);
	color: #fff;
}

.btn-block {
	width: 100%;
}

/* ----- Ads ----- */
.ad-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: color-mix(in srgb, var(--border) 60%, transparent);
	border: 1px dashed var(--border);
	color: var(--text-light);
	font-size: 0.8rem;
	min-height: 50px;
	overflow: hidden;
}

.ad-label {
	opacity: 0.7;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 0.75rem;
}

.ad-banner-top,
.ad-banner-bottom {
	width: 100%;
	min-height: 90px;
	margin: 0.75rem 0;
}

.ad-banner-top-wrap,
.ad-banner-bottom-wrap {
	max-width: var(--max);
	margin: 0 auto;
	padding: 0 1rem;
}

.ad-content-1,
.ad-content-2 {
	width: 100%;
	min-height: 90px;
	margin: 1.25rem 0;
}

.ad-sidebar {
	display: none;
}

.ad-sidebar-unit {
	width: 160px;
	height: 600px;
	position: sticky;
	top: calc(var(--header-h) + 1rem);
}

/* ----- Hero ----- */
.hero {
	padding: 2.5rem 0 2rem;
	background:
		radial-gradient(ellipse 80% 60% at 20% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent),
		radial-gradient(ellipse 60% 50% at 90% 20%, color-mix(in srgb, var(--accent) 12%, transparent), transparent),
		var(--bg);
}

.hero-inner {
	text-align: center;
	max-width: 720px;
	margin: 0 auto;
}

.hero-title {
	margin: 0 0 0.75rem;
	font-size: clamp(2rem, 6vw, 3.25rem);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.15;
	color: var(--text);
}

.hero-subtitle {
	margin: 0 0 1.75rem;
	font-size: 1.05rem;
	color: var(--text-light);
}

.hero-search {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	background: var(--card-bg);
	padding: 0.75rem;
	border-radius: 14px;
	box-shadow: var(--shadow-lg);
	border: 1px solid var(--border);
}

.hero-search input[type="search"] {
	width: 100%;
	padding: 0.85rem 1rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg);
	outline: none;
}

.hero-search input[type="search"]:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

/* ----- Calculators grid ----- */
.calculators-section {
	padding: 1rem 0 3.5rem;
}

.section-title {
	margin: 0 0 1.5rem;
	font-size: 1.5rem;
	font-weight: 700;
}

.calculators-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}

.calc-card {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	transition: transform var(--transition), box-shadow var(--transition);
}

.calc-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--shadow-lg);
}

.calc-card.is-hidden {
	display: none;
}

.calc-card-icon {
	width: 48px;
	height: 48px;
	color: var(--primary);
	margin-bottom: 1rem;
}

.calc-card-icon svg {
	width: 48px;
	height: 48px;
}

.calc-card-title {
	margin: 0 0 0.5rem;
	font-size: 1.15rem;
}

.calc-card-desc {
	margin: 0 0 1.25rem;
	color: var(--text-light);
	font-size: 0.95rem;
	flex-grow: 1;
}

.calc-card-btn {
	align-self: flex-start;
}

.no-results {
	text-align: center;
	color: var(--text-light);
	padding: 2rem;
}

/* ----- Content / calculator page ----- */
.site-main {
	min-height: 50vh;
	padding-bottom: 2rem;
}

.content-wrap {
	padding-top: 1.5rem;
	padding-bottom: 2rem;
}

.content-card,
.calculator-page {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.5rem;
	box-shadow: var(--shadow);
}

.entry-title {
	margin: 0.5rem 0 1rem;
	font-size: clamp(1.5rem, 4vw, 2rem);
	line-height: 1.25;
}

.breadcrumbs {
	font-size: 0.875rem;
	color: var(--text-light);
}

.breadcrumbs .sep {
	margin: 0 0.35rem;
}

.breadcrumbs a {
	color: var(--text-light);
}

.breadcrumbs a:hover {
	color: var(--primary);
}

.calculator-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	padding: 1.5rem 0 2rem;
	max-width: calc(var(--calc-max) + 400px);
	margin: 0 auto;
}

.calculator-main {
	max-width: var(--calc-max);
	width: 100%;
}

.calculator-intro {
	color: var(--text-light);
	margin-bottom: 0.5rem;
}

/* ----- Calculator forms ----- */
.calculator {
	margin-top: 0.5rem;
}

.calc-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.form-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.form-group label,
.form-group .label {
	font-weight: 600;
	font-size: 0.9rem;
}

.form-group input,
.form-group select {
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg);
	outline: none;
	transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.form-group input.is-invalid {
	border-color: #ef4444;
}

.form-error {
	color: #ef4444;
	font-size: 0.9rem;
	margin: 0;
}

.radio-group,
.checkbox-group {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
}

.radio-label,
.check-label {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	font-weight: 500;
}

/* ----- Results ----- */
.calc-result {
	margin-top: 1.5rem;
	padding: 1.25rem;
	background: color-mix(in srgb, var(--primary) 6%, var(--card-bg));
	border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
	border-radius: var(--radius);
	opacity: 0;
	transform: translateY(12px);
}

.calc-result.is-visible {
	animation: resultIn 0.4s ease forwards;
}

@keyframes resultIn {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.result-title {
	margin: 0 0 1rem;
	font-size: 1.15rem;
}

.result-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.result-list li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding-bottom: 0.65rem;
	border-bottom: 1px solid var(--border);
	font-size: 0.95rem;
}

.result-list li:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.result-list span {
	color: var(--text-light);
}

.result-list strong {
	font-weight: 700;
	text-align: right;
	color: var(--text);
}

.calc-extra {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--border);
}

.calc-extra h4 {
	margin: 0 0 0.5rem;
	font-size: 1rem;
}

.calc-extra p {
	margin: 0;
	color: var(--text-light);
	font-size: 0.925rem;
}

/* Tabs */
.tabs {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 1rem;
}

.tab-btn {
	flex: 1;
	padding: 0.65rem 1rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--card-bg);
	cursor: pointer;
	font-weight: 600;
	color: var(--text-light);
}

.tab-btn.is-active {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

.tab-panel[hidden] {
	display: none;
}

/* Biorhythms */
.biorhythm-chart-wrap {
	margin-bottom: 1rem;
	overflow-x: auto;
}

.biorhythm-chart {
	width: 100%;
	height: auto;
	background: var(--bg);
	border-radius: 8px;
}

.bio-physical strong { color: #ef4444; }
.bio-emotional strong { color: #10b981; }
.bio-intellectual strong { color: #2563eb; }

.bio-desc {
	margin-top: 0.75rem;
	font-size: 0.9rem;
	color: var(--text-light);
}

/* Floor layout */
.floor-layout-wrap {
	margin-top: 1.25rem;
	overflow-x: auto;
}

.floor-layout {
	width: 100%;
	background: var(--bg);
	border-radius: 8px;
	border: 1px solid var(--border);
}

/* Fuel */
.fuel-visual {
	display: flex;
	justify-content: center;
	margin-bottom: 1rem;
	color: var(--primary);
}

.fuel-gauge {
	width: 80px;
	height: auto;
}

/* Deposit table */
.table-wrap {
	overflow-x: auto;
	margin-top: 1.25rem;
}

.deposit-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

.deposit-table th,
.deposit-table td {
	padding: 0.5rem 0.6rem;
	border: 1px solid var(--border);
	text-align: right;
	white-space: nowrap;
}

.deposit-table th:first-child,
.deposit-table td:first-child {
	text-align: center;
}

.deposit-table thead {
	background: color-mix(in srgb, var(--primary) 10%, var(--card-bg));
}

/* BMI */
.bmi-score {
	text-align: center;
	margin-bottom: 1.25rem;
}

.bmi-value {
	display: block;
	font-size: 2.5rem;
	font-weight: 800;
	line-height: 1.1;
	color: var(--primary);
}

.bmi-category {
	display: block;
	margin-top: 0.35rem;
	font-weight: 600;
	font-size: 1.05rem;
}

.bmi-scale {
	margin-bottom: 1.25rem;
}

.bmi-scale-bar {
	position: relative;
	display: flex;
	height: 14px;
	border-radius: 999px;
	overflow: visible;
}

.bmi-scale-bar .seg {
	flex: 1;
	height: 14px;
}

.bmi-scale-bar .seg:first-child { border-radius: 999px 0 0 999px; }
.bmi-scale-bar .seg:nth-last-child(2) { border-radius: 0 999px 999px 0; }

.seg.under { background: #38bdf8; }
.seg.normal { background: #10b981; }
.seg.over { background: #fbbf24; }
.seg.ob1 { background: #f59e0b; }
.seg.ob2 { background: #f97316; }
.seg.ob3 { background: #ef4444; }

.bmi-marker {
	position: absolute;
	top: -5px;
	width: 4px;
	height: 24px;
	background: var(--text);
	border-radius: 2px;
	transform: translateX(-50%);
	transition: left 0.4s ease;
	box-shadow: 0 0 0 2px var(--card-bg);
}

.bmi-scale-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 0.4rem;
	font-size: 0.7rem;
	color: var(--text-light);
}

/* Sleep */
.sleep-times {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
	display: grid;
	gap: 0.65rem;
}

.sleep-times li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.85rem 1rem;
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: 10px;
}

.sleep-times .cycles {
	font-size: 0.85rem;
	color: var(--text-light);
}

.sleep-times .time {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--primary);
}

.sleep-phases {
	display: flex;
	gap: 4px;
	height: 36px;
	margin-bottom: 0.75rem;
	border-radius: 8px;
	overflow: hidden;
}

.sleep-phase {
	flex: 1;
	display: grid;
	place-items: center;
	font-size: 0.7rem;
	font-weight: 600;
	color: #fff;
}

.sleep-phase:nth-child(odd) { background: #3b82f6; }
.sleep-phase:nth-child(even) { background: #1d4ed8; }
.sleep-phase.fall-asleep { background: var(--accent); flex: 0.35; }

.sleep-note {
	margin: 0;
	font-size: 0.875rem;
	color: var(--text-light);
}

.date-countdown {
	text-align: center;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--primary);
	margin: 0 0 1rem;
}

/* Share */
.share-block {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--border);
}

.share-label {
	font-weight: 600;
	font-size: 0.9rem;
	margin-right: 0.25rem;
}

.share-btn {
	padding: 0.4rem 0.75rem;
	border-radius: 8px;
	font-size: 0.8rem;
	font-weight: 600;
	color: #fff !important;
}

.share-vk { background: #0077ff; }
.share-tg { background: #229ed9; }
.share-ok { background: #ee8208; }
.share-wa { background: #25d366; }

.share-btn:hover {
	filter: brightness(1.08);
}

/* ----- Footer ----- */
.site-footer {
	background: var(--footer-bg);
	color: var(--footer-text);
	padding-top: 2.5rem;
	margin-top: auto;
}

.footer-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
	padding-bottom: 2rem;
}

.footer-title {
	margin: 0 0 0.85rem;
	color: #fff;
	font-size: 1.05rem;
}

.footer-about p {
	margin: 0;
	font-size: 0.925rem;
	line-height: 1.65;
}

.footer-links {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.45rem;
}

.footer-links a {
	color: var(--footer-text);
	font-size: 0.925rem;
}

.footer-links a:hover {
	color: #fff;
}

.footer-bottom {
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	padding: 1rem 0;
	font-size: 0.85rem;
	text-align: center;
}

.footer-bottom p {
	margin: 0;
}

/* ----- Tablet ----- */
@media (min-width: 640px) {
	.hero-search {
		flex-direction: row;
		padding: 0.5rem;
	}

	.hero-search input[type="search"] {
		border: none;
		background: transparent;
		box-shadow: none;
	}

	.hero-search input[type="search"]:focus {
		box-shadow: none;
	}

	.calculators-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.form-row {
		grid-template-columns: 1fr 1fr;
	}

	.footer-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ----- Desktop ----- */
@media (min-width: 960px) {
	.nav-toggle {
		display: none;
	}

	.primary-nav {
		display: block;
		position: static;
		padding: 0;
		border: none;
		box-shadow: none;
		background: transparent;
		flex: 1;
	}

	.nav-list {
		flex-direction: row;
		justify-content: flex-end;
		flex-wrap: wrap;
		gap: 0.15rem;
		margin-right: 0.75rem;
	}

	.nav-list a {
		padding: 0.45rem 0.65rem;
		font-size: 0.875rem;
		white-space: nowrap;
	}

	.calculators-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.calculator-layout {
		grid-template-columns: 160px minmax(0, var(--calc-max)) 160px;
		justify-content: center;
		align-items: start;
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.ad-sidebar {
		display: block;
	}

	.calculator-main.container {
		padding: 0;
	}

	.footer-grid {
		grid-template-columns: 1.4fr 1fr 1fr;
	}

	.hero {
		padding: 3.5rem 0 2.5rem;
	}
}

@media (min-width: 1200px) {
	.nav-list a {
		font-size: 0.9rem;
		padding: 0.5rem 0.75rem;
	}
}
