/* ==========================================================================
   Homepage on the mark system.
   --------------------------------------------------------------------------
   Loaded only by /index.html, after site.css, nav.css and
   /assets/css/mark-system.css (tokens, grid, frames, reveals, steps, FAQ,
   cursor, scroll ring: see the top of that file and /docs/mark-system.md).
   This file holds what only the homepage has: the night stage with the 3D
   mark and its grid, the results ticker, the pinned work reel, the showreel
   and the closing band.

   Motion rules:
     · nothing that carries content is hidden before JS runs (reveals are
       armed by mark-system.js, only below the fold);
     · prefers-reduced-motion: no reveals, no scroll-linked movement, the
       results ticker becomes a grid and the work reel a swipe row.
   ========================================================================== */

/* Overscroll: past the top and bottom the browser shows the root's colour.
   Night, so the rubber band above the hero and below the footer is dark. */
html {
  background: var(--night);
}

/* Everything after the stage is an opaque, positioned surface above it */
#main>section {
  position: relative;
  z-index: 1;
}

.hx-ticker,
#main>.mk-night {
  background: var(--night);
}

/* ── Stage: the projector beam ────────────────────────────────────────── */
/* --mx/--my: the cursor in px inside the host section (home-x.js); the
   defaults put the beam on the mark before the cursor moves. */
.hx-stage {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

.hx-stage__beam {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle min(40vmax, 720px) at var(--mx, 72%) var(--my, 44%), rgba(252, 212, 163, .10), transparent 62%),
    radial-gradient(ellipse 50% 60% at 74% 46%, rgba(130, 153, 187, .07), transparent 70%);
}

@property --mx {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 72%;
}

@property --my {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 44%;
}

/* No mouse to aim it: on touch screens the beam drifts slowly by itself */
@media (hover: none) and (prefers-reduced-motion: no-preference) {
  .hx-hero {
    animation: hx-drift 14s var(--ease-spin) infinite alternate;
  }
}

@keyframes hx-drift {
  0% {
    --mx: 78%;
    --my: 22%;
  }

  50% {
    --mx: 30%;
    --my: 30%;
  }

  100% {
    --mx: 62%;
    --my: 70%;
  }
}

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hx-hero {
  /* The stage stays put while the next sections slide over it. home-x.js
     sets top to min(0, viewport - hero height), so a hero taller than the
     screen (phones) scrolls to its end first and then holds. */
  position: sticky;
  top: 0;
  z-index: 0;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  /* Anchored from the top, not the bottom: when the web font swaps in and
     the sentence re-wraps, only what is below it moves, never the h1
     (bottom-anchored, the whole heading jumped: CLS 0.037). The top padding
     puts the block in the lower part of the screen as before: the screen
     height minus the block (~620 px), within 134 px and 40 % of the screen.
     Desktop allows ~700 px (block plus a bottom margin), below. */
  padding: clamp(calc(var(--nav-h) + var(--m-3)), calc(100svh - 620px), 40svh) 0 var(--m-R);
  overflow: clip;
}

/* covered by the page (home-x.js): nothing of it is visible, so it is not
   painted or composited either */
.hx-hero.is-covered>* {
  visibility: hidden;
}

.hx-hero__inner {
  position: relative;
  transform: translate3d(0, calc(var(--hp, 0) * -14vh), 0);
  opacity: calc(1 - var(--hp, 0) * 1.25);
}

.hx-hero__top {
  display: flex;
  align-items: center;
  gap: var(--m-h) var(--m);
  flex-wrap: wrap;
}

.hx-hero__top .mk-mono {
  color: var(--n-muted);
}

.hx-title {
  margin-top: var(--m);
  font-size: clamp(2.65rem, 7vw, var(--t7));
  line-height: .94;
  letter-spacing: -0.048em;
  font-weight: 500;
  text-wrap: initial;
}

/* Desktop: three fixed lines (the <br>s), so the type never re-wraps.
   Phones drop the breaks and let it flow. The text stays as direct children
   of the h1 so the whole heading is one LCP element. */
