/* Two ways to work with Ariqor (src/partials/scope.html): Frontend only, or Frontend +
   backend, compared on one board on the section's glass panel, then a link to pricing and to
   the project configurator.

   The picture does the explaining. Each option draws the five layers of one system as the same
   isometric stack (brand & design and app & website on top, backend and data below, hosting
   and care at the foot), each slab with its colour (--layer-*-side) and a small drawing of
   what it holds. Frontend + backend: every slab solid, joined by pins through the whole
   stack. Frontend only: backend and data are dashed, empty outlines held by one bracket,
   "Backend & data: your own service, or none"; the rest stays solid. Solid against dashed,
   filled against empty, so the difference never rests on colour alone. Each picture is one
   labelled image (role="img", the label from scope.*.visual); the slab names beside it are
   visual only.

   Geometry (viewBox 0 0 204 306): the stack is centred on x 80; slab n (1 brand to 5 cloud)
   has its top face centred at y 34, 88, 142, 196, 250, which is where each name sits, as a
   share of the picture's height (--y). A slab's face is an 80 x 80 rounded square seen
   through matrix(1 .4 -1 .4): 149.5 units wide, 60 tall, with 7 units of side below it.
   Pins rise at x 32 and x 128 from a port on each face into the slab above; leaders run from
   x 158 to a node at x 199, and the names start just right of the picture.

   Motion (scope.js, only while .is-motion): when a picture comes into view the slabs settle
   into place from the foundation up, the empty outlines fade in after them, then the pins
   and the names; while the picture stays in view, small pulses run down the left pins and
   back up the right ones (a request and its answer) in a slow cascade. The finished state
   is the plain CSS: without JavaScript or with reduced motion, every slab, pin and name is
   simply there and nothing moves.

   On a desktop the two options stand side by side and their parts line up row by row (a
   seven-row subgrid: head, picture, three points, fit, examples). Under 720px they stack.

   Also here: the configurator box in the contact section (.contact__plan), which only the
   home page has. */

/* ------------------------------------------------------------------ tokens */

.scope {
  --scope-face: #ffffff;
  --scope-rim: rgb(36 93 118 / 0.78);
  --scope-dot: rgb(36 93 118 / 0.2);
  --scope-glyph: #245d76;
  --scope-glyph-soft: #dcedf5;
  /* The dashed outline of what is not ours: 3.4:1 against the board. */
  --scope-ghost: #7f8c97;
  --scope-ghost-fill: #f8fafc;
  --scope-pin: rgb(36 93 118 / 0.5);
  --scope-pulse: #3b7d9a;
  --scope-lead: rgb(36 93 118 / 0.42);
  --scope-shadow: rgb(36 93 118 / 0.24);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .scope {
    --scope-face: #262a31; --scope-rim: rgb(167 216 239 / 0.72); --scope-dot: rgb(167 216 239 / 0.16);
    --scope-glyph: #a7d8ef; --scope-glyph-soft: rgb(167 216 239 / 0.16);
    --scope-ghost: #8b97a3; --scope-ghost-fill: #1f2329;
    --scope-pin: rgb(167 216 239 / 0.45); --scope-pulse: #e5f3f9; --scope-lead: rgb(167 216 239 / 0.38); --scope-shadow: rgb(0 0 0 / 0.55);
  }
}
:root[data-theme='dark'] .scope {
  --scope-face: #262a31; --scope-rim: rgb(167 216 239 / 0.72); --scope-dot: rgb(167 216 239 / 0.16);
  --scope-glyph: #a7d8ef; --scope-glyph-soft: rgb(167 216 239 / 0.16);
  --scope-ghost: #8b97a3; --scope-ghost-fill: #1f2329;
  --scope-pin: rgb(167 216 239 / 0.45); --scope-pulse: #e5f3f9; --scope-lead: rgb(167 216 239 / 0.38); --scope-shadow: rgb(0 0 0 / 0.55);
}

/* ------------------------------------------------------------------ the board */

.scope-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 0;
  border: 1px solid var(--card-border); border-radius: var(--r-l);
  background: var(--card-bg); box-shadow: var(--card-shadow);
}
.scope-option {
  display: flex; flex-direction: column; min-width: 0;
  padding: clamp(24px, 3.4vw, 52px) clamp(20px, 3.4vw, 52px) clamp(26px, 3.4vw, 48px);
}
.scope-option + .scope-option { border-left: 1px solid var(--line-strong); }

.scope-option__title {
  font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.875rem); font-weight: 640; line-height: 1.15; letter-spacing: -0.025em;
  text-wrap: balance;
}
.scope-option__short { margin-top: 6px; color: var(--text-2); line-height: 1.5; text-wrap: pretty; }

.scope-option > .scope-visual { margin-top: clamp(24px, 3vw, 40px); }

/* What it includes: three short points. */
.scope-option__list { display: grid; row-gap: 12px; margin-top: clamp(24px, 3vw, 36px); }
.scope-option__list li { display: flex; align-items: flex-start; gap: 12px; font-size: 1rem; line-height: 1.45; }
.scope-option__list .icon { margin-top: 2px; color: var(--accent); }

