/* Шрифти лежать у себе: CSP дозволяє лише власні ресурси. Ліцензії OFL поруч зі шрифтами. */
@font-face {
  font-family: "Geologica";
  src: url("../assets/fonts/geologica-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Geologica";
  src: url("../assets/fonts/geologica-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-cyrillic-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-cyrillic-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Plex Mono";
  src: url("../assets/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  --paper: #f3f0e7;
  --paper-deep: #e9e5d8;
  --ink: #1b1846;
  --ink-soft: #4a4868;
  --indigo: #4338ca;
  --water: #38bdf8;
  --energy: #fbbf24;
  --heat: #fb923c;
  --line: rgb(27 24 70 / 18%);
  --sans: "Geologica", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --pad: clamp(1.25rem, 3.2vw, 3.5rem);
  --top-h: 4.75rem;
  --cycle: 8s;
}

* { box-sizing: border-box; }

/*
 * Уся сторінка в rem: до 1440×900 масштаб звичайний, вище росте разом з екраном, максимум удвічі.
 * Відсотки, а не px: зберігається розмір шрифту, заданий у браузері.
 */
html {
  -webkit-text-size-adjust: 100%;
  font-size: clamp(100%, min(1.11vw, 1.78vh), 200%);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--paper);
  /* Міліметрівка */
  background-image:
    linear-gradient(rgb(27 24 70 / 4.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(27 24 70 / 4.5%) 1px, transparent 1px);
  background-size: 2rem 2rem;
}

a { color: inherit; }

:focus-visible {
  outline: 0.1875rem solid var(--indigo);
  outline-offset: 0.1875rem;
  border-radius: 0.375rem;
}

.screen {
  display: flex;
  flex-direction: column;
  max-width: 110rem;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Верхня смуга */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--top-h);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  text-decoration: none;
}

.brand img { display: block; flex: none; width: 2.5rem; height: 2.5rem; }

.brand-text { display: grid; line-height: 1.25; min-width: 0; }

.brand-name { font-weight: 700; font-size: 1.0625rem; letter-spacing: .08em; }

.brand-line { font-size: 0.75rem; color: var(--ink-soft); }

.top-links { display: flex; align-items: center; gap: 1.5rem; flex: none; }

.top-contact {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8438rem;
  text-decoration: none;
  white-space: nowrap;
}

.top-contact:hover { color: var(--indigo); text-decoration: underline; text-underline-offset: 0.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}

.btn-main { color: #fff; background: var(--indigo); }
.btn-main:hover { background: #3730a3; }
.btn-line { border: 1.5px solid var(--ink); }
.btn-line:hover { color: #fff; background: var(--ink); }
.btn-ghost { min-height: 2.5rem; padding: 0 1rem; font-size: 0.875rem; border: 1.5px solid var(--ink); border-radius: 0.625rem; }
.btn-ghost:hover { color: #fff; background: var(--ink); }

/* Основний екран */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  padding: 2rem 0;
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--indigo);
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 11.5vw, 3.75rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.03em;
  text-wrap: balance;
}

/* Підкреслення трьома сегментами, як кільце знака */
.mark {
  position: relative;
  display: inline-block;
  padding-bottom: .1em;
  white-space: nowrap;
}

.mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: .1em;
  bottom: -.04em;
  height: .09em;
  border-radius: .09em;
  background: linear-gradient(90deg,
    var(--water) 0 31%, transparent 31% 34.5%,
    var(--energy) 34.5% 65.5%, transparent 65.5% 69%,
    var(--heat) 69% 100%);
}

.lead {
  max-width: 34em;
  margin: 1.25rem 0 0;
  font-size: clamp(1rem, 1.3vw, 1.1875rem);
  color: var(--ink-soft);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* Циферблат */
.dial-wrap { display: grid; place-items: center; min-width: 0; }

.dial { display: block; width: 100%; max-width: 38.75rem; height: auto; overflow: visible; }


.rim { fill: none; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 551.9 1867.1; }
.rim-water { stroke: var(--water); stroke-dashoffset: -127.3; }
.rim-energy { stroke: var(--energy); stroke-dashoffset: -933.6; }
.rim-heat { stroke: var(--heat); stroke-dashoffset: -1740; }





.packet { stroke: var(--ink); stroke-width: 2; opacity: 0; }
.packets-water .packet { fill: var(--water); }
.packets-energy .packet { fill: var(--energy); }
.packets-heat .packet { fill: var(--heat); }


.meter > circle { stroke: var(--paper); stroke-width: 4; }
.meter use { fill: var(--ink); }





/* Широкий екран: усе вміщається в один екран без прокручування */
@media (min-width: 1040px) {
  .screen { min-height: 100vh; min-height: 100svh; }

  .hero {
    flex: 1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 4rem);
    padding: 1rem 0;
  }

  /* Три рядки: найдовший, «завжди під контролем.», вміщується в колонку */
  h1 { font-size: clamp(2.5rem, min(3.9vw, 8vh), 3.9rem); }

  /* Висота мінус шапка й відступи; не вужче за текст */
  .dial { width: clamp(27.5rem, min(100vh - var(--top-h) - 2.5rem, 46vw), 53.75rem); max-width: none; }
}

@media (max-width: 1239px) {
  .top-contact { display: none; }
}

@media (max-width: 560px) {
  .brand-line { display: none; }
  .actions .btn { flex: 1 1 100%; }
}

/*
 * Один цикл на все: лічильники, радіо, вхід у знак, сигнал у центрі.
 */
@media (prefers-reduced-motion: no-preference) {
  .packet { animation: packet-fly var(--cycle) linear infinite; }
  .packets-energy .packet { animation-delay: .08s; }
  .packets-heat .packet { animation-delay: .16s; }

  .meter { animation: meter-beat var(--cycle) ease-out infinite; }


  .led { transform-box: fill-box; transform-origin: center; animation: led-blink var(--cycle) ease-out infinite; }
  .led-energy { animation-delay: .08s; }
  .led-heat { animation-delay: .16s; }
  .rack-ping { animation: rack-ping var(--cycle) ease-out infinite; }


  .btn-main { transition: background-color .15s, transform .15s; }
  .btn-main:hover { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  /* Статичний кадр: пакети зупинені посеред шляху */
  .packet { opacity: 1; transform: translateY(140px); }
}

@keyframes packet-fly {
  0%, 15% { opacity: 0; transform: translateY(0); }
  25% { opacity: 1; transform: translateY(0); }
  70% { opacity: 1; transform: translateY(228px); }
  74%, 100% { opacity: 0; transform: translateY(228px); }
}

@keyframes meter-beat {
  0%, 22%, 100% { transform: scale(1); }
  10% { transform: scale(1.14); }
}



@keyframes led-blink {
  0%, 70%, 96%, 100% { opacity: .5; transform: scale(1); }
  74% { opacity: 1; transform: scale(1.4); }
  84% { opacity: 1; transform: scale(1); }
}

@keyframes rack-ping {
  0%, 72% { opacity: 0; transform: scale(1); }
  75% { opacity: .8; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(1.3); }
}



/* ---------- Темна тема з фоновим зображенням ---------- */
:root {
  --paper: #100e30;
  --ink: #f5f2ea;
  --ink-soft: #d4d2e4;
  --line: rgb(245 242 234 / 24%);
  --on-color: #14123a; /* текст і значки на кольорових елементах */
  --accent: #a5b4fc;
}

body {
  background-color: #0a0924;
  background-image: none;
}

/* Фото й затемнення окремими шарами: фіксовані, тому не стрибають під час прокручування */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background: url("../assets/bg.webp") var(--bg-pos, center) / cover no-repeat;
}

body::after {
  z-index: -1;
  background: var(--shade);
}

:focus-visible { outline-color: var(--accent); }

.eyebrow { color: var(--accent); }
.top-contact:hover { color: var(--accent); }

.btn-main { background: #4f46e5; }
.btn-main:hover { background: #4338ca; }
.btn-line:hover,
.btn-ghost:hover { color: var(--on-color); background: var(--ink); }


.dial { filter: drop-shadow(0 1.5rem 3.75rem rgb(0 0 0 / 45%)); }
.packet { stroke: var(--on-color); }
.meter use { fill: var(--on-color); }


/* Небо на фото яскраве: спершу рівний індиго на все фото, далі затемнення під текстом */
:root {
  --bg-pos: 70% center;
  --shade:
    linear-gradient(180deg, rgb(10 9 36 / 84%) 0, rgb(10 9 36 / 76%) 8.5%, rgb(10 9 36 / 0%) 17%),
    linear-gradient(0deg, rgb(10 9 36 / 55%) 0, rgb(10 9 36 / 0%) 18%),
    linear-gradient(90deg, rgb(10 9 36 / 92%) 0, rgb(10 9 36 / 86%) 46%, rgb(10 9 36 / 52%) 58%, rgb(10 9 36 / 0%) 80%),
    linear-gradient(rgb(24 20 80 / 38%), rgb(24 20 80 / 38%));
}

@media (max-width: 1039px) {
  /* Вузький екран: фото під усім текстом, тому затемнення рівне й сильніше */
  :root { --shade: linear-gradient(rgb(10 9 36 / 80%), rgb(10 9 36 / 80%)); }
}

/* Спрощений прилад: один лічильник і один промінь на ресурс */
.spoke { stroke-width: 2.5; stroke-linecap: round; }
.spoke-water { stroke: var(--water); }
.spoke-energy { stroke: var(--energy); }
.spoke-heat { stroke: var(--heat); }
.meters-water .meter > circle { fill: var(--water); }
.meters-energy .meter > circle { fill: var(--energy); }
.meters-heat .meter > circle { fill: var(--heat); }

/* Сервер: корпус кольору бренду, блоки темні, індикатори кольору ресурсу */
.unit { fill: var(--on-color); }
.vent { fill: rgb(245 242 234 / 32%); }
.led-water { fill: var(--water); }
.led-energy { fill: var(--energy); }
.led-heat { fill: var(--heat); }
.rack-ping { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0; }

/* Текстовий блок: більше повітря між підписом, заголовком, текстом і кнопками */
.eyebrow { margin-bottom: clamp(1.125rem, 3.2vh, 2.25rem); }
.lead { margin-top: clamp(1.5rem, 4.4vh, 3rem); }
.actions { margin-top: clamp(1.75rem, 5.2vh, 3.5rem); }