@media (min-width: 901px) {
  .hx-title {
    white-space: nowrap;
    /* The widest line is 8.5 em (Google Sans Flex: HR 8.44, EN 8.38; the
       metric-matched fallback, shown until the font lands, 8.55 / 8.61,
       still inside the margin below). It must end a module and a half before
       the mark's outer ring, whose left edge is set by .hx-logo below:
       box right edge at 106vw, ring left = that − (½ + 3.68 × .1028) × the
       box width (min(56vw, 94vh, 1040px)). The text starts at the shell's
       inner edge. All of it is known before the first paint, so the size
       never changes later (no CLS) and the h1 stays the LCP element.
       On short screens the three lines (2.82 em) also give way to the
       height, so the buttons stay above the fold. */
    font-size: min(7vw, var(--t7), calc((106vw - .8783 * min(56vw, 94vh, 1040px) - max(24px, (100vw - 1488px) / 2 + 24px) - 1.5 * var(--m)) / 8.5), calc((100svh - 450px) / 2.82));
  }
}

@media (max-width: 900px) {
  .hx-br {
    display: none;
  }
}

/* "u Rijeci" catches the projector: a light gradient centred on the cursor
   (--ex/--ey from home-x.js). Real text, clipped. */
.hx-title em {
  font-style: normal;
  white-space: nowrap;
  color: #9a9893;
  background: radial-gradient(circle 3.2em at var(--ex, 30%) var(--ey, 40%), #fff8ea 0%, var(--sun) 24%, #9a9893 64%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Boot: one slot of light, a module wide, passes through the heading,
   clipped to the glyphs. The text is painted from the first frame; only
   its fill changes, so the h1 stays the LCP element. */
.hx-js .hx-title {
  background: linear-gradient(90deg, var(--n-ink) 0 46%, #fff 47.4%, var(--sun) 48.6%, var(--sun) 51.4%, #fff 52.6%, var(--n-ink) 54% 100%);
  background-size: 360% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: hx-sweep 2.2s var(--ease-spin) .2s 1 both;
}

@keyframes hx-sweep {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: 0 0;
  }
}

.hx-hero__foot {
  display: grid;
  gap: var(--m) var(--m-2);
  margin-top: var(--m-2);
  align-items: end;
}

.hx-hero .lede {
  max-width: 29.6em; /* 46ch of Google Sans; em, so the fallback font keeps the same box */
  color: var(--n-ink);
  font-weight: 300;
}

.hx-hero .btn-row {
  margin-top: var(--m);
}

.hx-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--m-q) var(--m);
  font-size: .9rem;
  color: var(--n-muted);
}

.hx-meta strong {
  color: var(--n-ink);
  font-weight: 500;
}

.hx-js .hx-hero__foot>* {
  animation: hx-rise var(--dur-3) var(--ease-arrive) both;
  animation-delay: .55s;
}

.hx-js .hx-hero__foot>*+* {
  animation-delay: .7s;
}

@keyframes hx-rise {
  from {
    opacity: 0;
    transform: translate3d(0, var(--m), 0);
  }
}

@media (min-width: 901px) {
  /* The sentence (with the buttons) and the figures share a row only while
     both end before the mark's ring: the block is as wide as the space left
     of the ring (--ring-l, the ring's left edge minus the shell's edge and a
     module), and the figures wrap under the buttons when they don't fit.
     Pure CSS, known before the first paint: nothing moves later. */
  .hx-hero__foot {
    --ring-l: calc(106vw - .8783 * min(56vw, 94vh, 1040px) - max(24px, (100vw - 1488px) / 2 + 24px) - var(--m));
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    max-width: var(--ring-l);
    column-gap: var(--m-2);
  }

  .hx-hero__foot>:first-child {
    flex: 0 1 29.6em; /* about 45ch of Flex, in em (font-independent) */
    min-width: 0;
  }

  .hx-meta {
    flex: none;
  }

  /* Desktop: the block plus a bottom margin, so the buttons and figures
     stay on a laptop screen (1440 × 789: last button 697 px). */
  .hx-hero {
    padding-top: clamp(calc(var(--nav-h) + var(--m-3)), calc(100svh - 700px), 40svh);
  }

  /* The two buttons stay on one row: the row may run past the sentence's
     column, under the figures, which sit at the top beside the sentence.
     One row instead of two keeps the whole hero on a laptop screen; only
     where even that would reach the ring (901–960 px) do they wrap. */
  .hx-hero .btn-row {
    width: max-content;
    max-width: var(--ring-l);
  }

  /* the figures: a column beside the sentence, ruled like the mark's legs */
  .hx-meta {
    flex-direction: column;
    gap: var(--m-q);
    padding: 0 0 .4rem var(--m);
    border-left: 1px solid var(--n-line);
  }
}

/* Phones: the shorter label keeps the main button on one line (the full
   one wraps inside the capsule at 360 px) */
.hx-cta-s {
  display: none;
}