/* Who it suits, then examples, under a hairline. */
.scope-option__facts {
  display: grid; row-gap: 16px; margin-top: clamp(24px, 3vw, 32px); padding-top: clamp(20px, 2.4vw, 26px);
  border-top: 1px solid var(--line-strong);
}
.scope-option__facts dt { margin-bottom: 4px; font-size: 0.875rem; font-weight: 600; line-height: 1.4; color: var(--accent); }
.scope-option__facts dd { margin: 0; font-size: 0.9688rem; line-height: 1.55; color: var(--text-2); text-wrap: pretty; }
.scope-option__examples dd { display: inline; color: var(--text); }
.scope-option__examples dd + dd::before { content: '\00B7'; content: '\00B7' / ''; margin-inline: 0.5em; color: var(--text-2); }

/* Side by side: the two options share seven rows, so their parts line up. */
@media (min-width: 720px) {
  @supports (grid-template-rows: subgrid) {
    .scope-board { grid-template-rows: repeat(7, auto); }
    .scope-option { display: grid; grid-row: span 7; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
    /* The picture keeps exactly the height of its drawing: the names are placed on that height. */
    .scope-option > .scope-visual { align-self: start; }
    .scope-option__list { grid-row: span 3; grid-template-rows: subgrid; }
    .scope-option__facts { grid-row: span 2; grid-template-rows: subgrid; }
  }
}
/* Stacked, with a hairline between them. */
@media (max-width: 719px) {
  .scope-board { grid-template-columns: minmax(0, 1fr); }
  .scope-option + .scope-option { border-left: 0; border-top: 1px solid var(--line-strong); }
  .scope-option { padding: 24px 18px 26px; }
}

/* --------------------------------------------------------------- the picture */

.scope-visual {
  /* The stack's width; the names take the rest of the row. */
  --stack-w: clamp(132px, 48%, 220px);
  position: relative;
}
.scope-art { display: block; width: var(--stack-w); height: auto; overflow: visible; }
.scope-art * { vector-effect: non-scaling-stroke; }

.scope-art__shade { stop-color: var(--scope-shadow); }

/* A slab: its side in the layer's colour, then its face, a fine dot grid and its drawing. */
.scope-slab { --side: var(--layer-brand-side); }
.scope-slab[data-layer='ui'] { --side: var(--layer-ui-side); }
.scope-slab[data-layer='api'] { --side: var(--layer-api-side); }
.scope-slab[data-layer='data'] { --side: var(--layer-data-side); }
.scope-slab[data-layer='cloud'] { --side: var(--layer-cloud-side); }
.scope-slab__side { fill: var(--side); }
.scope-slab__face { fill: var(--scope-face); stroke: var(--scope-rim); stroke-width: 1.25; }
.scope-art pattern circle { fill: var(--scope-dot); }
.scope-g-line { fill: none; stroke: var(--scope-glyph); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.scope-g-fill { fill: var(--scope-glyph); }
.scope-g-soft { fill: var(--scope-glyph-soft); }
.scope-g-swatch--1 { fill: var(--layer-ui); }
.scope-g-swatch--2 { fill: var(--layer-api); }
.scope-g-swatch--3 { fill: var(--layer-data); }

/* Not ours: an empty, frosted outline. The body is one layer, so its parts never double up. */
.scope-ghost__body { fill: var(--scope-ghost-fill); opacity: 0.72; }
.scope-ghost__line { fill: none; stroke: var(--scope-ghost); stroke-width: 1.25; stroke-dasharray: 4 3; stroke-linecap: round; }

/* Pins between the layers, their ports, and the pulses that travel along them. */
.scope-pin { fill: none; stroke: var(--scope-pin); stroke-width: 1.25; }
.scope-pins--ghost .scope-pin { stroke: var(--scope-ghost); stroke-dasharray: 3 3; }
.scope-port { fill: var(--scope-rim); }
.scope-pins--ghost .scope-port { fill: var(--scope-ghost); }
.scope-pulse { fill: var(--scope-pulse); opacity: 0; }

/* Leaders out to the names. */
.scope-lead path { fill: none; stroke: var(--scope-lead); stroke-width: 1; }
.scope-lead circle { fill: var(--scope-rim); }
.scope-lead--ghost path { stroke: var(--scope-ghost); stroke-dasharray: 3 3; }
.scope-lead--ghost circle { fill: var(--scope-ghost); }

/* The names, each centred on its slab's leader. */
.scope-visual__label {
  position: absolute; left: calc(var(--stack-w) + 6px); right: 0; top: var(--y);
  translate: 0 -50%;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; color: var(--text);
  overflow-wrap: anywhere; hyphens: auto;
}
.scope-visual__label[data-row='1'] { --y: 11.111%; }
.scope-visual__label[data-row='2'] { --y: 28.758%; }
.scope-visual__label[data-row='3'] { --y: 46.405%; }
.scope-visual__label[data-row='4'] { --y: 64.052%; }
.scope-visual__label[data-row='5'] { --y: 81.699%; }
/* Backend and data, together, on the bracket's middle (y 169). */
.scope-visual__label[data-row='34'] { --y: 55.229%; }
.scope-visual__label--yours { color: var(--text-2); }
.scope-visual__note { display: block; margin-top: 1px; font-weight: 480; }
@media (max-width: 479px) {
  .scope-visual__label { font-size: 0.75rem; line-height: 1.2; }
}

/* ------------------------------------------------------------------ motion */
/* Foundation first: the order each part settles in (--i), slab 5 (hosting) to slab 1 (brand). */
.scope-visual [data-row='5'] { --i: 0; }
.scope-visual [data-row='4'] { --i: 1; }
.scope-visual [data-row='3'], .scope-visual [data-row='34'] { --i: 2; }
.scope-visual [data-row='2'] { --i: 3; }
.scope-visual [data-row='1'] { --i: 4; }

.scope-visual.is-motion .scope-slab {
  transition: opacity 560ms var(--ease) calc(var(--i) * 110ms), transform 820ms var(--ease) calc(var(--i) * 110ms);
}
.scope-visual.is-motion .scope-slab--ghost { transition-delay: calc(var(--i) * 110ms + 160ms); }
.scope-visual.is-motion .scope-pins { transition: opacity 480ms var(--ease) calc(var(--i) * 110ms + 420ms); }
.scope-visual.is-motion .scope-lead { transition: opacity 520ms var(--ease) calc(var(--i) * 110ms + 300ms); }
.scope-visual.is-motion .scope-visual__label {
  transition: opacity 520ms var(--ease) calc(var(--i) * 110ms + 300ms), transform 620ms var(--ease) calc(var(--i) * 110ms + 300ms);
}
/* Before the picture has been in view. */
.scope-visual.is-motion:not(.is-settled) .scope-slab { opacity: 0; transform: translateY(-18px); }
.scope-visual.is-motion:not(.is-settled) .scope-slab--ghost { transform: none; }
.scope-visual.is-motion:not(.is-settled) .scope-pins,
.scope-visual.is-motion:not(.is-settled) .scope-lead { opacity: 0; }
.scope-visual.is-motion:not(.is-settled) .scope-visual__label { opacity: 0; transform: translateX(-6px); }

/* While in view: a pulse down each left pin, then its answer up the right one, layer after layer. */
.scope-visual.is-motion.is-playing .scope-pulse { animation: scope-pulse-down 3.6s var(--ease-io) calc(1.4s + (4 - var(--i)) * 380ms) infinite both; }
.scope-visual.is-motion.is-playing .scope-pulse--up { animation-name: scope-pulse-up; }
@keyframes scope-pulse-down {
  0% { opacity: 0; transform: translateY(0); }
  8% { opacity: 1; }
  38% { opacity: 1; transform: translateY(42px); }
  46%, 100% { opacity: 0; transform: translateY(42px); }
}
@keyframes scope-pulse-up {
  0%, 50% { opacity: 0; transform: translateY(0); }
  56% { opacity: 1; }
  86% { opacity: 1; transform: translateY(-42px); }
  94%, 100% { opacity: 0; transform: translateY(-42px); }
}

/* ------------------------------------------------------------- the foot */

.scope__foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 20px 40px; margin-top: clamp(28px, 4vw, 44px);
}
.scope__note { flex: 1 1 320px; max-width: 56ch; color: var(--text-2); line-height: 1.55; text-wrap: pretty; }
.scope__actions { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 559px) {
  .scope__actions { width: 100%; }
  .scope__actions .button { flex: 1 1 100%; }
}

/* ------------------------------------------- contact: the configurator */

.contact__plan {
  max-width: 420px; margin-top: 36px; padding: 20px;
  border: 1px solid var(--accent-line); border-radius: var(--r-m); background: var(--accent-soft);
}
.contact__plan-title { font-weight: 640; line-height: 1.4; color: var(--text); }
.contact__plan-body { margin-top: 6px; font-size: 0.9688rem; line-height: 1.5; color: var(--text-2); }
.contact__plan .button { margin-top: 16px; }
.contact__plan + .contact__direct { margin-top: 16px; }
@media (max-width: 559px) { .contact__plan .button { width: 100%; } }

/* Forced colours: solid slabs are framed and filled with the text colour on their sides,
   what is not ours stays a dashed outline; nothing depends on the layer colours. */
@media (forced-colors: active) {
  .scope-art { forced-color-adjust: none; }
  .scope-slab__side { fill: CanvasText; }
  .scope-slab__face { fill: Canvas; stroke: CanvasText; }
  .scope-art pattern circle, .scope-g-soft { fill: none; }
  .scope-art__shadow, .scope-pulse { display: none; }
  .scope-g-line { stroke: CanvasText; }
  .scope-g-fill, .scope-g-swatch--1, .scope-g-swatch--2, .scope-g-swatch--3 { fill: CanvasText; }
  .scope-ghost__body { fill: Canvas; opacity: 1; }
  .scope-ghost__line, .scope-pin, .scope-pins--ghost .scope-pin, .scope-lead path, .scope-lead--ghost path { stroke: CanvasText; }
  .scope-port, .scope-pins--ghost .scope-port, .scope-lead circle, .scope-lead--ghost circle { fill: CanvasText; }
}
