/* ==========================================================================
   АНКОМ — service pages (remont-fotoaparativ, remont-droniv): 3D hero played once (js/hub3d.mjs),
   intro with facts, service cards with prices, repair by mail, models in two columns.
   Shared blocks (process, models, FAQ, request, 3D toggle buttons) — css/blocks.css.
   ========================================================================== */

/* ---------- Hero: one screen, model on the right (desktop) / above the list (phones) ---------- */
.hub { position: relative; }
.hub__stage { position: relative; }
html.hub-3d .hub__stage {
  height: calc(100svh - var(--header-h));
  min-height: 620px;
  max-height: 1040px;
  overflow: hidden;
}
/* a canvas is a replaced element: without an explicit size it grows with the device pixel ratio */
.hub__canvas,
.hub__lines { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.hub__canvas { opacity: 0; transition: opacity 0.6s var(--ease-out); }
.hub.is-live .hub__canvas { opacity: 1; }
.hub__lines { pointer-events: none; }
.hub__ui { position: absolute; top: 0; bottom: 0; left: 0; right: 0; max-width: var(--container); margin: 0 auto; pointer-events: none; }
.hub__ui a,
.hub__ui button { pointer-events: auto; }
/* while the show plays the list takes no clicks (a stray tap must not jump away mid-show) */
.hub.is-playing .hub__callouts a { pointer-events: none; }

.hub__panel { position: absolute; left: var(--gutter); top: 50%; width: min(520px, 40%); transform: translate3d(0, -50%, 0); }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--dim);
}
.crumbs a { color: var(--text-3); text-decoration: none; transition: color 0.2s; }
.crumbs a:hover { color: var(--hot); }
.hub__panel .eyebrow { margin-bottom: 16px; }
.hub__title {
  margin-bottom: 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 3.1vw, 50px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--text-hi);
}

/* numbered callouts = what we repair; each links to its card below */
.hub__callouts { margin: 0; padding: 0; list-style: none; counter-reset: callout; }
.hub__callouts li { position: relative; padding-left: 40px; counter-increment: callout; transition: opacity 0.45s var(--ease-out); }
.hub__callouts li + li { margin-top: 12px; }
.hub__callouts li::before {
  content: counter(callout, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 3px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--dim);
  transition: color 0.3s;
}
.hub__callouts a { display: block; text-decoration: none; }
.hub__callouts strong {
  display: block;
  width: fit-content; /* hub3d.mjs starts the leader line right after the text */
  max-width: 100%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: 1.3;
  color: var(--text-hi);
  transition: color 0.2s;
}
.hub__callouts a > span { display: block; margin-top: 2px; font-size: var(--fs-sm); line-height: 1.4; color: var(--text-3); }
.hub__callouts a:hover strong { color: var(--hot); }
/* live: callouts not reached yet are dimmed; the active one's number lights up */
.hub.is-live .hub__callouts li:not(.is-on) { opacity: 0.3; }
.hub__callouts li.is-active::before { color: var(--hot); }

.hub__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

/* colour / outline toggle (buttons: blocks.css) and «Показати ще раз» — right edge of the container */
.hub__mode,
.hub__replay { position: absolute; right: var(--gutter); right: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter))); z-index: 1; }
.hub__mode {
  top: 24px;
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-3);
  border-radius: 20px;
  background: rgba(37, 36, 35, 0.8);
}
.hub__replay {
  bottom: 28px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line-3);
  border-radius: 20px;
  background: rgba(37, 36, 35, 0.8);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.hub__replay svg { flex-shrink: 0; translate: 0 calc(7px - 0.36em); translate: 0 calc(7px - 0.5cap); } /* centred on the capitals (a fixed 2 px nudge fitted only one mono font) */
.hub__replay:hover { color: var(--text-hi); border-color: var(--accent); }

/* hub3d.mjs: no page scroll while the show plays from the top of the page; the reserved gutter keeps the width */
html.hub-lock { overflow: hidden; scrollbar-gutter: stable; }

/* text version (no JS / no WebGL2 / short phone / model failed): hero + list, no stage */
html:not(.hub-3d) .hub__canvas,
html:not(.hub-3d) .hub__lines,
html:not(.hub-3d) .hub__mode,
html:not(.hub-3d) .hub__replay { display: none; }
html:not(.hub-3d) .hub__ui { position: relative; padding: 64px var(--gutter) 72px; }
html:not(.hub-3d) .hub__panel { position: static; width: auto; transform: none; }
html:not(.hub-3d) .hub__title { max-width: 16em; }
html:not(.hub-3d) .hub__callouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px 32px; max-width: 1100px; }
html:not(.hub-3d) .hub__callouts li + li { margin-top: 0; }