@media (max-width: 420px) {
  .hx-cta-l {
    display: none;
  }

  .hx-cta-s {
    display: inline;
  }
}

/* ── The mark and its grid ────────────────────────────────────────────── */
/* --lw is the panel's width. The 3D mark fills it so that one stroke is
   10.28 % of the panel (fov 26°, camera at 9, front face at +0.23) and the
   ring's centre sits 1.73 % of the panel above the panel's centre. The grid
   behind is drawn with exactly that module, through exactly that centre,
   so at the front view the legs and the slot stand on its lines. */
.hx-logo {
  --lw: min(56vw, 94vh, 1040px);
  --mm: calc(var(--lw) * .1028);
  --cy: calc(50% - var(--lw) * .0173);
  position: absolute;
  z-index: -1;
  /* centred on the first screen, not on the hero's height (which changes
     by a few px when the web font swaps in) */
  top: 50vh;
  top: 50svh;
  right: -6vw;
  width: var(--lw);
  aspect-ratio: 1;
  transform: translate3d(calc(var(--hp, 0) * -16vw), calc(-50% + var(--hp, 0) * -4vh), 0);
  touch-action: pan-y;
}

.hx-logo__grid,
.hx-logo__keys {
  position: absolute;
  top: calc(-1 * var(--lw));
  bottom: calc(-1 * var(--lw));
  pointer-events: none;
}

/* one line per module, 20 each side of the slot */
.hx-logo__grid {
  left: calc(50% - 20.5 * var(--mm));
  width: calc(41 * var(--mm) + 1px);
  background: repeating-linear-gradient(90deg, rgba(243, 241, 234, .09) 0 1px, transparent 1px var(--mm));
  -webkit-mask-image: radial-gradient(ellipse 34% 26% at 50% 50%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 34% 26% at 50% 50%, #000 30%, transparent 100%);
}

/* the mark's own four verticals, warmer, running the full stage */
.hx-logo__keys {
  left: calc(50% - 1.5 * var(--mm));
  width: calc(3 * var(--mm) + 1px);
  --k: rgba(252, 212, 163, .2);
  background:
    linear-gradient(var(--k), var(--k)) 0 0 / 1px 100% no-repeat,
    linear-gradient(var(--k), var(--k)) calc(var(--mm)) 0 / 1px 100% no-repeat,
    linear-gradient(var(--k), var(--k)) calc(2 * var(--mm)) 0 / 1px 100% no-repeat,
    linear-gradient(var(--k), var(--k)) calc(3 * var(--mm)) 0 / 1px 100% no-repeat;
  -webkit-mask-image: linear-gradient(transparent 12%, #000 30%, #000 64%, transparent 88%);
  mask-image: linear-gradient(transparent 12%, #000 30%, #000 64%, transparent 88%);
}

/* The slot runs on: from the bottom of the ring to the bottom of the stage,
   a light travels down between its two edges (the scroll cue). */
.hx-logo__spine {
  position: absolute;
  left: calc(50% - .5 * var(--mm));
  top: calc(var(--cy) + 3.68 * var(--mm));
  width: calc(var(--mm) + 1px);
  height: 100vh;
  overflow: hidden;
  pointer-events: none;
}

.hx-logo__spine i {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 26vh;
  background: linear-gradient(transparent, rgba(252, 212, 163, .16) 60%, rgba(252, 212, 163, .3) 96%, transparent);
  transform: translateY(-100%);
  animation: hx-spine 3.6s var(--ease-spin) 2.4s infinite;
}

@keyframes hx-spine {
  0% {
    transform: translateY(-100%);
  }

  70%,
  100% {
    transform: translateY(80vh);
  }
}

.hx-logo canvas,
.hx-logo video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 1.4s var(--ease-arrive);
}

.hx-logo canvas {
  cursor: grab;
}

.hx-logo canvas:active {
  cursor: grabbing;
}

/* Over the text that covers the mark, home-x-3d.js marks the hero so the
   whole disc reads as draggable (links and buttons keep their own cursor). */
.hx-hero.is-grab,
.hx-hero.is-grab :not(a, button, a *, button *) {
  cursor: grab;
}

.hx-hero.is-grabbing,
.hx-hero.is-grabbing * {
  cursor: grabbing !important;
  user-select: none;
}

/* The phone loop is filmed on black; screen blending drops the black and
   adds only the light, the way a projector adds light to a wall. The blend
   sits on the container: its transform makes it a stacking context. */
.hx-logo video {
  object-fit: contain;
}

@media (max-width: 900px) {
  .hx-logo {
    mix-blend-mode: screen;
  }
}

.hx-logo--film {
  mix-blend-mode: screen;
}

/* the loop with its own alpha channel needs no blend (home-x.js) */
.hx-logo.hx-logo--alpha {
  mix-blend-mode: normal;
}

.hx-logo[data-ready="true"] canvas,
.hx-logo[data-ready="true"] video {
  opacity: 1;
}

/* Before (or without) WebGL: the ring's outline where the mark will land */
.hx-logo__halo {
  position: absolute;
  left: 50%;
  top: var(--cy);
  width: calc(7.36 * var(--mm));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(252, 212, 163, .06), transparent 72%);
  box-shadow: inset 0 0 0 1px var(--n-line-2);
}

/* the filmed loop's window (home-x.js): 8.4 modules square round the ring
   (the mark is 7.36 wide; the turn and its perspective stay inside), the
   video at the panel's full size behind it */
.hx-logo__film {
  position: absolute;
  left: 50%;
  top: var(--cy);
  width: calc(8.4 * var(--mm));
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  overflow: hidden;
  pointer-events: none;
}

.hx-logo .hx-logo__film video {
  inset: auto;
  left: calc(50% - var(--lw) / 2);
  top: calc(50% - var(--lw) / 2 + var(--lw) * .0173);
  width: var(--lw) !important;
  height: var(--lw) !important;
}

/* The front view as a drawing (index.html): the mark at the size and centre
   the 3D and the filmed loop present it, so the hand-over is a cross-fade
   in place. Vector, not a picture: it can never be the LCP element. With JS
   off it stays. */
.hx-logo__poster {
  position: absolute;
  left: 50%;
  top: var(--cy);
  width: calc(7.36 * var(--mm));
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  transition: opacity 1.4s var(--ease-arrive);
}

.hx-logo[data-ready="true"] .hx-logo__poster {
  opacity: 0;
}

.hx-logo__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6%;
  text-align: center;
  color: var(--n-muted);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-arrive);
  pointer-events: none;
}

