/* =========================================================
   ENGY — CAD / FEM landing
   Stíluslogikák:
   - Szín = információ: szinte fekete alap, telített szín csak az adaton (FEM piros→kék)
   - Tipográfia: óriás geometrikus sans (számok/címek) + monospace (műszaki feliratok)
   - Tér: centrális reaktív hős, óriás szám a peremen, blueprint-rács, egyszekció-egyállítás
   ========================================================= */

:root {
  --bg:        #07080a;   /* szinte fekete */
  --bg-soft:   #0c0e12;
  --fg:        #e8eaed;   /* off-white */
  --muted:     #6b7280;   /* semleges szürke — minden funkcionális elem */
  --muted-dim: #3a3f47;
  --line:      rgba(0, 180, 216, 0.10);  /* cián blueprint-rács */
  --line-strong: rgba(0, 180, 216, 0.22);

  /* FEM von Mises skála — KIZÁRÓLAG adaton/hőson */
  --fem-low:  #1f6feb;   /* kék  - alacsony feszültség */
  --fem-mid:  #2bd4a7;   /* zöld */
  --fem-warn: #f2c14e;   /* sárga */
  --fem-high: #e5484d;   /* piros - magas feszültség */

  --font-display: "Inter Tight", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1280px;
  --pad: clamp(20px, 5vw, 80px);
  --gear-gutter: clamp(150px, 15vw, 240px);   /* a középső kerék-sáv fél szélessége + hézag */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;   /* nincs kék tap-villanás mobilon */
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;              /* iOS nem skálázza túl a szöveget fekvőben */
}

.mono {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- boot-szekvencia (solver init) ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s var(--ease);
}
.boot--out { opacity: 0; pointer-events: none; }
.boot-inner { width: min(460px, 82vw); }
.boot-log {
  font-size: 12px;
  color: var(--muted);
  line-height: 2;
  min-height: 130px;
}
.boot-row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: bootline 0.32s var(--ease) both;
}
.boot-row:first-child { color: var(--fg); }
.boot-row:last-child { color: var(--fem-mid); }
@keyframes bootline {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.boot-bar {
  height: 2px;
  background: var(--muted-dim);
  margin-top: 20px;
  overflow: hidden;
}
.boot-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--fem-mid);
  box-shadow: 0 0 10px rgba(43, 212, 167, 0.6);
  transition: width 0.22s var(--ease);
}

/* ---------- blueprint-rács háttér ---------- */
.grid-overlay {
  position: fixed;
  inset: -60px;            /* túlnyúlik, hogy a parallax ne mutasson szélet */
  pointer-events: none;
  z-index: 0;
  opacity: 0;              /* betöltéskor rajzolódik be (JS) */
  will-change: transform, opacity;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 120% 90% at 50% 30%, #000 55%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 30%, #000 55%, transparent 100%);
}
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(31,111,235,0.06), transparent 60%);
}

main, .nav, .footer { position: relative; z-index: 3; }

/* ---------- NAV ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--pad);
  font-size: 12px;
  color: var(--muted);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  mix-blend-mode: difference;
}
.nav-left { color: var(--fg); }

/* ---------- HERO (csak a bevezető képernyő; a tartalom a kerekek mellett görög utána) ---------- */
.hero {
  position: relative;
  height: 100vh;
  height: 100svh;       /* stabil magasság mobilon — a böngésző-toolbar nem ugráltatja */
}
.hero-sticky {
  position: relative;   /* NINCS pinnelés — a hero szöveg normálisan elgörög */
  height: 100vh;
  height: 100svh;
}
.hero-canvas {
  position: fixed;        /* végigkíséri az oldalt */
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  pointer-events: none;   /* az események az ablakra mennek */
}
.hero-copy {
  position: absolute;
  left: var(--pad);
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  max-width: min(40ch, 44vw);
  pointer-events: none;
}
.hero-copy .cta { pointer-events: auto; }
.hero-copy::before {
  /* lágy scrim, hogy a szöveg olvasható maradjon a 3D objektum előtt */
  content: "";
  position: absolute;
  left: -30%;
  top: -40%;
  width: 175%;
  height: 180%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 55% 60% at 28% 50%, rgba(7, 8, 10, 0.92), rgba(7, 8, 10, 0.55) 45%, transparent 72%);
}
.hero-copy .headline,
.hero-copy .sub { text-shadow: 0 2px 36px rgba(7, 8, 10, 0.85); }

