/*
Theme Name: Crystal Splash
Theme URI: https://crystal-istra-rest.ru
Author: Crystal Istra
Description: Заглушка ресторана CRYSTAL — полноэкранный размытый фон и логотип-линза из «жидкого стекла», сквозь которую видно интерьер. Тема временная, до запуска основного сайта.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: crystal-splash
*/

/* ──────────────────────────────────────────────────────────────
   Шрифт
   ────────────────────────────────────────────────────────────── */
@font-face {
	font-family: 'Jost';
	font-style: normal;
	font-weight: 200 500;
	font-display: swap;
	src: url('assets/fonts/jost-cyrillic.woff2') format('woff2');
	unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
	font-family: 'Jost';
	font-style: normal;
	font-weight: 200 500;
	font-display: swap;
	src: url('assets/fonts/jost-latin-ext.woff2') format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: 'Jost';
	font-style: normal;
	font-weight: 200 500;
	font-display: swap;
	src: url('assets/fonts/jost-latin.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ──────────────────────────────────────────────────────────────
   Основа
   ────────────────────────────────────────────────────────────── */
/* Палитра из брифа «Стиль»: бежевая гамма интерьера, тёплое дерево и камень,
   приглушённая вода и лес, бордо кожаных папок меню.
   Золота нет сознательно — бриф называет его анти-референсом трижды. */
:root {
	--ink:        #16120e;   /* тёплый почти-чёрный, не синий */
	--umber:      #2A231C;   /* дым и тень */
	--stone:      #E7E1D6;   /* светлый камень фасада */
	--sand:       #CFC4B2;
	--wood:       #8A6A4B;
	--bordeaux:   #6B2233;
	--ember:      #C2622E;   /* глубокий тон огня печи */
	--forest:     #4A5645;
	--linen:      #F1EBE1;   /* текст */

	--blur:       10px;     /* управляется из JS */
	--z:          1.06;     /* зум фона          */
	--panx:       0;
	--pany:       0;
	--focus-x:    50%;
	--focus-y:    45%;

	/* знак — архитектура страницы: втрое больше экрана, дуга C проходит
	   через весь кадр, камин виден сквозь стекло (вариант C, выбран 2026-08-04) */
	--lens-h:     300vh;
	--lens-x:     76%;
	--lens-y:     52%;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	background: var(--ink);
}

body {
	font-family: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-weight: 300;
	color: var(--linen);
	overflow: hidden;
	overscroll-behavior: none;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

.stage {
	position: fixed;
	inset: 0;
	overflow: hidden;
	isolation: isolate;
}

/* ── Слой 1: фон, размытый ─────────────────────────────────── */
.bg {
	position: absolute;
	inset: -8%;
	width: 116%;
	height: 116%;
	object-fit: cover;
	object-position: var(--focus-x) var(--focus-y);
	filter: blur(var(--blur)) saturate(.97) brightness(1) sepia(.03);
	/* vw/vh, а не %, — иначе сдвиг считался бы от 116% ширины слоя
	   и разъехался бы с математикой шейдера */
	transform: scale(var(--z)) translate(calc(var(--panx) * 100vw), calc(var(--pany) * 100vh));
	transform-origin: center;
	will-change: transform, filter;
	transition: filter .9s cubic-bezier(.22, 1, .36, 1);
}

/* Резервная линза для браузеров без WebGL: тот же кадр, но резкий,
   обрезанный маской знака. Слой создаёт и позиционирует JS. */
.bg--sharp {
	filter: none;
	z-index: 1;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

/* ── Слой 1b: микрозерно травлёного стекла поверх блюра ────── */
.frost {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-repeat: repeat;
	background-size: 128px 128px;
	opacity: var(--grain-bg, .043);
	mix-blend-mode: overlay;
}

/* ── Слой 2: вуаль и виньетка ──────────────────────────────── */
.veil {
	position: absolute;
	inset: 0;
	pointer-events: none;
	opacity: var(--veil, .54);
	/* лёгкая вуаль: слева чуть плотнее — там текст, справа кадр дышит */
	background:
		linear-gradient(100deg, rgba(22, 18, 14, .38) 0%, rgba(22, 18, 14, .14) 34%, rgba(22, 18, 14, 0) 58%),
		linear-gradient(180deg, rgba(22, 18, 14, .18) 0%, rgba(22, 18, 14, 0) 24%, rgba(22, 18, 14, 0) 70%, rgba(22, 18, 14, .34) 100%);
}

/* ── Слой 3: линза (WebGL) ─────────────────────────────────── */
#lens {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	pointer-events: none;
	opacity: 0;
	/* лёгкая контактная тень стекла — считается по альфе канваса */
	filter: drop-shadow(0 18px 44px rgba(0, 0, 0, .28)) drop-shadow(0 1px 3px rgba(0, 0, 0, .18));
	transition: opacity 1.3s ease;
}
body.ready #lens { opacity: 1; }

/* Пустой блок — задаёт геометрию линзы, шейдер рисует ровно по нему.
   Специально больше экрана: срез знака кадром — часть композиции */
.lensbox {
	position: absolute;
	left: var(--lens-x);
	top: var(--lens-y);
	width: calc(var(--lens-h) * .6773);   /* пропорция знака */
	height: var(--lens-h);
	transform: translate(-50%, -50%);
	pointer-events: none;
}

/* ── Слой 4: информационная колонка слева ──────────────────── */
.content {
	position: absolute;
	left: clamp(22px, 6.5vw, 96px);
	top: 50%;
	transform: translateY(-50%);
	z-index: 3;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	max-width: min(74vw, 420px);
	text-align: left;
	pointer-events: none;
}

.word {
	display: block;
	width: clamp(150px, 17vw, 236px);
	height: auto;
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 1.2s ease .5s, transform 1.2s cubic-bezier(.22, 1, .36, 1) .5s;
	filter: drop-shadow(0 2px 22px rgba(0, 0, 0, .6));
}
body.ready .word { opacity: .97; transform: none; }

.rule {
	width: 0;
	height: 1px;
	margin: clamp(14px, 2.2vh, 26px) 0 0;
	background: linear-gradient(90deg, rgba(241, 235, 225, .85), transparent);
	opacity: .55;
	transition: width 1.6s cubic-bezier(.22, 1, .36, 1) .85s;
}
body.ready .rule { width: clamp(90px, 12vmin, 160px); }

.tag,
.soon,
.usps {
	margin: 0;
	text-transform: uppercase;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 1.1s ease 1s, transform 1.1s cubic-bezier(.22, 1, .36, 1) 1s;
	text-shadow: 0 1px 16px rgba(0, 0, 0, .7);
}
body.ready .tag,
body.ready .soon,
body.ready .usps { opacity: 1; transform: none; }

.tag {
	margin-top: clamp(13px, 2vh, 24px);
	font-weight: 300;
	font-size: clamp(10px, 1.3vmin, 12.5px);
	line-height: 1.75;
	letter-spacing: .22em;
	color: rgba(241, 235, 225, .82);
}

/* короткие УТП одной тихой строкой */
.usps {
	margin-top: clamp(8px, 1.2vh, 14px);
	font-weight: 300;
	font-size: clamp(9px, 1.05vmin, 11px);
	line-height: 1.9;
	letter-spacing: .18em;
	color: rgba(241, 235, 225, .52);
	transition-delay: 1.15s;
}

.soon {
	margin-top: clamp(14px, 2.2vh, 26px);
	font-weight: 300;
	font-size: clamp(10px, 1.25vmin, 13px);
	letter-spacing: .3em;
	color: var(--sand);
	transition-delay: 1.3s;
}

/* ── Тихие действия: о ресторане, маршрут, телефон ─────────── */
.actions {
	display: flex;
	flex-wrap: wrap;
	gap: clamp(14px, 2vw, 28px);
	margin-top: clamp(18px, 3vh, 34px);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(10px);
	transition: opacity 1.1s ease 1.5s, transform 1.1s cubic-bezier(.22, 1, .36, 1) 1.5s;
}
body.ready .actions { opacity: 1; transform: none; }

.act {
	position: relative;
	padding: 6px 0;
	font-family: inherit;
	font-weight: 300;
	font-size: clamp(9.5px, 1.15vmin, 11.5px);
	letter-spacing: .24em;
	text-transform: uppercase;
	color: rgba(241, 235, 225, .78);
	background: none;
	border: 0;
	cursor: pointer;
	text-decoration: none;
	transition: color .25s;
}
.act::after {
	content: "";
	position: absolute;
	left: 0;
	right: 12%;
	bottom: 0;
	height: 1px;
	background: rgba(207, 196, 178, .45);
	transition: right .3s ease, background .3s;
}
.act:hover { color: var(--linen); }
.act:hover::after { right: 0; background: rgba(231, 225, 214, .8); }

/* ── Панель «О ресторане» — информация упакована и скрыта ──── */
#about {
	position: fixed;
	inset: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	padding: 4vh clamp(18px, 6.5vw, 96px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .4s ease;
}
#about.open { opacity: 1; pointer-events: auto; }

#about .abg {
	position: absolute;
	inset: 0;
	background: rgba(12, 10, 8, .35);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.acard {
	position: relative;
	width: min(92vw, 470px);
	max-height: 88vh;
	overflow-y: auto;
	padding: clamp(24px, 4vh, 40px) clamp(22px, 3vw, 38px);
	border-radius: 18px;
	background: linear-gradient(165deg, rgba(42, 35, 28, .78), rgba(22, 18, 14, .82));
	-webkit-backdrop-filter: blur(22px) saturate(1.1);
	backdrop-filter: blur(22px) saturate(1.1);
	border: 1px solid rgba(241, 235, 225, .13);
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .7);
	transform: translateY(14px);
	transition: transform .45s cubic-bezier(.22, 1, .36, 1);
	scrollbar-width: thin;
}
#about.open .acard { transform: none; }

.acard .x {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: rgba(241, 235, 225, .08);
	color: var(--sand);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	transition: background .25s;
}
.acard .x:hover { background: rgba(241, 235, 225, .18); }

.acard h2 {
	margin: 0 0 4px;
	font-weight: 300;
	font-size: 17px;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--linen);
}
.acard .lead {
	margin: 14px 0 0;
	font-weight: 300;
	font-size: 13.5px;
	line-height: 1.75;
	color: rgba(241, 235, 225, .85);
}
/* статус работы (тех. открытие): врезка с бордовой линией, читается
   как сообщение от ресторана, а не как ещё один абзац описания */
.acard .note {
	margin: 16px 0 0;
	padding: 12px 0 12px 16px;
	border-left: 2px solid rgba(194, 98, 46, .6);   /* на вечернем стекле акцент — ember, бордо не читается */
}
.acard .note p {
	margin: 0;
	font-weight: 300;
	font-size: 13px;
	line-height: 1.75;
	color: rgba(241, 235, 225, .88);
}
.acard .note p + p { margin-top: 10px; }
.acard h3 {
	margin: 24px 0 8px;
	font-weight: 300;
	font-size: 10px;
	letter-spacing: .26em;
	text-transform: uppercase;
	color: var(--sand);
}
.acard ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
.acard li {
	padding: 8px 0;
	font-weight: 300;
	font-size: 13px;
	line-height: 1.55;
	color: rgba(241, 235, 225, .8);
	border-bottom: 1px solid rgba(241, 235, 225, .07);
}
.acard li:last-child { border-bottom: 0; }
.acard .row {
	margin: 2px 0 0;
	font-weight: 300;
	font-size: 13px;
	line-height: 1.7;
	color: rgba(241, 235, 225, .8);
}
.acard a { color: var(--stone); text-decoration: none; border-bottom: 1px solid rgba(207, 196, 178, .4); transition: border-color .25s, color .25s; }
.acard a:hover { color: var(--linen); border-color: rgba(231, 225, 214, .8); }
.acard .links {
	display: flex;
	flex-wrap: wrap;
	gap: 18px;
	margin-top: 10px;
}

/* ── Углы ──────────────────────────────────────────────────── */
.corner {
	position: absolute;
	z-index: 4;
	font-size: clamp(9px, 1.05vmin, 11px);
	font-weight: 300;
	letter-spacing: .26em;
	text-indent: .26em;
	text-transform: uppercase;
	color: rgba(241, 235, 225, .38);
	pointer-events: none;
	opacity: 0;
	transition: opacity 1.2s ease 1.3s;
}
body.ready .corner { opacity: 1; }

.corner--tl { top: clamp(18px, 3.4vmin, 40px); left: clamp(18px, 3.4vmin, 44px); }
.corner--br { bottom: clamp(18px, 3.4vmin, 40px); right: clamp(18px, 3.4vmin, 44px); }
.corner a { color: inherit; text-decoration: none; pointer-events: auto; transition: color .25s; }
.corner a:hover { color: var(--stone); }

/* ── Слой 5: зерно плёнки ──────────────────────────────────── */
.grain {
	position: absolute;
	inset: -60px;
	z-index: 5;
	pointer-events: none;
	background-repeat: repeat;
	background-size: 96px 96px;
	opacity: var(--grain-top, .01);
	mix-blend-mode: overlay;
	animation: grain 900ms steps(1, end) infinite;
}
@keyframes grain {
	0%   { transform: translate(0, 0); }
	20%  { transform: translate(-14px, 8px); }
	40%  { transform: translate(11px, -12px); }
	60%  { transform: translate(-8px, -6px); }
	80%  { transform: translate(15px, 10px); }
	100% { transform: translate(0, 0); }
}

/* ── Доступность / слабые устройства ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
	.grain { animation: none; }
	.word, .rule, .tag, .soon, .corner, #lens { transition-duration: .01ms; }
}

@media (max-width: 760px) {
	/* iOS: CSS-фильтры пересчитываются на каждом кадре видео — это и есть
	   «тормозит». На телефонах фильтров нет вовсе: матовость даёт frost-слой,
	   затемнение — вуаль (обычные дешёвые слои без blend-mode). */
	/* лёгкий блюр вернули (Константин: blur 3), но одиночным фильтром —
	   без цепочки saturate/sepia; тяжёлые фильтры остаются выключенными */
	.bg { filter: blur(var(--blur)); }
	#lens { filter: none; }
	.frost { mix-blend-mode: normal; opacity: .05; }
	.grain { display: none; }

	/* дуга уходит выше и правее: нижняя треть экрана чистая — там текст */
	:root {
		--lens-h: 316vh;
		--lens-x: 180%;
		--lens-y: -2%;
		--blur: 10px;
	}
	.content {
		left: 6vw;
		right: 6vw;
		top: auto;
		bottom: max(env(safe-area-inset-bottom), 4.5vh);
		transform: none;
		max-width: none;
	}
	.word { width: clamp(140px, 40vw, 180px); }
	.tag { letter-spacing: .16em; }
	.usps { display: none; }   /* на телефоне УТП живут в панели */
	.corner--tl { font-size: 9px; letter-spacing: .2em; }
	/* панель почти во весь экран, с воздухом по 8px сверху и снизу */
	#about { align-items: flex-end; padding: max(env(safe-area-inset-top), 8px) 8px max(env(safe-area-inset-bottom), 8px); }
	.acard {
		width: 100%;
		max-height: calc(100dvh - 16px);
		border-radius: 16px;
		padding-bottom: 26px;
	}
}