.hx-logo[data-ready="true"] .hx-logo__hint {
  opacity: 1;
}

.hx-logo[data-hint="dismissed"] .hx-logo__hint {
  opacity: 0;
}

/* With a mouse the cursor says "Povuci" over the mark instead */
@media (hover: hover) and (pointer: fine) {
  .hx-logo__hint {
    display: none;
  }
}

/* Phones and small tablets: no WebGL. A filmed loop of the same mark
   (rendered from the same scene) plays instead, loaded after the page. */
@media (max-width: 900px) {
  .hx-hero {
    justify-content: flex-start;
    min-height: 0;
    padding-top: calc(var(--nav-h) + min(62vw, 400px));
    padding-bottom: var(--m-3);
  }

  /* the whole ring stays inside the gutter: the ring's right edge is
     .3784 of the box from its centre, so the box overhangs by .1216 of its
     width minus the gutter (it used to be cut by the screen's edge) */
  .hx-logo {
    --lw: min(76vw, 520px);
    top: calc(var(--nav-h) - 6vw);
    right: calc(var(--gutter) - .1216 * var(--lw));
    transform: translate3d(calc(var(--hp, 0) * -18vw), calc(var(--hp, 0) * 8vh), 0);
  }

  .hx-logo__hint,
  .hx-logo__spine {
    display: none;
  }

  .hx-logo__keys {
    bottom: 0;
  }

  .hx-hero .btn-row .btn {
    justify-content: center;
  }
}

@media (max-width: 520px) {
  .hx-hero .btn-row .btn--solid {
    width: 100%;
  }
}

/* Small desktops and tablets in landscape (901–1099 px): the box moves in
   so the whole ring stays inside the gutter, and the title is sized from
   that position the same way */
@media (min-width: 901px) and (max-width: 1099px) {
  .hx-logo {
    right: calc(24px - .1216 * var(--lw));
  }

  .hx-title {
    font-size: min(7vw, var(--t7), calc((100vw - 24px - .7567 * min(56vw, 94vh, 1040px) - 24px - 1.5 * var(--m)) / 8.5), calc((100svh - 450px) / 2.82));
  }

  .hx-hero__foot {
    --ring-l: calc(100vw - 24px - .7567 * min(56vw, 94vh, 1040px) - 24px - var(--m));
  }
}

