/* Quiet interaction cues: one optical response, with no extra hover rules. */
:root { --hover-ease: cubic-bezier(.22, 1, .36, 1); }

.image-link, .hero-media { position: relative; isolation: isolate; }
.optical-sight {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #fff;
  opacity: 0;
  background: linear-gradient(135deg, #0000, #0002);
  transition: opacity .55s ease;
}
.optical-sight { --on: 0; }
.optical-sight svg {
  display: none;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  transform: scale(calc(.92 + .08 * var(--on)));
  transition: transform 1s var(--hover-ease);
  filter: drop-shadow(0 1px 3px #0003);
}
/* One drawing per mark: the final mark by default, a variant when the dock switch selects it. */
html[data-mark=te] .sight-te,
html:not([data-mark]) .sight-bridge, html[data-mark=off] .sight-bridge, html[data-mark=bridge] .sight-bridge, html[data-mark=over] .sight-over, html[data-mark=axis] .sight-axis,
html[data-mark=plus] .sight-plus, html[data-mark=cap] .sight-cap { display: block; }
.sight-te { width: clamp(210px, 58%, 380px); aspect-ratio: 301.694/138; stroke-width: 1.15; }
.sight-bridge { width: clamp(250px, 70%, 460px); aspect-ratio: 507/94; stroke-width: 1.55; }
.sight-axis { width: clamp(190px, 50%, 330px); aspect-ratio: 251/158; stroke-width: 1.1; }
.sight-plus { width: clamp(210px, 56%, 370px); aspect-ratio: 294/143; stroke-width: 1.12; }
.sight-over { width: clamp(120px, 31%, 220px); aspect-ratio: 167/187; stroke-width: 1.17; }
.sight-cap { width: clamp(110px, 27%, 190px); aspect-ratio: 134/163; stroke-width: 1.1; }
.optical-sight path {
  transform-box: fill-box;
  transform-origin: center;
  transition: stroke-dashoffset 1.25s var(--hover-ease), transform 1s var(--hover-ease);
}
.optical-sight .s-draw { stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--on)); }
.optical-sight .s-bar { transform: scaleX(var(--on)); transform-origin: left; transition-delay: .3s; }
/* ТЭ: the bar opens from the stem, the stem drops, the ring closes around its stroke. */
.sight-te .s-arm { transform: scaleX(var(--on)); }
.sight-te .s-stem { transform: scaleY(var(--on)); transform-origin: top; transition-delay: .12s; }
/* Мост: the frame is drawn first, then the arch is thrown across. */
.sight-bridge .s-arch { transition-delay: .28s; }
/* Черта над Э: the line lowers onto the ring. */
.sight-over .s-roof { transform: translateY(calc((1 - var(--on)) * -26px)) scaleX(calc(.35 + .65 * var(--on))); }
/* Ось: both halves travel along one axis towards each other. */
.sight-axis .s-stem { transform: scaleY(var(--on)); }
.sight-axis .s-arm { transform: translateX(calc((1 - var(--on)) * -34px)); }
.sight-axis .s-bar { transform: translateX(calc((1 - var(--on)) * 34px)); transition-delay: 0s; }
/* Плюс: the cross turns a quarter while the ring is drawn. */
.sight-plus .s-plus { transform: rotate(calc((1 - var(--on)) * -90deg)); }
/* Крыша: the line spreads from the centre above the ring. */
.sight-cap .s-roof { transform: scaleX(var(--on)); }

.image-link .story-image, .hero-media .story-image {
  transition: transform 1.2s var(--hover-ease), filter .8s ease;
}
.optical-frame::after { display: none; }

:is(.hero h1 a, .story-card h2 a, .text-link, .consulting-shortcut, .site-footer nav a) {
  transition: color .3s ease;
}