/* на узком экране адрес в углу столкнулся бы с колонкой */
@media (max-width: 900px) {
	.corner--br { display: none; }
}

@media (max-height: 560px) and (orientation: landscape) {
	:root { --lens-h: 300vh; --lens-x: 76%; }
	.word { width: clamp(110px, 13vw, 150px); }
	.rule { margin-top: 8px; }
	.usps { display: none; }
}

/* ── Панель настройки (только по #tune) ────────────────────── */
#tunepanel {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 40;
	width: 268px;
	max-height: 88vh;
	overflow-y: auto;
	padding: 16px;
	border-radius: 16px;
	background: rgba(8, 11, 18, .74);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	border: 1px solid rgba(255, 255, 255, .14);
	box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8);
	font-size: 12px;
	color: #fff;
}
#tunepanel h2 { margin: 0 0 2px; font-size: 13px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; }
#tunepanel .hint { margin: 0 0 12px; font-size: 10px; letter-spacing: .1em; color: var(--sand); opacity: .8; }
#tunepanel .row { margin: 9px 0; }
#tunepanel label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; font-size: 11.5px; color: rgba(255, 255, 255, .88); }
#tunepanel label b { font-weight: 400; color: var(--sand); font-variant-numeric: tabular-nums; }
#tunepanel input[type=range] { width: 100%; height: 3px; border-radius: 3px; appearance: none; -webkit-appearance: none; background: rgba(255, 255, 255, .2); outline: none; }
#tunepanel input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--sand); border: 2px solid #fff; cursor: pointer; }
#tunepanel input[type=range]::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; background: var(--sand); border: 2px solid #fff; cursor: pointer; }
#tunepanel button { width: 100%; margin-top: 12px; padding: 9px; font: inherit; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; cursor: pointer; transition: .2s; }
#tunepanel button:hover { background: rgba(255, 255, 255, .2); }
