@font-face {
  font-family: "Circe";
  src: url("../fonts/circe-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Circe";
  src: url("../fonts/circe-light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  --abyss: #041526;
  --navy: #07223d;
  --frost: #c9d3de;
  --snow: #ffffff;
  --text: rgba(201, 211, 222, 0.84);
  --muted: rgba(201, 211, 222, 0.6);
  --faint: rgba(201, 211, 222, 0.46);
  --pad-x: clamp(20px, 4.45vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background: var(--abyss);
  color: var(--snow);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100svh;
  font-family: "Circe", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* фон, если WebGL недоступен */
  background:
    radial-gradient(ellipse 70% 60% at 62% 34%, rgba(16, 52, 86, 0.9), transparent 70%),
    radial-gradient(ellipse 60% 50% at 20% 85%, rgba(12, 40, 70, 0.6), transparent 70%),
    var(--abyss);
}

::selection { background: var(--frost); color: var(--navy); }

#ice {
  position: fixed;
  inset: 0 auto auto 0;
  width: 100vw;
  height: 100lvh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-block: 40px 36px;
  padding-left: max(var(--pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad-x), env(safe-area-inset-right, 0px));
}

main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 0;
}

/* ---------- шапка ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mark { display: block; fill: var(--snow); }

.lang { display: flex; gap: 6px; margin-right: -10px; }
.lang button {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--faint);
  padding: 10px;
  cursor: pointer;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
  transition: color 0.25s var(--ease);
}
.lang button:hover { color: var(--snow); }
.lang button[aria-pressed="true"] { color: var(--snow); text-decoration-line: underline; }

/* ---------- хиро ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(56px, 11vh, 120px) clamp(32px, 6vh, 72px);
}

.wordmark {
  position: relative;
  width: min(72vw, 1040px, calc((100svh - 440px) * 4.2));
  min-width: min(100%, 300px);
  line-height: 0;
  font-size: 0;
}
.wordmark-svg {
  display: block;
  width: 100%;
  height: auto;
  fill: var(--snow);
  overflow: visible;
}
/* когда WebGL работает, логотип рисует шейдер — SVG остаётся для доступности и раскладки */
.webgl .wordmark-svg { opacity: 0; }

/* куда встаёт куб: доли от размера логотипа, центр между «ш» и «е» */
.cube-anchor {
  position: absolute;
  left: 85.5%;
  top: 28%;
  width: 33%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.webgl:not(.ice-follow) .cube-anchor { cursor: grab; }
.webgl:not(.ice-follow) .cube-anchor.dragging { cursor: grabbing; }
.ice-follow .cube-anchor { pointer-events: none; }

.tagline {
  --ink: var(--frost);
  margin-top: clamp(26px, 4.4vh, 46px);
  font-size: clamp(17px, 1.53vw, 22px);
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: var(--ink);
  max-width: 48em;
}

/* ---------- низ ---------- */
.lower {
  display: grid;
  grid-template-columns: minmax(0, 372px) minmax(0, 372px) minmax(auto, 1fr);
  column-gap: clamp(28px, 3.3vw, 48px);
  align-items: end;
}
.para {
  --ink: var(--text);
  font-size: 16px;
  line-height: 1.625;
  color: var(--ink);
  max-width: 372px;
}

/* подпись и абзацы рисует WebGL (чтобы лёд их преломлял); в DOM они остаются для чтения с экрана и выделения */
.webgl [data-gl-text] { color: transparent; }
.webgl.gl-text-check [data-gl-text] { color: rgba(255, 90, 90, 0.55); }

.contact {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--snow);
  text-decoration: none;
  font-size: 22px;
  line-height: 1.2;
  white-space: nowrap;
}
.cta-circle {
  width: 60px;
  height: 60px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.25px solid rgba(201, 211, 222, 0.6);
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.cta-circle svg { fill: var(--snow); transition: transform 0.35s var(--ease), fill 0.35s var(--ease); }
.cta:hover .cta-circle,
.cta:focus-visible .cta-circle { background: var(--frost); border-color: var(--frost); }
.cta:hover .cta-circle svg,
.cta:focus-visible .cta-circle svg { fill: var(--navy); transform: translate(2px, -2px); }

.email {
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}
.email:hover { color: var(--snow); }

/* ---------- подвал ---------- */
.foot {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 44px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

/* ---------- фокус ---------- */
a:focus-visible, button:focus-visible {
  outline: 1px solid var(--frost);
  outline-offset: 4px;
  border-radius: 2px;
}
.cta:focus-visible { outline-offset: 8px; border-radius: 40px; }

/* смена языка: короткий кроссфейд текста */
[data-i18n] { transition: opacity 0.22s var(--ease); }
.lang-switching [data-i18n] { opacity: 0; }

/* ---------- адаптив ---------- */
@media (max-width: 880px) {
  .lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 40px; }
  .contact { grid-column: 1 / -1; justify-self: start; align-items: flex-start; }
}

@media (max-height: 760px) and (min-width: 761px) {
  .hero { padding-block: 40px 28px; }
  .foot { margin-top: 28px; }
  .page { padding-block: 28px 24px; }
}

@media (max-width: 760px) {
  .page { padding-block: 22px 28px; }
  .hero { padding-block: clamp(96px, 30vw, 160px) 40px; }
  .wordmark { width: 100%; min-width: 0; }
  .cube-anchor { left: 80%; top: 4%; width: 38%; }
  .tagline { margin-top: 28px; letter-spacing: 0.06em; }
  .lower { grid-template-columns: 1fr; row-gap: 14px; }
  .para { font-size: 15px; line-height: 1.55; max-width: none; }
  .contact { margin-top: 26px; }
  .cta { font-size: 20px; }
  .foot { margin-top: 40px; font-size: 12px; }
}

/* ---------- панель настроек (#debug) ---------- */
.lil-gui.autoPlace.luchshe-gui {
  top: 84px;
  right: max(12px, env(safe-area-inset-right, 0px));
  max-height: calc(100% - 100px);
  z-index: 30;
  --background-color: rgba(4, 21, 38, 0.92);
  --widget-color: #0f2c49;
  --hover-color: #173a5c;
  --focus-color: #1d4570;
  --number-color: #9fd3ff;
  --string-color: #c9d3de;
  --font-family: "Circe", system-ui, sans-serif;
  backdrop-filter: blur(8px);
}
.luchshe-json {
  position: fixed;
  z-index: 40;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 32px));
  height: 320px;
  transform: translate(-50%, -50%);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--snow);
  background: var(--abyss);
  border: 1px solid var(--frost);
  padding: 12px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