.link-arrow {
  display: inline-block;
  transition: transform .6s var(--hover-ease) !important;
}
.button { transition: background-color .35s, color .35s, border-color .35s; }
.masthead-mark::before, .masthead-mark::after {
  transition: transform .8s var(--hover-ease), opacity .5s, background-color .5s;
}
.masthead-mark::before { transform-origin: right; }
.masthead-mark::after { transform-origin: left; }
.header-actions .theme-icon { transition: transform .75s var(--hover-ease); }
.search-symbol { transition: transform .6s var(--hover-ease); }
.menu-symbol i { transition: transform .6s var(--hover-ease); }
.lab-story h3, .index-links h3, .service-grid h2 {
  transition: color .35s;
}
/* A compound card owns its interaction; its caption is not another link. */
.lab-story .text-link { justify-self: start; }
:is(.lab-story, .index-links>a, .service-grid>a):focus-visible {
  text-decoration: none;
}
:is(.lab-story, .index-links>a, .service-grid>a):focus-visible :is(h2,h3) {
  color: var(--accent-text, var(--accent));
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}
:is(.lab-story, .index-links>a, .service-grid>a):focus-visible .link-arrow {
  transform: translateX(4px);
}

/* Pointer effects are confined to devices with a real hover state. */
@media (hover: hover) and (pointer: fine) {
  .hero:has(h1 a:hover, .text-link:hover, .hero-media:hover) .optical-sight,
  .story-card:has(h2 a:hover, .image-link:hover) .optical-sight { opacity: 1; --on: 1; }
  .hero:has(h1 a:hover, .text-link:hover, .hero-media:hover) .story-image,
  .story-card:has(h2 a:hover, .image-link:hover) .story-image { transform: scale(1.035); }
  :is(.hero h1 a, .story-card h2 a, .text-link, .consulting-shortcut, .site-footer nav a):hover {
    text-decoration: none;
    opacity: 1;
    color: var(--accent-text, var(--accent));
  }
  :is(.text-link, .button, .site-footer nav a):hover .link-arrow { transform: translateX(4px); }
  .masthead-mark:hover::before, .masthead-mark:hover::after {
    transform: scaleX(.72);
    opacity: .8;
    background-color: var(--accent);
  }
  .theme-toggle:hover .theme-icon { transform: rotate(180deg); }
  .search-toggle:hover .search-symbol { transform: rotate(-12deg) scale(1.1); }
  .nav-toggle:hover .menu-symbol i:first-child { transform: translateX(3px) rotate(-12deg); }
  .nav-toggle:hover .menu-symbol i:last-child { transform: translateX(-3px) rotate(-12deg); }
  :is(.lab-story, .index-links>a, .service-grid>a):hover { text-decoration: none; }
  :is(.lab-story, .index-links>a, .service-grid>a):hover :is(h2,h3) { color: var(--accent-text, var(--accent)); text-decoration: none; }
  :is(.lab-story, .index-links>a, .service-grid>a):hover .link-arrow { transform: translateX(4px); }
}

/* Keyboard navigation receives the same composed optical response. */
.hero:has(h1 a:focus-visible, .text-link:focus-visible) .optical-sight,
.story-card:has(h2 a:focus-visible) .optical-sight { opacity: 1; --on: 1; }
:is(.text-link, .button, .site-footer nav a):focus-visible .link-arrow { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  .optical-sight, .optical-sight *,
  .image-link .story-image, .hero-media .story-image,
  .link-arrow, .masthead-mark::before, .masthead-mark::after,
  .header-actions .theme-icon, .search-symbol, .menu-symbol i,
  .lab-story, .lab-story h3,
  .index-links>a, .index-links h3,
  .service-grid>a, .service-grid h2,
  .hero h1 a, .story-card h2 a, .text-link, .consulting-shortcut,
  .site-footer nav a, .button { transition: none !important; }
  .image-link .story-image, .hero-media .story-image,
  .link-arrow, .header-actions .theme-icon, .search-symbol, .menu-symbol i,
  .lab-story h3, .index-links h3, .service-grid h2 { transform: none !important; }
}

/* Previews in grids keep their colour everywhere (Max, 2026-11-16: «нигде не десатурируй превьюшки в сетке»): no
   grayscale or desaturation in any tile layout, at rest or under the pointer. */
:is(.home-grid, .catalog-grid, .story-grid, .related, .mosaic, .home-signals) :is(.story-image, .image-link img, img) { filter: none !important; }