/* ---------- Intro: text + four facts ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 32px 80px;
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  border-top: 1px solid var(--line);
}
.intro .eyebrow { margin-bottom: 18px; }
.intro__text p { max-width: 36em; font-size: var(--fs-base); font-weight: 450; line-height: 1.7; color: var(--text-2); }
.intro__text p + p { margin-top: 16px; }
.brands { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.brands li {
  padding: 6px 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-2);
  border: 1px solid var(--line-3);
  border-radius: var(--radius);
}
.facts-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.facts-row li { padding: 24px 24px 0 0; }
.facts-row li + li { padding-left: 24px; border-left: 1px solid var(--line); }
.facts-row b { display: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-2xl); line-height: 1.2; color: var(--text-hi); }
.facts-row span { display: block; margin-top: 6px; font-size: var(--fs-sm); line-height: 1.45; color: var(--text-3); }

/* ---------- Services: cards with minimum prices ---------- */
.svc { padding-top: var(--section-y); padding-bottom: var(--section-y); border-top: 1px solid var(--line); }
.svc .section-head { margin-bottom: 16px; }
.svc__all {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.svc__all svg { flex-shrink: 0; translate: 0 calc(7px - 0.36em); translate: 0 calc(7px - 0.5cap); } /* arrow centred on the capitals */
.svc__all:hover { color: var(--hot); }
.svc__note { max-width: 44em; margin-bottom: 40px; font-size: var(--fs-sm); line-height: 1.6; color: var(--muted); }
.svc__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 48px; }
.svc__item {
  display: flex;
  flex-direction: column;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line-3);
  scroll-margin-top: calc(var(--header-h) + 24px); /* a callout link lands the card under the sticky header */
  transition: border-color 0.3s;
}
.svc__no { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--dim); transition: color 0.3s; }
.svc__title { margin: 14px 0 10px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); line-height: 1.3; color: var(--text-hi); }
.svc__text { max-width: 36em; font-size: var(--fs-md); font-weight: 450; line-height: 1.65; color: var(--text-3); }
.svc__prices { margin: auto 0 0; padding: 20px 0 0; list-style: none; }
.svc__prices li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px dashed var(--line-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--text-3);
}
.svc__prices b { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 400; color: var(--text-hi); white-space: nowrap; }
/* reached from a hero callout: the card's rule and number light up */
.svc__item:target { border-top-color: var(--hot); }
.svc__item:target .svc__no { color: var(--hot); }

/* ---------- Repair by mail ---------- */
.mail { border-top: 1px solid var(--line); background: var(--bg-2); }
.mail__inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 40px 80px;
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.mail .eyebrow { margin-bottom: 18px; }
.mail .h2 { margin-bottom: 18px; }
.mail__lead { max-width: 36em; font-size: var(--fs-base); font-weight: 450; line-height: 1.65; color: var(--text-3); }
.mail__steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 48px; margin: 0; padding: 0; list-style: none; counter-reset: mail; }
.mail__steps li { position: relative; padding-top: 22px; border-top: 1px solid var(--line-3); counter-increment: mail; }
.mail__steps li::before { content: counter(mail, decimal-leading-zero); display: block; margin-bottom: 12px; font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--hot); }
.mail__steps b { display: block; margin-bottom: 8px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); line-height: 1.3; color: var(--text-hi); }
.mail__steps span { display: block; font-size: var(--fs-md); font-weight: 450; line-height: 1.6; color: var(--text-3); }
.mail__steps a { color: var(--text-hi); text-decoration-color: var(--accent); text-underline-offset: 3px; transition: color 0.2s; } /* underlined like .guide__item a: a link inside text, not by colour alone (WCAG 1.4.1) */
.mail__steps a:hover { color: var(--hot); }

/* ---------- Models: two columns (cameras + lenses), or one list laid out in two ---------- */
.models__cols--hub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.models__cols--grid { grid-template-columns: minmax(0, 1fr); }
.models__cols--grid .models__col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; align-items: start; }
.models__cols--grid .models__col-title { grid-column: 1 / -1; }
.models__cols--grid .models__col-title + .models__item + .models__item { border-top: 1px solid var(--line); }

/* ---------- «Що сталося?»: symptoms → the matching service tile ---------- */
.symptoms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  padding-top: 36px;
  padding-bottom: 36px;
  border-top: 1px solid var(--line);
}
.symptoms__title { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 400; text-transform: uppercase; color: var(--accent); }
.symptoms__list { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.symptoms__chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line-3);
  border-radius: 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.symptoms__chip:hover { border-color: var(--hot); color: var(--text-hi); }