/* ── Results ticker ───────────────────────────────────────────────────── */
/* The <dl> is the content; the copies are aria-hidden filler for the loop.
   home-x.js adds .is-live (scroll-linked, no autoplay). Without it a grid. */
.hx-ticker {
  padding: var(--m-3) 0 var(--m-ri);
  overflow: hidden;
}

#main>section.hx-ticker {
  background: #0a0b0f;
}

.hx-ticker__label {
  display: flex;
  justify-content: space-between;
  gap: var(--m);
  color: var(--n-muted);
  margin-bottom: var(--m-2);
}

@media (max-width: 700px) {
  .hx-ticker__label span+span {
    display: none;
  }
}

.hx-ticker__set {
  margin: 0;
}

.hx-ticker__set>div {
  display: flex;
  align-items: flex-end;
  gap: var(--m);
}

.hx-ticker dt {
  font-size: clamp(2.6rem, 7.4vw, 8rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: .9;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hx-ticker dd {
  margin: 0 0 .35em;
  max-width: 17ch;
  font-size: .88rem;
  line-height: 1.35;
  color: var(--n-muted);
}

.hx-ticker dd b {
  display: block;
  margin-top: .2rem;
  color: var(--sun);
  font-weight: 500;
}

.hx-ticker__row--words {
  display: none;
}

.hx-ticker:not(.is-live) .hx-ticker__set[aria-hidden] {
  display: none;
}

.hx-ticker:not(.is-live) .hx-ticker__row {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hx-ticker:not(.is-live) .hx-ticker__set:not([aria-hidden]) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: var(--m-2) var(--m);
}

.hx-ticker:not(.is-live) .hx-ticker__set>div {
  flex-direction: column;
  align-items: flex-start;
  padding-top: var(--m);
  border-top: 1px solid var(--n-line);
}

.hx-ticker:not(.is-live) dt {
  font-size: clamp(2.4rem, 4.6vw, 4.4rem);
}

.hx-ticker.is-live .hx-ticker__row {
  display: flex;
  width: max-content;
  will-change: transform;
}

.hx-ticker.is-live .hx-ticker__set {
  display: flex;
  flex: none;
}

/* the sets are divided by the slot: two hairlines one module apart */
.hx-ticker.is-live .hx-ticker__set>div {
  position: relative;
  padding: 0 calc(var(--m-2) + var(--m-h)) 0 0;
  margin-right: var(--m-2);
}

.hx-ticker.is-live .hx-ticker__set>div::after {
  content: "";
  position: absolute;
  right: 0;
  top: 8%;
  bottom: 8%;
  width: var(--m);
  border-inline: 1px solid var(--n-line);
}

.hx-ticker.is-live .hx-ticker__row--words {
  display: flex;
  margin-top: var(--m-2);
}

.hx-ticker__row--words span {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding-right: .45em;
  font-size: clamp(2.2rem, 6.4vw, 6.8rem);
  font-weight: 300;
  letter-spacing: -0.045em;
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px rgba(243, 241, 234, .38);
}

/* between the words: the open ring, in the warm highlight */
.hx-ticker__row--words span::after {
  content: "";
  width: .5em;
  height: .5em;
  background: var(--sun);
  -webkit-mask: var(--mk-ring-url) center / contain no-repeat;
  mask: var(--mk-ring-url) center / contain no-repeat;
}

/* ── Services ─────────────────────────────────────────────────────────── */
.bento {
  display: grid;
  gap: var(--m);
}

.svc-card {
  position: relative;
  display: grid;
  gap: var(--m-2);
  align-content: space-between;
  padding: var(--m-2) var(--m-2) var(--m-2);
  background: var(--wash);
  overflow: hidden;
  isolation: isolate;
}

@media (max-width: 600px) {
  .svc-card {
    padding: var(--m-2) var(--m) var(--m);
  }
}

/* The projector: a soft pool of light follows the cursor over each card
   (--cx/--cy from home-x.js) */
.svc-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(480px circle at var(--cx, 50%) var(--cy, 50%), rgba(255, 255, 255, .75), transparent 62%);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-arrive);
  pointer-events: none;
}

.svc-card:hover::before {
  opacity: 1;
}

.svc-card--ink::before {
  background: radial-gradient(520px circle at var(--cx, 50%) var(--cy, 50%), rgba(252, 212, 163, .13), transparent 62%);
}

.svc-card .mk-icon {
  margin-bottom: var(--m);
  color: var(--ink);
}

.svc-card--ink .mk-icon {
  color: var(--sun);
}