.kicker {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 28px;
  padding-left: 2px;
}
.headline {
  font-size: clamp(40px, 7vw, 92px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin-bottom: 26px;
}
.headline .word {
  display: inline-block;
  will-change: transform, opacity;
}
.headline .word:last-child {
  /* az "ige" — finom hangsúly */
  background: linear-gradient(100deg, var(--fg) 40%, var(--fem-mid));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sub {
  font-size: clamp(15px, 1.5vw, 19px);
  color: var(--muted);
  max-width: 34ch;
  margin-bottom: 40px;
  letter-spacing: 0;
}

/* ---------- CTA (magnetic) ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: 2px;
  position: relative;
  isolation: isolate;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.0);
  font-family: var(--font-display);
}
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(43,212,167,0.0);
  transition: box-shadow 120ms var(--ease);
  z-index: -1;
}
.cta:hover { box-shadow: 0 0 0 1px rgba(43,212,167,0.5), 0 8px 30px rgba(43,212,167,0.15); }
.cta:active { transform: translateY(1px) scale(0.99); }
.cta-arrow { font-size: 15px; transition: transform 160ms var(--ease); }
.cta:hover .cta-arrow { transform: translateX(4px); }

/* ---------- HERO readout ---------- */
.part-readout {
  position: absolute;
  top: 104px;
  right: var(--pad);
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  text-align: right;
  pointer-events: none;
}
.ro-line { display: flex; gap: 12px; justify-content: flex-end; align-items: baseline; }
.ro-line i { color: var(--muted-dim); font-style: normal; }
.ro-line b { color: var(--muted); font-weight: 600; min-width: 64px; text-align: right; }
.ro-state b { color: var(--fem-mid); }

/* ---------- óriás metrika a peremen ---------- */
.hero-metric {
  position: absolute;
  left: var(--pad);
  bottom: clamp(28px, 6vh, 64px);
  z-index: 2;
  pointer-events: none;
}
.metric-number {
  font-size: clamp(72px, 16vw, 220px);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.05em;
  color: var(--fg);
  display: flex;
  align-items: flex-start;
}
.metric-unit { font-size: 0.36em; color: var(--fem-high); margin-top: 0.12em; font-weight: 700; }
#metric-count::before { content: "−"; }
.metric-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
  letter-spacing: 0.06em;
}

/* ---------- scroll hint ---------- */
.scroll-hint {
  position: absolute;
  right: var(--pad);
  bottom: clamp(28px, 6vh, 64px);
  z-index: 2;
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 14px;
}
.scroll-bar {
  width: 60px; height: 1px;
  background: var(--muted-dim);
  position: relative;
  overflow: hidden;
}
.scroll-bar::after {
  content: ""; position: absolute; inset: 0;
  background: var(--fem-mid);
  transform-origin: left;
  animation: scan 2.4s var(--ease) infinite;
}
@keyframes scan {
  0% { transform: scaleX(0); } 50% { transform: scaleX(1); }
  50.01% { transform-origin: right; } 100% { transform: scaleX(0); transform-origin: right; }
}

/* ---------- SZEKCIÓK (a középső fogaskerék-gerinc KÉT OLDALÁN, váltakozva) ---------- */
.section {
  position: relative;
  width: 50%;                    /* fél viewport; a másik felén a párja, középen a kerekek */
  padding-block: clamp(60px, 10vh, 120px);
}
.section.side-left {             /* a gerinc BAL oldalán, a kerekek FELÉ (jobbra) zárva */
  padding-left: var(--pad);
  padding-right: var(--gear-gutter);
  text-align: right;
}
.section.side-right {            /* a gerinc JOBB oldalán, a kerekek FELÉ (balra) zárva */
  margin-left: 50%;
  padding-left: var(--gear-gutter);
  padding-right: var(--pad);
  text-align: left;
}
.sec-head { margin-bottom: clamp(40px, 6vw, 72px); }
.sec-label {
  font-size: 11px;
  color: var(--fem-mid);
  display: inline-block;
  margin-bottom: 22px;
}
.sec-title {
  font-size: clamp(24px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

/* --- eset: aszimmetrikus (szöveg | adatok) --- */
.case-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 4vw, 44px);
}
.case-text {
  font-size: clamp(16px, 1.7vw, 20px);
  color: var(--fg);
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.mcell {
  background: var(--bg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mval {
  font-size: clamp(34px, 4.5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.mval i {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.34em;
  color: var(--muted);
  margin-left: 6px;
  font-weight: 500;
}
.mcell:first-child .mval { color: var(--fem-high); }
.mlbl { font-size: 10px; color: var(--muted); }

/* --- folyamat --- */
.steps {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.step {
  background: var(--bg);
  padding: 24px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: background 200ms var(--ease);
}
.step:hover { background: var(--bg-soft); }
.step-n { font-size: 12px; color: var(--fem-mid); }
.step-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.step-body { font-size: 14px; color: var(--muted); line-height: 1.55; letter-spacing: 0; }

/* --- referencia --- */
.quote-text {
  font-size: clamp(22px, 2.8vw, 38px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 24px 0 32px;
}
.quote-text em { font-style: normal; color: var(--fem-mid); }
.quote-author { display: flex; flex-direction: column; gap: 6px; font-size: 11px; }
.qa-name { color: var(--fg); }
.qa-role { color: var(--muted); }

/* --- kapcsolat --- */
.contact-title { margin: 20px 0 36px; }
.contact-form {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-start;   /* a kerekek felől (balra) indul */
}
.contact-input {
  flex: 1;
  min-width: 280px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--muted-dim);
  color: var(--fg);
  font-size: 15px;
  padding: 16px 4px;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 200ms var(--ease);
}
.contact-input::placeholder { color: var(--muted); }
.contact-input:focus { outline: none; border-color: var(--fem-mid); }

/* ---------- BUILT BY SMART INDUSTRIES — záró CTA (teljes szélességű, középre) ---------- */
.madeby {
  position: relative;
  z-index: 3;
  max-width: 700px;
  margin: 0 auto;
  padding: clamp(90px, 18vh, 220px) var(--pad);
  text-align: center;
}
.madeby::before {
  /* scrim, hogy a CTA tisztán olvasható legyen a kerekek előtt */
  content: "";
  position: absolute;
  inset: -8% -24%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 62% 64% at 50% 50%, rgba(7, 8, 10, 0.94), rgba(7, 8, 10, 0.62) 52%, transparent 80%);
}
.madeby-kicker {
  font-size: 11px;
  color: var(--fem-mid);
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}
.madeby-title {
  font-size: clamp(28px, 4.6vw, 58px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.madeby-sub {
  font-size: clamp(15px, 1.6vw, 19px);
  color: var(--muted);
  max-width: 44ch;
  margin: 0 auto 38px;
  line-height: 1.5;
}
.madeby-cta { font-size: 16px; padding: 18px 30px; }

/* ---------- FOOTER ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px var(--pad) 64px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-line { font-size: 15px; color: var(--muted); max-width: 44ch; }
.footer-meta { font-size: 10px; color: var(--muted-dim); }
.footer-link {
  color: var(--fem-mid);
  text-decoration: none;
  border-bottom: 1px solid rgba(43, 212, 167, 0.3);
  transition: border-color 160ms var(--ease);
}
.footer-link:hover { border-color: var(--fem-mid); }

/* ---------- reveal (scroll) ---------- */
.reveal { opacity: 0; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  /* a nav csak a hero tetején marad — görgetve ne fedje a szekciók szövegét */
  .nav { position: absolute; }
  .hero-copy { max-width: 86vw; top: 42%; }
  .hero-copy::before { background: radial-gradient(ellipse 92% 64% at 38% 50%, rgba(7, 8, 10, 0.95), rgba(7, 8, 10, 0.68) 52%, transparent 84%); }
  .part-readout { top: 88px; }
  .scroll-hint { display: none; }
  .case-body { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  /* mobilon nincs kétoszlopos gerinc — teljes szélességű, balra igazított, kompaktabb tartalom */
  .section, .section.side-left, .section.side-right {
    width: 100%;
    margin-left: 0;
    padding-inline: var(--pad);
    padding-block: clamp(44px, 7vh, 76px);
    text-align: left;
  }
  .sec-head { margin-bottom: clamp(24px, 5vw, 40px); }
  /* a fogaskerék-gerinc a szöveg MÖGÖTT fut — tömör scrim a tartalom mögött (olvashatóság),
     a szekció-határoknál átlátszóbb (a kerekek ott átsejlenek, a gerinc folytonos marad).
     A JS emellett halvány háttér-textúrává fakítja a kerekeket a hero után. */
  .section::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg,
      rgba(7,8,10,0.50) 0%,
      rgba(7,8,10,0.86) 7%,
      rgba(7,8,10,0.86) 93%,
      rgba(7,8,10,0.50) 100%);
  }
}

/* érintőképernyő: ne ragadjon be a hover-állapot tap után */
@media (hover: none) {
  .step:hover { background: var(--bg); }
  .cta:hover { box-shadow: inset 0 0 0 1px rgba(43,212,167,0.32); }
}

@media (max-width: 560px) {
  .nav { padding-block: 18px; }
  .nav-right { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .metric-number { font-size: clamp(72px, 26vw, 150px); }
  .hero-copy { top: 40%; }
  .headline { font-size: clamp(34px, 11vw, 64px); margin-bottom: 22px; }
  .kicker { margin-bottom: 22px; }
  .sub { margin-bottom: 32px; }

  /* kapcsolat-űrlap: input és gomb egymás alatt, teljes szélességű (kényelmes tap-cél) */
  .contact-form { flex-direction: column; gap: 16px; }
  .contact-input { min-width: 0; width: 100%; }
  .contact-form .cta { width: 100%; justify-content: center; padding-block: 18px; }

  /* footer egy oszlopban */
  .footer { flex-direction: column; align-items: flex-start; gap: 14px; padding-bottom: 48px; }
}

/* nagyon keskeny készülék: a readout zsúfolná a navsort, a hero feljebb csúszik */
@media (max-width: 400px) {
  .part-readout { display: none; }
  .hero-copy { top: 38%; }
}

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-bar::after { animation: none; }
  .reveal { opacity: 1 !important; }
  .headline .word { opacity: 1 !important; transform: none !important; }
  .grid-overlay { opacity: 1 !important; transform: none !important; }
  .boot { display: none !important; }
  .boot-row { animation: none !important; }
  * { transition-duration: 0.001ms !important; }
}
