/*
 * process, "How we work and what it costs" (home-bots-pricing 2026-11-28). The template's chapter intro (lib/story.css),
 * then Assess, Prove, Deploy, Run as dotted words on one connected line, and under them the price ladder: one white
 * panel split into four rungs (how long, the indicative AED range, what happens, what you get). From 1,024 px the four
 * steps are columns of one grid whose rows are shared (subgrid), so every price, every "What happens" and every
 * "What you get" sits on the same line across the four rungs; the panel is the grid's own ::before, behind rows 3-7.
 * Below 1,024 px the steps stack on a vertical line and each rung is its own card.
 * The step in focus is lit (section.js sets data-on / data-done / data-current on each step and data-live on the
 * section); without JavaScript or with reduced motion every step is lit. The prices are never dimmed.
 * Every rule is scoped to [data-section="process"].
 */

/* NEW TOKENS ------------------------------------------------------------------------------------ */
[data-section="process"] {
  --proc-word: clamp(48px, 4.4vw, 64px);    /* the dotted word: 48 px at 1,024, 63 px at 1,440 */
  --proc-ratio: 17;                         /* lattice pitch = word size / ratio (section.js reads it) */
  --proc-pitch: calc(var(--proc-word) / var(--proc-ratio));
  --proc-r: calc(var(--proc-pitch) * 0.38);
  --proc-ink: rgb(11 13 16 / 0.88);
  --proc-node: 44px;
  --proc-pad: 28px;                         /* inside a rung, and the inset of the step words above it */
  --proc-pad-y: 28px;
  --proc-gap: 44px;                         /* between stacked steps (below 1,024) */
  --proc-accent: var(--hf-color-sea-600);
  --proc-dim: 0.3;                          /* a word not yet lit */
  --proc-price: clamp(30px, 2.9vw, 42px);   /* the AED range: the chapter's hero */
  --proc-panel: #FFFFFF;
  --proc-line: rgb(11 13 16 / 0.1);
  --proc-panel-shadow: 0 0 0 1px rgb(11 13 16 / 0.07), 0 1px 2px rgb(11 13 16 / 0.04), 0 30px 60px -34px rgb(30 42 54 / 0.24);
}
:lang(ar) [data-section="process"] { --proc-word: clamp(44px, 4vw, 58px); --proc-ratio: 16; --proc-price: clamp(28px, 2.6vw, 38px); }

/* The body: the story row's container */
[data-section="process"] .proc-body {
  max-inline-size: calc(var(--hf-story-max) + 2 * var(--hf-story-pad-x));
  margin-inline: auto;
  padding: 64px var(--hf-story-pad-x) 64px;
}
[data-section="process"] .proc-steps { margin: 0; padding: 0; list-style: none; }
[data-section="process"] .proc-step { position: relative; min-inline-size: 0; }
[data-section="process"] .proc-lit { display: none; }

/* the node (on the line) and "Step 1" under it */
[data-section="process"] .proc-num {
  display: grid; justify-items: start; row-gap: 18px; margin: 0 0 10px;
  font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--hf-color-text-2);
}
[data-section="process"] .proc-node {
  position: relative; z-index: 1;
  display: grid; place-items: center; flex: none;
  inline-size: var(--proc-node); block-size: var(--proc-node); border-radius: 50%;
  background: var(--hf-surface-card); color: var(--hf-color-text-2);
  box-shadow: 0 0 0 1px rgb(11 13 16 / 0.12);
  transition: background-color var(--hf-dur-3) var(--hf-ease-out), color var(--hf-dur-3) var(--hf-ease-out), box-shadow var(--hf-dur-3) var(--hf-ease-out);
}
[data-section="process"] .proc-node .hf-icon { font-size: 20px; }

/* The dotted word: real text, filled with a lattice of ink dots (background-clip: text) */
[data-section="process"] .proc-word {
  position: relative; justify-self: start;
  margin: 0; padding-block: 0.04em 0.06em;
  font-size: var(--proc-word); font-weight: 700; line-height: 1; letter-spacing: -0.045em;
  color: var(--hf-color-text-1); white-space: nowrap;
  transition: opacity 0.5s var(--hf-ease-out);
}
:lang(ar) [data-section="process"] .proc-word { letter-spacing: 0; line-height: 1.3; padding-block: 0; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  [data-section="process"] .proc-word__text {
    color: transparent;
    background-image: radial-gradient(circle at 50% 50%, var(--proc-ink) 0 var(--proc-r), transparent calc(var(--proc-r) + 0.6px));
    background-size: var(--proc-pitch) var(--proc-pitch);
    -webkit-background-clip: text; background-clip: text;
  }
}
/* with the canvas drawn (section.js) the CSS lattice steps aside; the text stays for reading and selection */
[data-section="process"] .proc-word[data-canvas] .proc-word__text { background-image: none; }
[data-section="process"] .proc-word__canvas { position: absolute; z-index: 0; max-inline-size: none; pointer-events: none; }
/* the full stop: ink, and sea on the step in focus (polish-home: the chapter's eyebrow square is this view's one amber) */
[data-section="process"] .proc-stop { position: relative; z-index: 1; background: var(--hf-color-text-1); transition: background-color var(--hf-dur-3) var(--hf-ease-out); }
[data-section="process"] .proc-step[data-current] .proc-stop { background: var(--proc-accent); }