/* ---------- Services as a bento grid: photo tiles, line drawings from the 3D model, a strip ---------- */
.bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  scroll-margin-top: calc(var(--header-h) + 24px); /* a callout or symptom link lands the tile under the sticky header */
  transition: border-color 0.3s;
}
.tile__media { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-3); }
.tile__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* hover clip (js/hub.js): frames drawn into a canvas over the photo, shown only while they play */
.tile__seq { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.tile__seq.is-on { opacity: 1; }
/* line drawing (docs/tools/render-parts.mjs, transparent) on a faint drafting grid */
.tile__media--part {
  background:
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 28px),
    var(--bg-3);
}
.tile__media--part img { object-fit: contain; }
.tile__body { display: flex; flex: 1 1 auto; flex-direction: column; padding: 22px 24px 20px; }
.tile__no { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--dim); transition: color 0.3s; }
.tile__title { margin: 10px 0 8px; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); line-height: 1.3; color: var(--text-hi); }
.tile__text { max-width: 36em; font-size: var(--fs-md); font-weight: 450; line-height: 1.6; color: var(--text-3); }
.tile__prices { margin: auto 0 0; padding: 16px 0 0; list-style: none; }
.tile__prices li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px dashed var(--line-2);
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--text-3);
}
.tile__prices b { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 400; color: var(--text-hi); white-space: nowrap; }
.tile:target { border-color: var(--hot); }
.tile:target .tile__no { color: var(--hot); }

/* ---------- «Про сервіс» as a full-width photo band: text and facts over its dark left part ---------- */
.band { position: relative; overflow: hidden; border-top: 1px solid var(--line); background: var(--bg); }
.band__media { position: absolute; top: 0; right: 0; bottom: 0; left: 0; overflow: hidden; }
/* taller than the band so the scroll parallax never shows an edge */
.band__img { display: block; width: 100%; height: 112%; margin-top: -6%; object-fit: cover; object-position: 70% 50%; }
.band__media::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(37, 36, 35, 0.97) 0%, rgba(37, 36, 35, 0.9) 34%, rgba(37, 36, 35, 0.4) 56%, rgba(37, 36, 35, 0) 72%);
}
.band__inner { position: relative; display: flex; align-items: center; min-height: clamp(600px, 78vh, 820px); padding-top: var(--section-y); padding-bottom: var(--section-y); }
.band__text { max-width: 560px; }
.band .eyebrow { margin-bottom: 18px; }
.band .h2 { margin-bottom: 22px; }
.band__text p { max-width: 36em; font-size: var(--fs-base); font-weight: 450; line-height: 1.7; color: var(--text-2); }
.band__text p + p { margin-top: 14px; }
.band__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 32px 0 0; padding: 0; list-style: none; }
.band__facts li { padding: 16px 0; border-top: 1px solid var(--line-3); }
.band__facts b { display: block; font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); line-height: 1.2; color: var(--text-hi); }
.band__facts span { display: block; margin-top: 4px; font-size: var(--fs-sm); line-height: 1.45; color: var(--text-3); }
/* the photo develops as on the home page (motion.js: data-reveal-photo → .is-in, data-parallax-img → --py) */
html.js .band[data-reveal-photo] .band__img { opacity: 0; transform: scale(1.08); transition: opacity 1.1s var(--ease-out), transform 1.6s var(--ease-out); }
html.js .band[data-reveal-photo].is-in .band__img { opacity: 1; transform: scale(1.02) translate3d(0, var(--py, 0px), 0); }
html.js .band[data-reveal-photo].is-settled .band__img { transition: opacity 1.1s var(--ease-out), transform 0.35s var(--ease-out); }

