/* ============================================================================
   Smartentre homepage (R.3). Builds on assets/css/site.css — tokens, frame,
   buttons, forms, header and footer all come from there. Only homepage
   compositions live here.
   S.4 (one-page company site): hero → services → about → contact (dark). Light
   first; Services is the one quiet alternate band (white) and contact is
   the only dark chapter before the dark footer. Earlier sections (chat stage,
   systems, cybersecurity, academy, proof, process, capabilities) and their
   styles are in git history. Motion: assets/js/home-pixels.js.
   ========================================================================= */

.home { display: block; }
/* Direct links and redirects land on a #section: that first jump is instant,
   so it cannot race the web fonts settling. home-pixels.js re-aligns once
   fonts are in, then adds .is-settled and in-page links scroll smoothly. */
html:not(.is-settled) { scroll-behavior: auto; }
/* Padding lives inside the frame so its rails run unbroken from hero to
   contact. Consecutive light chapters start on one rail-to-rail rule. */
.home-section > .frame { padding-block: var(--section-m) var(--section-l); }
.home-hero + .home-section > .frame,
.home-section + .home-section > .frame { border-top: 1px solid var(--site-border-strong); }

.home-section__head { display: grid; gap: var(--space-3); margin-bottom: var(--space-7); }
.home-section__head h2 {
  max-width: 18ch;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

/* ── Hero: one statement, one action, one scene ────────────────────────── */
.home-hero__head { display: grid; gap: var(--space-6); padding-block: var(--space-8) var(--space-7); }
.home-hero__title {
  max-width: 15ch;
  font-size: clamp(2.375rem, 0.9rem + 5.6vw, 5.75rem);
  line-height: 1;
  letter-spacing: -0.04em;
  hyphens: manual; /* every word fits a 360px line in EN/LV/RU */
}
/* The only accent in the hero: the full stop in brand cyan. */
.home-hero__accent { color: var(--site-accent); }
.home-hero__row {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-6) var(--space-8);
  border-top: 1px solid var(--site-line);
}
.home-hero__sub { font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem); line-height: 1.55; color: var(--site-text-secondary); max-width: 44ch; }
.home-hero__actions { align-items: center; }
@media (min-width: 960px) {
  .home-hero__head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--grid-gap);
    align-items: center;
    padding-block: var(--space-9) var(--space-8);
  }
  .home-hero__title { grid-column: 1 / span 7; }
  .home-hero__visual { grid-column: 8 / span 5; justify-self: end; }
  .home-hero__row { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--grid-gap); align-items: end; }
  .home-hero__sub { grid-column: 1 / span 6; }
  .home-hero__actions { grid-column: 8 / span 5; justify-content: flex-end; }
}
/* Wide screens: the scene takes half the frame; the headline steps down a
   little so "Digital solutions" still holds one line in six columns. */
@media (min-width: 1200px) {
  .home-hero__head { padding-block: var(--space-8) var(--space-7); }
  .home-hero__title { grid-column: 1 / span 6; font-size: min(0.9rem + 5.6vw, 4.75rem); }
  .home-hero__visual { grid-column: 7 / span 6; }
}

/* Hero visual (decorative, aria-hidden): an exploded axonometric system —
   01 Interface (white), 02 Systems (graphite), 03 Data (light). One cyan
   column runs through it: an active data cell, the active systems node and
   connection, the active interface module. From 1200px the labels sit beside
   the layers; below that the object is centred over a compact legend.
   Motion: one 8.5 s loop, built bottom-up — Data activates, Systems connect,
   Interface connects, the layers assemble into one product, a status strip
   runs ("System ready"), it holds, then separates back to the exploded view.
   Transforms and opacity only; every element shares the same 8.5 s timeline
   so they cannot drift. Pauses off-screen / in background tabs (data-paused).
   The markup (exploded, all active states on) is the reduced-motion picture. */