/* A rung of the ladder ------------------------------------------------------------------------- */
[data-section="process"] .proc-time {
  display: flex; align-items: center; gap: 8px; margin: 0 0 16px;
  font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--hf-color-text-2);
}
[data-section="process"] .proc-time .hf-icon { flex: none; font-size: 18px; color: var(--hf-color-text-3); transition: color var(--hf-dur-3) var(--hf-ease-out); }
[data-section="process"] .proc-step[data-current] .proc-time .hf-icon { color: var(--proc-accent); }
[data-section="process"] .proc-price { display: grid; justify-items: start; row-gap: 6px; margin: 0; }
[data-section="process"] .proc-price__cur {
  font-size: 12.5px; font-weight: 600; line-height: 1.2; letter-spacing: 0.02em; color: var(--hf-color-text-3);
}
[data-section="process"] .proc-price__num {
  font-size: var(--proc-price); font-weight: 650; line-height: 1.02; letter-spacing: -0.035em;
  font-variant-numeric: lining-nums; color: var(--hf-color-text-1); white-space: nowrap;
}
[data-section="process"] .proc-unit { margin: 8px 0 0; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--hf-color-text-2); }
[data-section="process"] .proc-fact { margin-block-start: 20px; padding-block-start: 16px; border-block-start: 1px solid var(--proc-line); }
[data-section="process"] .proc-fact__k { margin: 0 0 4px; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--hf-color-text-3); }
[data-section="process"] .proc-fact__v { margin: 0; font-size: 15px; line-height: 1.5; color: var(--hf-color-text-1); text-wrap: pretty; }
[data-section="process"] .proc-fact--do .proc-fact__v { color: var(--hf-color-text-2); }
/* v7 book: the rung's action row (lib/book.css .hf-book-row): what it is, what it costs, then the action */
[data-section="process"] .proc-act { margin-block-start: 22px; }
[data-section="process"] .proc-act .hf-btn { --h: 44px; }
[data-section="process"] .proc-act--rescue { margin-block-start: 0; margin-inline-start: 28px; }

/* The notes: the "not quotes" caveat ABOVE the ladder (polish-home: read before the first figure, on phones too),
   the stalled-pilot line under it. Quiet, but in full ink where it matters ---------------------------- */
[data-section="process"] .proc-note--lead {
  max-inline-size: 64ch; margin: 0 0 48px; padding-inline: var(--proc-pad);
}
[data-section="process"] .proc-notes {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
  max-inline-size: calc(72ch + 2 * var(--proc-pad));
  margin-block-start: 28px; padding-inline: var(--proc-pad);
}
[data-section="process"] .proc-note {
  display: flex; align-items: flex-start; gap: 10px; margin: 0;
  font-size: 15px; line-height: 1.55; color: var(--hf-color-text-2); text-wrap: pretty;
}
[data-section="process"] .proc-note > .hf-icon { flex: none; font-size: 18px; margin-block-start: 2px; color: var(--hf-color-text-3); }
[data-section="process"] .proc-note__link {
  display: inline; padding-block: 12px;
  font-weight: 600; color: var(--hf-color-text-1); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
}
[data-section="process"] .proc-note__link:hover { color: var(--hf-tone); }
[data-section="process"] .proc-note__link .hf-icon { font-size: 16px; margin-inline-start: 4px; vertical-align: -0.2em; }

/* Lit and not yet lit (only while section.js drives it: data-live) ---------------------------- */
[data-section="process"][data-live] .proc-step:not([data-on]) .proc-word { opacity: var(--proc-dim); }
[data-section="process"][data-live] .proc-step:not([data-done])::after { transform: scaleX(0); }
[data-section="process"] .proc-step[data-on] .proc-node,
[data-section="process"]:not([data-live]) .proc-node {
  background: var(--proc-accent); color: #FFFFFF; box-shadow: 0 0 0 1px var(--proc-accent);
}
[data-section="process"] .proc-step[data-current] .proc-node { box-shadow: 0 0 0 1px var(--proc-accent), 0 0 0 6px rgb(0 103 118 / 0.12); }