/* ---------- «Ремонт поштою» with a photo in the viewfinder frame ---------- */
.mail__inner--photo { align-items: center; }
.mail__media { width: 100%; max-width: 640px; margin: 0; padding: 12px; }
.mail__frame { position: relative; overflow: hidden; aspect-ratio: 3 / 2; background: var(--bg-3); }
.mail__frame img { display: block; width: 100%; height: 112%; margin-top: -6%; object-fit: cover; }
html.js .mail__media[data-reveal-photo] .mail__frame img { opacity: 0; transform: scale(1.14); transition: opacity 1.1s var(--ease-out), transform 1.6s var(--ease-out); }
html.js .mail__media[data-reveal-photo].is-in .mail__frame img { opacity: 1; transform: scale(1.02) translate3d(0, var(--py, 0px), 0); }
html.js .mail__media[data-reveal-photo].is-settled .mail__frame img { transition: opacity 1.1s var(--ease-out), transform 0.35s var(--ease-out); }
.mail__body .mail__head { margin-bottom: 36px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023.98px) {
  /* 3D: the list sits at the bottom, the model fills the band above it (hub3d.mjs) */
  html.hub-3d .hub__panel { top: auto; bottom: 20px; bottom: clamp(20px, calc(20px + (100svh - 740px) * 0.06), 32px); right: var(--gutter); width: auto; transform: none; }
  html.hub-3d .crumbs { margin-bottom: 10px; }
  html.hub-3d .hub__panel .eyebrow { display: none; }
  .hub__title { font-size: 34px; margin-bottom: 22px; }
  html.hub-3d .hub__title { margin-bottom: 12px; margin-bottom: clamp(12px, calc(12px + (100svh - 740px) * 0.1), 28px); }
  .hub__callouts strong { font-size: var(--fs-md); }
  html.hub-3d .hub__callouts li { padding-left: 32px; }
  html.hub-3d .hub__callouts li + li { margin-top: 6px; margin-top: clamp(6px, calc(6px + (100svh - 740px) * 0.04), 14px); }
  html.hub-3d .hub__callouts a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } /* visually hidden, still indexed/read */
  html.hub-3d .hub__actions { display: none; } /* the header keeps the call button; the list links to the cards */
  .hub__mode { top: 14px; }
  .hub__replay { top: 14px; bottom: auto; right: auto; left: var(--gutter); }
  .intro,
  .mail__inner { grid-template-columns: 1fr; gap: 28px; }
  .facts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; }
  .facts-row li { padding-bottom: 20px; }
  .facts-row li:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts-row li:nth-child(n+3) { border-top: 1px solid var(--line); padding-top: 20px; }
  .svc__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .hub__title { font-size: var(--fs-h1); }
  html:not(.hub-3d) .hub__ui { padding: 48px var(--gutter) 56px; }
  .hub__actions { gap: 10px; }
  .hub__actions .btn { flex: 1 1 0; padding: 14px 12px; }
  .svc__grid { grid-template-columns: 1fr; }
  .svc__item { padding-bottom: 32px; }
  .mail__steps { grid-template-columns: 1fr; gap: 28px; }
  .models__cols--hub,
  .models__cols--grid .models__col { grid-template-columns: 1fr; }
  .models__cols--grid .models__col-title + .models__item + .models__item { border-top: 0; }
}
/* short desktop windows: the panel starts higher and the sub-lines hide so nothing is cut off */
@media (min-width: 1024px) and (max-height: 800px) {
  html.hub-3d .hub__callouts li + li { margin-top: 8px; }
  html.hub-3d .hub__title { margin-bottom: 20px; }
  html.hub-3d .hub__actions { margin-top: 22px; }
}
@media (min-width: 1024px) and (max-height: 700px) {
  html.hub-3d .hub__callouts a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* bento: two wide tiles (photo left, text right) and the strip on desktop; 2 columns on tablets, 1 on phones */
@media (min-width: 1024px) {
  .tile--wide { grid-column: span 2; flex-direction: row; }
  .tile--wide .tile__media { flex: 0 0 58%; aspect-ratio: auto; min-height: 320px; }
  .tile--strip { grid-column: 1 / -1; }
  .tile--strip .tile__body { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; }
  .tile--strip .tile__title { margin: 0; }
  .tile--strip .tile__text { flex: 1 1 320px; }
  .tile--strip .tile__prices { margin: 0 0 0 auto; padding: 0; }
  .tile--strip .tile__prices li { padding: 0; border-top: 0; }
}
@media (max-width: 1023.98px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .band__media::after { background: linear-gradient(90deg, rgba(37, 36, 35, 0.97) 0%, rgba(37, 36, 35, 0.9) 48%, rgba(37, 36, 35, 0.35) 72%, rgba(37, 36, 35, 0) 88%); }
  .band__text { max-width: 480px; }
  .mail__media { max-width: 560px; }
}
@media (max-width: 767.98px) {
  .symptoms { gap: 12px; padding-top: 28px; padding-bottom: 28px; }
  .symptoms__chip { min-height: 44px; }
  .bento { grid-template-columns: 1fr; gap: 14px; }
  .tile__body { padding: 18px 18px 16px; }
  /* phones: the photo on top, the text below it on the page background */
  .band__media { position: relative; aspect-ratio: 4 / 3; }
  .band__img { object-position: 72% 50%; }
  .band__media::after { background: linear-gradient(180deg, rgba(37, 36, 35, 0) 55%, var(--bg) 100%); }
  .band__inner { min-height: 0; padding-top: 8px; }
  .band__facts { gap: 0 16px; }
  .mail__media { padding: 8px; }
}