.home-hero__visual { width: 100%; }
.cx { overflow: hidden; }
/* The canvas reserves room for the desktop labels; below 1200px it is widened
   past the frame (and clipped) so the object itself sits centred. */
.cx-svg { display: block; width: 94%; max-width: none; height: auto; margin: -1% 0 -3% 13.9%; }
.cx-label, .cx-ready { display: none; }
.cx-legend { position: relative; display: flex; justify-content: center; margin: var(--space-3) 0 0; font-family: var(--font-mono); font-size: var(--text-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--site-text-secondary); }
.cx-legend__layers { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.cx-legend b { font-weight: 400; color: var(--site-text-muted); margin-right: 0.35em; }
.cx-legend__ready { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.6em; color: var(--site-text); opacity: 0; }
.cx-legend__ready i { width: 0.55em; height: 0.55em; border-radius: 1px; background: var(--site-accent); }
@media (min-width: 640px) and (max-width: 1199px) { .home-hero__visual { max-width: 480px; } }
@media (min-width: 640px) and (max-width: 959px) { .home-hero__visual { justify-self: center; } }
@media (min-width: 1200px) {
  .cx-svg { width: 100%; margin: 0; }
  .cx-label, .cx-ready { display: inline; }
  .cx-legend { display: none; }
}

/* Layers: white interface, graphite systems, light data — top and two side faces */
.cx-ui-t { fill: #FFFFFF; stroke: #C6CBD3; stroke-width: 0.75; }
.cx-ui-r { fill: #E4E7EB; stroke: #C6CBD3; stroke-width: 0.75; }
.cx-ui-l { fill: #D3D7DD; stroke: #C6CBD3; stroke-width: 0.75; }
.cx-sys-t { fill: #1B1F25; }
.cx-sys-r { fill: #121418; }
.cx-sys-l { fill: #0B0D10; }
.cx-data-t { fill: #E9ECEF; stroke: #CED3DA; stroke-width: 0.75; }
.cx-data-r { fill: #D6DADF; }
.cx-data-l { fill: #C7CCD3; }
.cx-grid { stroke: #D6DADF; stroke-width: 0.75; }
.cx-guide { stroke: #BCC2CA; stroke-width: 0.75; stroke-dasharray: 2 5; }
.cx-path { stroke: #39404A; stroke-width: 1.25; }
.cx-node { fill: #2D323A; }
.cx-mod { fill: #F3F5F7; stroke: #DEE2E7; stroke-width: 0.75; }
.cx-mod--bar, .cx-mod--nav { fill: #ECEFF2; }
/* The active column */
.cx-cell { fill: rgba(79, 216, 232, 0.28); stroke: var(--site-accent); stroke-width: 0.9; }
.cx-path--on { stroke: var(--site-accent); stroke-width: 1.75; stroke-dasharray: 1; }
.cx-node--on, .cx-mod--on { fill: var(--site-accent); stroke: none; }
.cx-thread { stroke: var(--site-accent); stroke-width: 1.1; stroke-dasharray: 3 3; }
.cx-signal { stroke: var(--site-accent); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 0.25 1.25; opacity: 0; }
.cx-strip { fill: none; stroke: var(--site-accent); stroke-width: 1.5; stroke-dasharray: 1; opacity: 0; }
/* Labels: short leaders, quiet mono type */
.cx-leader { stroke: #A5ACB6; stroke-width: 0.75; }
.cx-leader--on { stroke: var(--site-accent); }
.cx-label text, .cx-ready text { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: 0.06em; fill: var(--site-text-secondary); }
.cx-ready text { fill: var(--site-text); }
.cx-ready__dot { fill: var(--site-accent); }
.cx-ready { opacity: 0; }
.cx-num { fill: #9AA1AC; }

@media (prefers-reduced-motion: no-preference) {
  .cx[data-paused] * { animation-play-state: paused !important; }
  /* Movement: Data rises, Interface descends, they meet Systems, then return */
  .cx-layer--data { animation: cx-data 8.5s infinite; }
  .cx-layer--ui { animation: cx-ui 8.5s infinite; }
  /* Structure marks step back while the product is assembled */
  .cx-guides, .cx-label, .cx-legend__layers { animation: cx-marks 8.5s ease infinite; }
  /* 1 · Data activates: a signal runs along a row into the active cell */
  .cx-signal { animation: cx-signal 8.5s linear infinite; }
  .cx-cell { animation: cx-cell 8.5s ease infinite; }
  /* 2 · Systems connect: Data → Systems thread, connection draws, node lights */
  .cx-thread--1 { animation: cx-thread-1 8.5s ease infinite; }
  .cx-path--on { animation: cx-path 8.5s ease infinite; }
  .cx-node--on { animation: cx-node 8.5s ease infinite; }
  /* 3 · Interface connects: Systems → Interface thread, the module fills */
  .cx-thread--2 { animation: cx-thread-2 8.5s ease infinite; }
  .cx-mod--on { animation: cx-module 8.5s ease infinite; }
  /* 4 · Product ready: a status strip runs along the assembled edge */
  .cx-strip { animation: cx-strip 8.5s ease infinite; }
  .cx-ready, .cx-legend__ready { animation: cx-ready 8.5s ease infinite; }
}
/* 0–1.2 s exploded · 1.2–2.0 Data · 2.0–3.0 Systems · 3.0–4.2 Interface ·
   4.2–5.3 assemble · 5.3–6.7 ready (hold) · 6.7–8.0 separate · 8.0–8.5 pause */
@keyframes cx-data {
  0%, 23.53% { transform: none; animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  35.29%, 49.41% { transform: translateY(-16px); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  62.35%, 78.82% { transform: translateY(-111.8px); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  94.12%, 100% { transform: none; }
}
@keyframes cx-ui {
  0%, 35.29% { transform: none; animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
  49.41% { transform: translateY(16px); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  62.35%, 78.82% { transform: translateY(111.8px); animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  94.12%, 100% { transform: none; }
}
@keyframes cx-marks { 0%, 49.41% { opacity: 1; } 56%, 82% { opacity: 0; } 94.12%, 100% { opacity: 1; } }
@keyframes cx-signal { 0%, 14.12% { opacity: 0; stroke-dashoffset: 0.25; } 15% { opacity: 1; } 22.5% { opacity: 1; stroke-dashoffset: -1; } 24%, 100% { opacity: 0; stroke-dashoffset: -1; } }
@keyframes cx-cell { 0%, 17% { opacity: 0; } 20%, 84.71% { opacity: 1; } 92%, 100% { opacity: 0; } }
@keyframes cx-thread-1 { 0%, 23.53% { opacity: 0; } 27.06%, 49.41% { opacity: 1; } 54.12%, 100% { opacity: 0; } }
@keyframes cx-path { 0%, 25% { stroke-dashoffset: 1; } 32%, 84.71% { stroke-dashoffset: 0; } 92%, 100% { stroke-dashoffset: 1; } }
@keyframes cx-node { 0%, 29.41% { fill: #2D323A; } 32%, 84.71% { fill: var(--site-accent); } 92%, 100% { fill: #2D323A; } }
@keyframes cx-thread-2 { 0%, 35.29% { opacity: 0; } 38.82%, 49.41% { opacity: 1; } 54.12%, 100% { opacity: 0; } }
@keyframes cx-module { 0%, 38.82% { fill: #F3F5F7; } 42.35%, 84.71% { fill: var(--site-accent); } 92%, 100% { fill: #F3F5F7; } }
@keyframes cx-strip { 0%, 62.35% { opacity: 1; stroke-dashoffset: 1; } 70.59%, 76% { opacity: 1; stroke-dashoffset: 0; } 80%, 100% { opacity: 0; stroke-dashoffset: 0; } }
@keyframes cx-ready { 0%, 63.5% { opacity: 0; } 66.5%, 76% { opacity: 1; } 80%, 100% { opacity: 0; } }

/* ── Services: the one alternate band, a 2 × 2 grid on thin rules ──────── */
.home-build { background: var(--site-surface); }
.build-grid { display: grid; gap: var(--space-7) calc(var(--grid-gap) * 2); list-style: none; padding: 0; }
.build-item { position: relative; min-width: 0; padding-top: var(--space-4); border-top: 1px solid var(--site-border-strong); }
/* Cyan accent on each rule; on hover it runs the full width. */
.build-item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--site-accent);
  transition: width 500ms var(--ease);
}
.build-item__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.build-item__num { font-family: var(--font-mono); font-size: var(--text-mono); color: var(--site-text-muted); transition: color var(--dur) var(--ease); }
/* Three pixel slots; the cyan pixel steps across them. */
.build-item__px {
  position: relative;
  flex-shrink: 0;
  width: 24px;
  height: 6px;
  background: linear-gradient(90deg, var(--site-border-strong) 6px, transparent 6px 9px, var(--site-border-strong) 9px 15px, transparent 15px 18px, var(--site-border-strong) 18px);
}
.build-item__px::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--site-accent);
  transform: translateX(18px);
}
.build-item__name { margin-top: var(--space-4); font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem); line-height: 1.15; letter-spacing: -0.02em; }
.build-item__text { margin-top: var(--space-3); color: var(--site-text-secondary); max-width: 40ch; }
@media (min-width: 768px) { .build-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-8); } }

@media (prefers-reduced-motion: no-preference) {
  /* Reveal once on scroll: the accent draws in and the pixel steps across. */
  .js [data-build]:not(.is-in) .build-item::before { width: 0; }
  .js [data-build]:not(.is-in) .build-item__px::after { transform: translateX(0); }
  [data-build].is-in .build-item::before { transition-delay: calc(var(--i, 0) * 120ms); }
  [data-build].is-in .build-item__px::after { animation: px-step 900ms steps(1, end) calc(var(--i, 0) * 120ms + 200ms) both; }
  .build-item:nth-child(2) { --i: 1; }
  .build-item:nth-child(3) { --i: 2; }
  .build-item:nth-child(4) { --i: 3; }
}
@keyframes px-step {
  0% { transform: translateX(0); }
  33% { transform: translateX(9px); }
  66%, 100% { transform: translateX(18px); }
}
/* Hover only where hover is real; touch keeps the one-time scroll reveal. */
@media (hover: hover) and (pointer: fine) {
  [data-build] .build-item:hover::before { width: 100%; transition-delay: 0s; }
  .build-item:hover .build-item__num { color: var(--site-accent-text); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  [data-build].is-in .build-item:hover .build-item__px::after { animation: px-step-hover 600ms steps(1, end) both; }
}
@keyframes px-step-hover {
  0% { transform: translateX(0); }
  33% { transform: translateX(9px); }
  66%, 100% { transform: translateX(18px); }
}

/* ── About: a short company intro ──────────────────────────────────────────
   Label in the margin column, one strong statement, one line of how we work,
   and a single Focus line on a rule. From 1100px the text and Focus share
   the row under the statement. */
.home-about__grid { display: grid; gap: var(--space-6) var(--grid-gap); }
.home-about__label { display: inline-flex; align-items: center; gap: var(--space-2); }
.home-about__label::before { content: ""; flex-shrink: 0; width: 8px; height: 8px; border-radius: 1px; background: var(--site-accent); }
.home-about__statement {
  max-width: 20ch;
  font-size: clamp(2rem, 1.2rem + 3vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  hyphens: manual; /* a sentence, not a label: wrap at spaces only */
  text-wrap: balance;
}
.home-about__lead { font-size: var(--text-body-lg); line-height: 1.6; color: var(--site-text-secondary); max-width: 42ch; }
.home-about__focus { position: relative; display: grid; gap: var(--space-2); margin: 0; padding-top: var(--space-4); border-top: 1px solid var(--site-line); max-width: 24rem; }
/* The same short cyan accent as the Services rules. */
.home-about__focus::before { content: ""; position: absolute; top: -1px; left: 0; width: 32px; height: 2px; background: var(--site-accent); }
.home-about__focus dt { font-size: var(--text-body-sm); color: var(--site-text-muted); }
.home-about__focus dd { margin: 0; font-family: var(--font-display); font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem); font-weight: 700; letter-spacing: -0.02em; color: var(--site-text); }
@media (min-width: 900px) {
  .home-about__grid { grid-template-columns: repeat(12, minmax(0, 1fr)); row-gap: var(--space-7); }
  .home-about__label { grid-column: 1 / span 3; grid-row: 1; align-self: start; padding-top: var(--space-3); }
  .home-about__statement { grid-column: 4 / span 9; grid-row: 1; }
  .home-about__lead, .home-about__focus { grid-column: 4 / span 9; }
}
/* Focus sits beside the lead only where its one-line value fits (needs ~365px in RU). */
@media (min-width: 1280px) {
  .home-about__lead { grid-column: 4 / span 5; grid-row: 2; align-self: start; }
  .home-about__focus { grid-column: 9 / span 4; grid-row: 2; align-self: start; }
}

/* ── Contact (dark) ──────────────────────────────────────────────────────
   The block and the lead form live in site.css (shared with contact.html). */
/* Long LV/RU button labels must wrap on small phones instead of widening
   the column. */
@media (max-width: 480px) {
  .home .btn { white-space: normal; text-align: center; padding-block: var(--space-2); }
}

.home + .site-footer { border-top: 1px solid var(--site-border-strong); }

/* ── Button experiment (R.3.1, homepage only): hard offset, press-down ──
   A solid ink border and a zero-blur offset shadow; hover moves the button
   halfway into its shadow, active presses it flat. Movement only — no glow,
   no spring. Scoped to .home so the rest of the site keeps site.css buttons. */
.home .btn--primary,
.home .btn--secondary {
  border-width: 2px;
  transition: transform var(--dur-fast) ease-out, box-shadow var(--dur-fast) ease-out;
}
.home .btn--primary::before { display: none; }
.home .btn--primary:focus-visible,
.home .btn--secondary:focus-visible { outline-offset: 5px; }

/* Primary (chosen variant A): ink button, cyan hard shadow — cyan stays a
   brand edge, not a fill. On dark sections the tokens invert it to a light
   button; the cyan shadow is unchanged. */
.home .btn--primary {
  --press: var(--site-accent);
  background: var(--site-text);
  color: var(--site-bg);
  border-color: var(--site-text);
  box-shadow: 4px 4px 0 var(--press);
}

/* Secondary: surface button, smaller ink shadow — quieter than primary.
   On dark sections the shadow uses the muted tone so it never outshouts the
   primary. */
.home .btn--secondary {
  --press: var(--site-text);
  background: var(--site-surface);
  color: var(--site-text);
  border-color: var(--site-text);
  box-shadow: 3px 3px 0 var(--press);
}
.home .surface-dark .btn--secondary { --press: var(--site-text-muted); }

.home .btn--primary:hover { background: var(--site-text); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--press); }
.home .btn--secondary:hover { background: var(--site-surface); transform: translate(1.5px, 1.5px); box-shadow: 1.5px 1.5px 0 var(--press); }
.home .btn--primary:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--press); }
.home .btn--secondary:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--press); }

/* Reduced motion: no movement; the shadow still shrinks, so the state change
   stays visible. */
@media (prefers-reduced-motion: reduce) {
  .home .btn--primary:hover, .home .btn--secondary:hover,
  .home .btn--primary:active, .home .btn--secondary:active { transform: none; }
}