/* Arabic */
:lang(ar) [data-section="process"] .proc-num { font-size: 15px; }
:lang(ar) [data-section="process"] .proc-time { font-size: 15px; }
:lang(ar) [data-section="process"] .proc-price__cur { font-size: 13px; letter-spacing: 0; }
:lang(ar) [data-section="process"] .proc-price__num { letter-spacing: 0; line-height: 1.25; }
:lang(ar) [data-section="process"] .proc-fact__k { font-size: 13.5px; }
:lang(ar) [data-section="process"] .proc-fact__v, :lang(ar) [data-section="process"] .proc-note { line-height: 1.75; }

/* From 1,024 px: four columns on one line, one shared set of rows ------------------------------- */
@media (min-width: 64rem) {
  [data-section="process"] .proc-steps {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(8, auto);
    column-gap: 0;
  }
  /* the panel: one white card behind the rungs (rows 3-8; v7 book: row 8 is the action row), split by three hairlines */
  [data-section="process"] .proc-steps::before {
    content: ""; grid-row: 3 / 9; grid-column: 1 / -1;
    border-radius: 24px; padding-block: 26px;
    background-image:
      linear-gradient(90deg,
        transparent calc(25% - 1px), var(--proc-line) calc(25% - 1px) 25%, transparent 25%
        calc(50% - 1px), var(--proc-line) calc(50% - 1px) 50%, transparent 50%
        calc(75% - 1px), var(--proc-line) calc(75% - 1px) 75%, transparent 75%),
      linear-gradient(var(--proc-panel), var(--proc-panel));
    background-clip: content-box, padding-box;
    box-shadow: var(--proc-panel-shadow);
  }
  [data-section="process"] .proc-step {
    grid-row: 1 / span 8; display: grid; grid-template-rows: subgrid; align-content: start;
    padding-inline: var(--proc-pad);
  }
  [data-section="process"] .proc-step:nth-child(1) { grid-column: 1; }
  [data-section="process"] .proc-step:nth-child(2) { grid-column: 2; }
  [data-section="process"] .proc-step:nth-child(3) { grid-column: 3; }
  [data-section="process"] .proc-step:nth-child(4) { grid-column: 4; }
  [data-section="process"] .proc-rung { display: contents; }
  /* every part sits in the step's one column (explicit, so the wash below may overlap the rows) */
  [data-section="process"] .proc-step > *, [data-section="process"] .proc-rung > * { grid-column: 1; }
  /* the rung of the step in focus: a faint sea-glass wash from the top of the panel (opacity only) */
  [data-section="process"] .proc-lit {
    display: block; grid-row: 3 / 9; margin-inline: calc(-1 * var(--proc-pad)); align-self: stretch;
    background: linear-gradient(180deg, rgb(0 103 118 / 0.06) 0%, rgb(0 103 118 / 0) 78%);
    opacity: 0; transition: opacity 0.6s var(--hf-ease-out); pointer-events: none;
  }
  [data-section="process"] .proc-step:first-child .proc-lit { border-start-start-radius: 24px; }
  [data-section="process"] .proc-step:last-child .proc-lit { border-start-end-radius: 24px; }
  [data-section="process"][data-live] .proc-step[data-current] .proc-lit { opacity: 1; }
  [data-section="process"] .proc-num { grid-row: 1; }
  [data-section="process"] .proc-word { grid-row: 2; margin-block-end: 30px; }
  [data-section="process"] .proc-time { grid-row: 3; padding-block-start: var(--proc-pad-y); }
  [data-section="process"] .proc-price { grid-row: 4; align-self: end; }
  [data-section="process"] .proc-unit { grid-row: 5; }
  [data-section="process"] .proc-fact--do { grid-row: 6; }
  [data-section="process"] .proc-fact--get { grid-row: 7; }
  [data-section="process"] .proc-rung > .proc-act { grid-row: 8; align-self: end; margin-block-start: 24px; padding-block-end: var(--proc-pad-y); column-gap: 16px; }

  /* the connector from this node to the next one (the last step has none) */
  [data-section="process"] .proc-step:not(:last-child)::before,
  [data-section="process"] .proc-step:not(:last-child)::after {
    content: ""; position: absolute;
    inset-block-start: calc(var(--proc-node) / 2 - 1px);
    inset-inline-start: calc(var(--proc-pad) + var(--proc-node) + 10px);
    inline-size: calc(100% - var(--proc-node) - 20px);
    block-size: 2px; border-radius: 2px;
  }
  [data-section="process"] .proc-step:not(:last-child)::before { background: rgb(11 13 16 / 0.1); }
  [data-section="process"] .proc-step:not(:last-child)::after {
    background: var(--proc-accent);
    transform: scaleX(1); transform-origin: 0 50%;
    transition: transform 0.6s var(--hf-ease-out);
  }
  [dir="rtl"] [data-section="process"] .proc-step:not(:last-child)::after { transform-origin: 100% 50%; }
}