.svc-card h3 {
  margin-top: var(--m-h);
  font-size: clamp(1.6rem, 3vw, var(--t3));
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 16ch;
}

.svc-card .svc-card__text {
  margin-top: var(--m-h);
  max-width: 42ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.svc-card__price {
  display: flex;
  flex-wrap: wrap;
  gap: var(--m-q) var(--m);
  margin-top: var(--m);
  padding-top: var(--m-h);
  border-top: 1px solid var(--hairline);
  font-size: .9rem;
  color: var(--muted);
}

.svc-card__price strong {
  color: var(--ink);
  font-weight: 500;
}

.svc-card .btn-row {
  margin-top: var(--m);
}

.svc-card .mock {
  width: min(100%, 440px);
}

.svc-card--ink {
  background: var(--night);
}

.svc-card--ink .mock__ok {
  color: var(--d-ink);
}

.svc-card--line {
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--hairline);
}

/* the --line card is outlined: give its notch the outline too */
.svc-card--line.mk-frame::after {
  content: "";
  position: absolute;
  left: var(--nx);
  top: 0;
  width: var(--nw);
  height: var(--nh);
  box-shadow: inset 1px 0 0 var(--hairline), inset -1px 0 0 var(--hairline), inset 0 -1px 0 var(--hairline);
  pointer-events: none;
}

.svc-card--line {
  background: var(--paper);
}

#usluge .svc-card--line {
  background: rgba(255, 255, 255, .55);
}

@media (min-width: 1000px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .svc-card--wide {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--m);
    align-items: center;
  }

  .svc-card--wide .mock {
    width: min(100%, 480px);
  }
}

/* ── Work reel ────────────────────────────────────────────────────────── */
.hx-work__pin {
  padding: var(--m-ri) 0 var(--m-R);
}

.hx-work__aside .lede {
  max-width: 40ch;
}

.hx-work__meter {
  display: flex;
  align-items: center;
  gap: var(--m);
  margin-top: var(--m);
  color: var(--n-muted);
}

.hx-work__meter b {
  color: var(--n-ink);
  font-weight: 500;
}

/* six slots, one per project; they fill as the reel passes */
.hx-work__slots {
  display: flex;
  gap: 5px;
}

.hx-work__slots i {
  display: block;
  width: 7px;
  height: 18px;
  background: var(--n-line);
  transition: background-color var(--dur-2) var(--ease-arrive);
}

.hx-work__slots i.is-on {
  background: var(--sun);
}

@media (min-width: 901px) {
  .hx-work__head .hx-work__aside {
    grid-area: lede;
    margin-bottom: .35em;
  }
}

.hx-work__viewport {
  margin-top: var(--m-2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.hx-work__viewport::-webkit-scrollbar {
  display: none;
}

.hx-work__track {
  display: flex;
  align-items: flex-start;
  gap: var(--m);
  width: max-content;
  padding-inline: max(var(--gutter), calc((100vw - var(--shell)) / 2 + var(--gutter)));
}

.hx-card {
  flex: none;
  width: min(80vw, 520px);
  scroll-snap-align: start;
  color: inherit;
  text-decoration: none;
}

.hx-card--lead {
  width: min(88vw, 780px);
}

.hx-card__shot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--night-2);
}

.hx-card--lead .hx-card__shot {
  aspect-ratio: 16 / 9;
}

.hx-card__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform var(--dur-3) var(--ease-arrive);
}

.hx-card--lead .hx-card__shot img {
  object-position: center;
}

.hx-card:hover .hx-card__shot img {
  transform: scale(1.035);
}

.hx-card__body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--m-q) var(--m-h);
  padding-top: var(--m-h);
}

.hx-card__idx {
  color: var(--sun);
}