/* 1,024-1,279: narrower rungs */
@media (min-width: 64rem) and (max-width: 79.99rem) {
  [data-section="process"] { --proc-pad: 20px; --proc-pad-y: 24px; }
  [data-section="process"] .proc-fact__v { font-size: 14.5px; }
  [data-section="process"] .proc-notes { gap: 16px 32px; }
}

/* Below 1,024: the steps stack on a vertical line; each rung is a card ------------------------- */
@media (max-width: 63.99rem) {
  [data-section="process"] { --proc-word: clamp(46px, 10vw, 72px); --proc-price: clamp(32px, 7vw, 44px); }
  :lang(ar) [data-section="process"] { --proc-word: clamp(42px, 9vw, 62px); --proc-price: clamp(30px, 6.4vw, 40px); }
  [data-section="process"] .proc-body { padding-block-start: 48px; max-inline-size: 680px; }
  [data-section="process"] .proc-steps { display: grid; grid-template-columns: minmax(0, 1fr); row-gap: var(--proc-gap); }
  [data-section="process"] .proc-step { padding-inline-start: calc(var(--proc-node) + 18px); }
  [data-section="process"] .proc-num {
    display: flex; align-items: center; gap: 18px;
    margin-inline-start: calc(-1 * (var(--proc-node) + 18px)); margin-block-end: 12px;
  }
  [data-section="process"] .proc-word { margin-block-end: 18px; }
  [data-section="process"] .proc-rung {
    padding: 22px 22px 20px; border-radius: 20px;
    background: var(--proc-panel); box-shadow: var(--proc-panel-shadow);
  }
  [data-section="process"] .proc-fact { margin-block-start: 16px; padding-block-start: 14px; }
  /* the connector runs down from this node to the next one */
  [data-section="process"] .proc-step:not(:last-child)::before,
  [data-section="process"] .proc-step:not(:last-child)::after {
    content: ""; position: absolute;
    inset-block-start: calc(var(--proc-node) + 8px);
    inset-inline-start: calc(var(--proc-node) / 2 - 1px);
    inline-size: 2px; block-size: calc(100% + var(--proc-gap) - var(--proc-node) - 16px); border-radius: 2px;
  }
  [data-section="process"] .proc-step:not(:last-child)::before { background: rgb(11 13 16 / 0.1); }
  [data-section="process"] .proc-step:not(:last-child)::after {
    background: var(--proc-accent);
    transform: scaleY(1); transform-origin: 50% 0;
    transition: transform 0.6s var(--hf-ease-out);
  }
  [data-section="process"][data-live] .proc-step:not([data-done])::after { transform: scaleY(0); }
  [data-section="process"] .proc-notes { grid-template-columns: minmax(0, 1fr); margin-block-start: 32px; padding-inline: 0; }
  [data-section="process"] .proc-note--lead { margin-block-end: 36px; padding-inline: 0; }
}
@media (max-width: 47.99rem) {
  [data-section="process"] { --proc-node: 40px; --proc-gap: 40px; }
  [data-section="process"] .proc-body { padding-block-start: 40px; }
  [data-section="process"] .proc-step { padding-inline-start: calc(var(--proc-node) + 14px); }
  [data-section="process"] .proc-num { gap: 14px; margin-inline-start: calc(-1 * (var(--proc-node) + 14px)); }
  [data-section="process"] .proc-rung { padding: 18px 18px 16px; border-radius: 18px; }
  [data-section="process"] .proc-fact__v { font-size: 14.5px; }
  [data-section="process"] .proc-note { font-size: 14.5px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-section="process"] .proc-word, [data-section="process"] .proc-node,
  [data-section="process"] .proc-step::after, [data-section="process"] .proc-time .hf-icon,
  [data-section="process"] .proc-lit { transition: none; }
}