.hx-card h3 {
  font-size: clamp(1.15rem, 1.5vw, 1.45rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hx-card__kind {
  font-size: .85rem;
  color: var(--n-muted);
  text-align: right;
}

.hx-card__result {
  grid-column: 1 / -1;
  margin-top: var(--m-h);
  padding-top: var(--m-h);
  border-top: 1px solid var(--n-line);
  font-size: .86rem;
  font-weight: 300;
  color: var(--n-muted);
}

.hx-card__result strong {
  color: var(--n-ink);
  font-weight: 500;
}

.hx-card h3::after {
  content: " →";
  opacity: 0;
  transition: opacity var(--dur-1) var(--ease-arrive);
}

.hx-card:hover h3::after,
.hx-card:focus-visible h3::after {
  opacity: 1;
}

/* End card: all projects. The open ring; on hover the arch joins it. */
.hx-card--all {
  display: grid;
  place-items: center;
  align-self: stretch;
  width: min(60vw, 300px);
  box-shadow: inset 0 0 0 1px var(--n-line);
  text-align: center;
  transition: background-color var(--dur-2) var(--ease-arrive), color var(--dur-2) var(--ease-arrive);
}

.hx-card--all span {
  display: grid;
  gap: var(--m);
  justify-items: center;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hx-card__ring {
  width: var(--m-3);
  height: var(--m-3);
  fill: currentColor;
}

.hx-card__arch {
  opacity: 0;
  transform: translateY(1px);
  transition: opacity var(--dur-2) var(--ease-arrive), transform var(--dur-2) var(--ease-arrive);
}

.hx-card--all:hover {
  background: var(--n-ink);
  color: var(--night);
}

.hx-card--all:hover .hx-card__arch,
.hx-card--all:focus-visible .hx-card__arch {
  opacity: 1;
  transform: none;
}

/* The reel's last card is a frame of its own, not an empty outline: a
   night panel with the slot notch, the mark's four verticals, the open ring
   large in the middle and the label on the bottom edge. */
.hx-card--all {
  --nx: var(--m-2);
  place-items: stretch;
  padding: var(--m-2) var(--m) var(--m);
  background:
    linear-gradient(90deg, transparent calc(36.4% - .5px), var(--n-line-2) 0 calc(36.4% + .5px), transparent 0 calc(45.5% - .5px), var(--n-line-2) 0 calc(45.5% + .5px), transparent 0 calc(54.5% - .5px), var(--n-line-2) 0 calc(54.5% + .5px), transparent 0 calc(63.6% - .5px), var(--n-line-2) 0 calc(63.6% + .5px), transparent 0),
    #0b0d12;
  box-shadow: none;
  clip-path: polygon(0 0, var(--nx) 0, var(--nx) calc(var(--m) / 2), calc(var(--nx) + var(--m)) calc(var(--m) / 2), calc(var(--nx) + var(--m)) 0, 100% 0, 100% 100%, 0 100%);
  text-align: left;
}

.hx-card--all span {
  grid-template-rows: 1fr auto;
  justify-items: stretch;
  align-items: end;
  height: 100%;
  font-size: clamp(1.25rem, 1.6vw, 1.6rem);
}

.hx-card--all span::after {
  content: "→";
  justify-self: end;
  margin-top: -1.3em;
  line-height: 1.3;
  font-weight: 300;
}

.hx-card--all .hx-card__ring {
  align-self: center;
  justify-self: center;
  width: 64%;
  height: auto;
  aspect-ratio: 1;
}

/* Mapping reveal on the Svjetlarna card: the dark model first, then the
   projection "switches on" as a scan line crosses it (--scan 0..1). */
.hx-map__on {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--scan, 1) * 104% - 4%), transparent calc(var(--scan, 1) * 104%));
  mask-image: linear-gradient(90deg, #000 calc(var(--scan, 1) * 104% - 4%), transparent calc(var(--scan, 1) * 104%));
}

.hx-map__off {
  filter: grayscale(1) brightness(.3) contrast(1.15);
}

/* the scan line moves by transform, not left: a moving `left` is a layout
   shift every frame (CLS 0.023 on a fast phone scroll). The box is as wide
   as the picture, so its translate percentages are the picture's; the line
   itself is the 2 px ::before at its left edge. */
.hx-map__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  transform: translateX(calc(var(--scan, 1) * 104% - 2%));
  opacity: calc(1 - var(--scan, 1) * var(--scan, 1) * var(--scan, 1));
  pointer-events: none;
}

.hx-map__line::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #fff6e0;
  box-shadow: 0 0 18px 4px rgba(252, 212, 163, .55);
}

.hx-map__tag {
  position: absolute;
  left: var(--m);
  top: var(--m);
  padding: .45rem .75rem;
  background: rgba(6, 7, 9, .72);
  color: var(--n-ink);
  backdrop-filter: blur(6px);
}

/* Pinned reel (desktop, motion allowed): home-x.js sets the section height
   and --tx; the frame sticks while the track slides sideways. */
.hx-work.is-pinned .hx-work__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + var(--m)) 0 var(--m-2);
  overflow: hidden;
  overflow: clip;
}

.hx-work.is-pinned .hx-work__head h2 {
  font-size: clamp(2rem, 3.9vw, var(--t4));
}

.hx-work.is-pinned .hx-work__viewport {
  overflow: visible;
  scroll-snap-type: none;
  margin-top: var(--m-2);
}

.hx-work.is-pinned .hx-work__track {
  align-items: flex-end;
  transform: translate3d(var(--tx, 0), 0, 0);
  will-change: transform;
}

.hx-work.is-pinned .hx-card {
  width: calc(min(46vh, 30vw) * 1.6);
}

.hx-work.is-pinned .hx-card--lead {
  width: calc(min(56vh, 40vw) * 16 / 9);
}

.hx-work.is-pinned .hx-card--all {
  width: min(22vw, 300px);
}

/* ── Showreel ─────────────────────────────────────────────────────────── */
.hx-video {
  padding-top: var(--m-R);
}

.reel {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0a0a0a center/cover no-repeat;
  --nh: var(--m);
}

.reel iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.reel__play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, .62), rgba(0, 0, 0, .08) 55%);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

/* the play button: the open ring, a light in its centre */
.reel__btn {
  display: grid;
  place-items: center;
  width: clamp(72px, 9vw, 128px);
  aspect-ratio: 1;
  transition: transform var(--dur-2) var(--ease-arrive);
}

.reel__btn svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .45));
}

.reel__ring {
  fill: #fff;
}

.reel__tri {
  fill: var(--sun);
  transition: transform var(--dur-2) var(--ease-arrive);
}

.reel__play:hover .reel__btn,
.reel__play:focus-visible .reel__btn {
  transform: scale(1.08);
}

.reel__play:hover .reel__tri {
  transform: translateX(.18px);
}

.reel__play:focus-visible {
  outline-offset: -6px;
}

.reel__meta {
  position: absolute;
  left: var(--m);
  right: var(--m);
  bottom: var(--m);
  display: grid;
  gap: .25rem;
  text-align: left;
}

.reel__meta strong {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.reel__meta span {
  font-size: .88rem;
  color: rgba(255, 255, 255, .8);
}

.reel-cap {
  margin-top: var(--m-h);
  font-size: .88rem;
  color: var(--n-muted);
}

.mk-band>.shell>.reel-cap {
  margin-top: var(--m-h);
}

@media (max-width: 600px) {
  .reel__meta span {
    display: none;
  }
}

/* ── Tools ──────────────────────────────────────────────────────────── */
.hx-tools .answer-card {
  margin: var(--m-2) 0 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: var(--paper);
}

.hx-tools__icon {
  margin-bottom: var(--m);
  color: var(--ink);
}

/* ── Closing band ─────────────────────────────────────────────────────── */
.hx-close {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: var(--m-D) 0 var(--m-ri);
}

/* The mark again, as its construction drawing: circles, the diameter, the
   four verticals, then the chrome fills it. Its centre sits on the title's
   right-hand side, its verticals run the band's full height. */
.hx-close__mark {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: max(0px, calc((100vw - var(--shell)) / 2));
  width: min(46vw, 720px);
  height: auto;
  aspect-ratio: 1;
  transform: translateY(-50%);
  overflow: visible;
}

@media (max-width: 900px) {
  .hx-close__mark {
    top: var(--m);
    right: -24vw;
    width: 96vw;
    transform: none;
  }
}

.hx-close__title {
  margin-top: var(--m);
  font-size: clamp(2.6rem, 8vw, var(--t7));
  line-height: .9;
  letter-spacing: -0.055em;
}

.hx-close__title .hx-l {
  display: block;
  white-space: nowrap;
  font-weight: var(--w, 500);
}

.hx-close__title .hx-l+.hx-l {
  font-weight: var(--w2, 500);
}

.hx-close__foot {
  display: grid;
  gap: var(--m) var(--m-2);
  margin-top: var(--m-2);
  align-items: end;
}

.hx-close .lede {
  max-width: 48ch;
}

.hx-close .btn-row {
  margin-top: 0;
}

@media (min-width: 901px) {
  .hx-close__foot {
    max-width: 54%;
  }
}

/* ── Reduced motion: everything still, everything visible ────────────── */
@media (prefers-reduced-motion: reduce) {

  .hx-js .hx-title,
  .hx-js .hx-hero__foot>* {
    animation: none;
  }

  .hx-logo__spine {
    display: none;
  }

  .hx-hero__inner,
  .hx-logo {
    opacity: 1;
  }

  .hx-hero__inner {
    transform: none;
  }
}
