/* ==========================================================================
   page-automation.css: the Automation & Machine Building page's own components (A owns this file).
   Vision 4.2 and 3.5. Page components (N6, N11, N12, N16, N17, N23) and the placement of shared ones live in
   @layer components; the rules for what the line package moves or replaces (the button row, the content shown
   without JavaScript) live in @layer page, after @layer line (ROUND3-BUILD-READY.md 3.4). Tokens only.
   Breakpoints: 48em (tablet), 68.75em (desktop layout), as site.css.
   ========================================================================== */

@layer components {

  /* --- 1 · Top: the lockup on cols 1-4, the value proposition and who it is for on cols 5-12 (vision 4.2.1) --- */
  .top-row { display: grid; gap: var(--s-6) var(--gutter); margin-top: var(--s-6); align-items: start; }
  .top-row__lockup { display: grid; justify-items: start; }
  .top-row__who { margin-top: var(--s-5); font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-2); }
  /* the logo band is the visual break near the top: it starts inside the first screen at 1280 x 853 (vision 4.2.1),
     so the gap above it is --s-8 rather than the section gap */
  .top-row + .logos--band { margin-top: var(--s-8); }
  @media (min-width: 68.75em) {
    .top-row { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .top-row__lockup { grid-column: 1 / span 4; }
    .top-row__main { grid-column: 5 / span 8; }
  }
  /* from 1100 to about 1215 px the four columns are narrower than the lockup (342 px): it takes its own phone sizes
     there (N10: mark 3.5rem, "+" 0.75rem each side, wordmark 1.25rem), so it stays on one line */
  @media (min-width: 68.75em) and (max-width: 75.99em) {
    .top-row .lockup__spark { height: 3.5rem; }
    .top-row .lockup__plus { margin-inline: 0.75rem; }
    .top-row .lockup .logo__mark { width: 1.5rem; height: 1.5rem; }
    .top-row .lockup .logo__word { font-size: 1.25rem; }
  }

  /* the three situations: mono number, one line each (desktop and phones), three across on tablets */
  .situations { margin-top: var(--s-3); border-top: var(--hair) solid var(--line); }
  .situations > li {
    display: flex; align-items: baseline; gap: var(--s-4); padding-block: 0.5rem; border-bottom: var(--hair) solid var(--line);
    font: var(--w-medium) var(--fs-h4) / 1.35 var(--font-sans); letter-spacing: -0.01em; color: var(--ink);
  }
  .situations .mono { flex: none; width: 2.25rem; }
  @media (min-width: 48em) and (max-width: 68.74em) {
    .situations { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); border-top: 0; }
    .situations > li { flex-direction: column; gap: var(--s-2); padding-block: var(--s-4) 0; border-top: var(--hair) solid var(--line); border-bottom: 0; }
  }
  @media (max-width: 47.99em) {
    .situations > li { gap: var(--s-3); }
    .situations .mono { width: 1.75rem; }
  }

  /* --- 2 · N6 the figures row, inside the logo band after its caption, on a hairline ("Spark Laser in numbers") --- */
  .figures-row { justify-self: stretch; display: grid; gap: var(--s-5) var(--gutter); margin-top: var(--s-3); padding-top: var(--s-6); border-top: var(--hair) solid var(--line); }
  .figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .figures > div {
    display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--s-2);
    padding-inline: var(--gutter); border-left: var(--hair) solid var(--line);
  }
  .figures > div:first-child { padding-left: 0; border-left: 0; }
  .figures > div:last-child { padding-right: 0; }
  .figures dd {
    margin: 0; font: var(--w-medium) var(--fs-h2) / 1.1 var(--font-sans); letter-spacing: var(--ls-h2);
    font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap;
  }
  @media (min-width: 68.75em) {
    .figures-row { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
    .figures-row__label { grid-column: 1 / span 2; padding-top: 0.35rem; }
    .figures { grid-column: 3 / span 10; }
  }
  @media (max-width: 47.99em) {
    .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--s-5); }
    .figures > div:nth-child(odd) { padding-left: 0; border-left: 0; }
    .figures > div:nth-child(even) { padding-right: 0; }
  }

  /* --- 01 · N23 who brings what: three cells (three across on tablets too), lists on hairlines --- */
  .specs--who { --spec-rows: 2; }
  .who__list > li { padding-block: 0.65rem; border-top: var(--hair) solid var(--line); font-size: var(--fs-body); line-height: 1.45; color: var(--ink); }
  .who__list > li:last-child { border-bottom: var(--hair) solid var(--line); }
  .who__together {
    padding-top: 0.65rem; border-top: var(--hair) solid var(--line);
    font: var(--w-medium) var(--fs-lead) / 1.45 var(--font-sans); letter-spacing: -0.005em; color: var(--ink); max-width: 24em;
  }
  @media (min-width: 48em) and (max-width: 68.74em) {
    .specs.specs--who { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .specs.specs--who > .spec:nth-child(n) { padding: 0 var(--gutter); border-top: 0; border-left: var(--hair) solid var(--line); }
    .specs.specs--who > .spec:first-child { padding-left: 0; border-left: 0; }
    .specs.specs--who > .spec:last-child { padding-right: 0; }
  }
  @media (max-width: 47.99em) {
    .specs--who .spec { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); border-bottom: 0; }
    .specs--who .spec > * { grid-column: 1; }
  }

  /* --- 02 · What we automate: the h3 after the line mount, N20 (site.css) and the closing line --- */
  .automate__title, .machines__title { font: var(--w-strong) var(--fs-h3) / var(--lh-snug) var(--font-sans); letter-spacing: var(--ls-h3); }
  .automate__title { margin-top: calc(2 * var(--block-gap)); }
  .automate__list { margin-top: var(--block-gap); }
  /* (the group heading is --ink-2 until a station of its group is selected: site.css 5.29 since A-01 landed) */
  .automate__close { margin-top: var(--block-gap); font: var(--w-medium) var(--fs-lead) / 1.45 var(--font-sans); letter-spacing: -0.005em; color: var(--ink); }

  /* --- 03 · the two offers (Version 1's pair on cols 1-6 and 7-12), N16 tags, the list of machines built from scratch --- */
  .offer { gap: var(--s-4); }
  .offer__head { display: grid; gap: 0.4rem; }
  .offer__title { font: var(--w-strong) var(--fs-h3) / 1.25 var(--font-sans); letter-spacing: var(--ls-h3); }
  .offer > p { max-width: var(--measure); }
  .offer__sub { margin-top: var(--s-3); font: var(--w-strong) var(--fs-h4) / 1.35 var(--font-sans); letter-spacing: -0.012em; }
  .offer__list > li { padding-block: 0.55rem; border-top: var(--hair) solid var(--line); font-size: var(--fs-small); line-height: 1.5; color: var(--ink); }
  .offer__list > li:last-child { border-bottom: var(--hair) solid var(--line); }
  .offer .offer__link { color: var(--ink); }
  .build__fig { margin-top: calc(2 * var(--block-gap)); }

  /* N16 tags: Version 1's mono, inline, "·" between them (silent), wrapping; never bordered chips. The "·" trails its
     tag, so a wrapped line ends with one and never starts with one. */
  .tags {
    display: flex; flex-wrap: wrap; row-gap: 0.15rem;
    font: 500 var(--fs-mono) / 1.5 var(--font-mono); letter-spacing: var(--ls-mono); text-transform: uppercase; color: var(--ink-3);
  }
  .tags > li:not(:last-child)::after { content: "\00B7"; content: "\00B7" / ""; margin-inline: 0.5em; }

  /* --- 03 · N17 machine cards in two groups: a mono label on a hairline, then three cards (two on tablets);
     on phones each group is Version 1's rail (site.css .rail--phone) --- */
  .machines { margin-top: calc(2 * var(--block-gap)); }
  .machines__group { margin-top: var(--block-gap); }
  .machines__group + .machines__group { margin-top: var(--s-8); }
  .machines__bar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); min-height: 2.75rem;
    margin-bottom: var(--s-5); padding-top: var(--s-2); border-top: var(--hair) solid var(--line);
  }
  .card--machine .card__body { gap: var(--s-2); }
  .card--machine .card__title { margin-top: 0.1rem; }
  .card--machine .tags { margin-top: var(--s-1); }
  .card__link { margin-top: auto; padding-top: var(--s-2); }
  .card__link .link { color: var(--ink); }
  .machines__cell { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-5); padding: var(--s-6); background: var(--surface); }
  .machines__cell > p:first-child { font: var(--w-medium) var(--fs-h4) / 1.4 var(--font-sans); letter-spacing: -0.01em; color: var(--ink); max-width: 18em; }
  @media (max-width: 47.99em) { .machines__cell { padding: var(--s-5); } }

  /* --- 04 · N12 the spotlight: a --surface panel; logo and badges cols 1-4, Spark's words cols 5-12 --- */
  .spotlight { display: grid; gap: var(--s-6) var(--gutter); padding: clamp(1.5rem, 4vw, 3rem); background: var(--surface); }
  .spotlight__side { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
  .spotlight__logo { width: auto; height: 2rem; }
  .spotlight__badge { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); }
  .spotlight__badge::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; background: var(--ink); }
  .spotlight__source { color: var(--ink-3); }
  .spotlight__text { margin-top: var(--s-5); max-width: 40rem; font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-2); }
  @media (min-width: 68.75em) {
    .spotlight { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .spotlight__side { grid-column: 1 / span 4; flex-direction: column; align-items: flex-start; align-content: flex-start; gap: var(--s-3); }
    .spotlight__logo { margin-bottom: var(--s-3); }
    .spotlight__main { grid-column: 5 / span 8; }
  }
  @media (max-width: 47.99em) { .spotlight__logo { height: 1.75rem; } }

  /* --- 05 · the ink band: the display line under its head, N11 the six steps, the closing line and Book a call --- */
  #process .section-head + .lede { margin-top: var(--block-gap); }
  .steps { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: var(--s-8); }
  .steps__item { position: relative; display: grid; align-content: start; }
  .steps__no { display: block; }
  .steps__mark { display: flex; align-items: center; height: 0.5rem; margin: var(--s-3) calc(-1 * var(--gutter)) var(--s-4) 0; }
  .steps__node { flex: none; width: 0.5rem; height: 0.5rem; background: var(--inv-ink); }
  .steps__rail { flex: 1; height: 1px; background: var(--inv-ink-2); transform-origin: 0 50%; }
  .steps__item:last-child .steps__rail { visibility: hidden; }
  .steps__title { font: var(--w-strong) var(--fs-h4) / 1.3 var(--font-sans); letter-spacing: -0.012em; color: var(--inv-ink); }
  .steps__text { margin-top: var(--s-2); max-width: 30em; font-size: var(--fs-small); line-height: 1.55; color: var(--inv-ink-2); }
  @media (min-width: 48em) {
    .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-7) var(--gutter); }
    .steps__item:nth-child(3n) .steps__rail { visibility: hidden; }
  }
  @media (min-width: 68.75em) {
    .steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .steps__item:nth-child(3n) .steps__rail { visibility: visible; }
    .steps__item:last-child .steps__rail { visibility: hidden; }
  }
  /* phones: one column, the rail down the left 0.25rem in, the content indented 2rem */
  @media (max-width: 47.99em) {
    .steps__item { padding: 0 0 var(--s-6) 2rem; }
    .steps__item:last-child { padding-bottom: 0; }
    .steps__title { margin-top: var(--s-2); }
    .steps__mark {
      position: absolute; left: 0; top: calc(var(--fs-mono) * 0.7 - 0.25rem); height: 100%; width: 0.5rem; margin: 0;
      flex-direction: column;
    }
    .steps__rail { width: 1px; height: auto; transform-origin: 50% 0; }
  }
  /* the rail draws on first view (page-automation.js sets is-waiting, then is-drawing): x on desktop and tablets,
     y on phones, 480 ms, 60 ms apart; the nodes fade in (vision N11). Static under reduced motion. */
  .steps.is-waiting .steps__rail { scale: 0 1; }
  .steps.is-waiting .steps__node { opacity: 0; }
  .steps.is-drawing .steps__rail { transition: scale 480ms var(--ease-out) calc(60ms * var(--i, 0)); }
  .steps.is-drawing .steps__node { transition: opacity var(--dur-3) var(--ease-out) calc(60ms * var(--i, 0)); }
  @media (max-width: 47.99em) { .steps.is-waiting .steps__rail { scale: 1 0; } }
  @media (prefers-reduced-motion: reduce) {
    .steps.is-waiting .steps__rail { scale: 1 1; }
    .steps.is-waiting .steps__node { opacity: 1; }
  }
  .process-end {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5) var(--s-6);
    margin-top: var(--s-8); padding-top: var(--s-6); border-top: var(--hair) solid var(--inv-line);
  }
  .process-end__line { font: var(--w-medium) var(--fs-lead) / 1.45 var(--font-sans); letter-spacing: -0.005em; color: var(--inv-ink); }
  @media (max-width: 47.99em) { .process-end .btn { width: 100%; } }

  /* --- 06 · industries: specs 4 x 2 (site.css), each example followed by its mono tag --- */
  .industry { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); align-content: start; }
  /* site.css puts every .spec__text in the cell's column 2 on phones; inside .industry they share one column */
  .industry > :is(.spec__text, .industry__tag) { grid-column: 1; }
  .industry__tag + .spec__text { margin-top: var(--s-3); }
  .industry .spec__text a { text-decoration: underline; text-decoration-color: var(--ink-3); }
  .industry .spec__text a:hover { text-decoration-color: currentColor; }

  /* --- 07 · technologies: the lead line, the brand accordion on its own top hairline, the note and the link --- */
  .tech__line { font: var(--w-medium) var(--fs-lead) / 1.45 var(--font-sans); letter-spacing: -0.005em; color: var(--ink); max-width: 34em; }
  .acc--brands { border-top: var(--hair) solid var(--line); }
  .tech__note { margin-top: var(--s-5); max-width: 46rem; line-height: 1.6; }
  .tech__more { margin-top: var(--s-3); }
  @media (min-width: 68.75em) { .tech__note, .tech__more { margin-left: calc((100% + var(--gutter)) / 3); } }

  /* --- 08 · the team's two links --- */
  .team-links { display: flex; flex-wrap: wrap; gap: 0 var(--s-6); margin-top: var(--s-6); }

  /* forced colours: the shapes drawn as backgrounds (vision 3.4) */
  @media (forced-colors: active) {
    .steps__node, .steps__rail, .spotlight__badge::before { forced-color-adjust: none; background-color: CanvasText; }
  }

  /* print: the ink band prints white (site.css); its steps, nodes and rail in ink; blocks never split */
  @media print {
    .steps__title { color: var(--ink); }
    .steps__text { color: var(--ink-2); }
    .steps__node { background: var(--ink); opacity: 1 !important; }
    .steps__rail { background: var(--ink-3); scale: 1 1 !important; }
    .process-end { border-top-color: var(--line); }
    .process-end__line { color: var(--ink); }
    .steps__item, .spotlight, .offer, .figures-row, .machines__cell, .situations > li, .who__list > li { break-inside: avoid; }
  }
}

@layer page {
  /* --- 02 · inside the line's button row (the page's own element, which the component keeps and moves):
     the button and its line side by side; on phones the button full width with its line under it --- */
  .line-mount__act { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); }
  .line-mount__btnline { flex: 1 1 18rem; max-width: 36rem; font-size: var(--fs-small); line-height: 1.5; color: var(--ink-2); }
  @media (max-width: 47.99em) { .line-mount__act .btn { width: 100%; } }

  /* the page's list of the seven stations, wherever it shows before the component replaces it (no JavaScript, an
     import that failed, reduced motion before the module mounts): Version 1's rows, as the component draws its own */
  .line-mount__list ol { padding: 0; list-style: none; border-top: var(--hair) solid var(--ink); }
  .line-mount__list li {
    display: grid; grid-template-columns: 3rem minmax(0, 1fr); column-gap: var(--s-4);
    padding-block: 0.85rem; border-bottom: var(--hair) solid var(--line); line-height: 1.5;
  }
  .line-mount__list li > .mono { grid-row: span 2; line-height: 1.9; }
  .line-mount__list li > b { font-weight: var(--w-strong); }
  .line-mount__list li > span:last-child { grid-column: 2; color: var(--ink-2); }

  /* without JavaScript (or when the import failed) the mount is a plain column: give its parts the site's rhythm */
  :is(html:not(.js) .line-mount, .line-mount.is-fallback) > [data-line-still] { display: grid; gap: var(--s-3); }
  :is(html:not(.js) .line-mount, .line-mount.is-fallback) > .line-mount__note { margin-top: var(--s-3); }
  :is(html:not(.js) .line-mount, .line-mount.is-fallback) > .line-mount__list { margin-top: var(--s-6); }
  :is(html:not(.js) .line-mount, .line-mount.is-fallback) > .line-mount__act { margin-top: var(--s-6); }

  /* print before the module has mounted: the page's still and list, not the empty box the screen reserves */
  @media print {
    .js .line-mount:not(.cl-line, .is-fallback) [data-line-still] picture { display: contents; }
    .js .line-mount:not(.cl-line, .is-fallback) [data-line-still]::before { display: none; }
  }
}

/* print, before the module has mounted: line.css keeps the page's list visually hidden with !important while the
   screen waits for the component; an !important declaration in an earlier layer wins, so this one sits in
   @layer components (vision 3.3 rule 12: the line prints as its seven stations) */
@layer components {
  @media print {
    .js .line-mount:not(.cl-line, .is-fallback) [data-line-list] {
      position: static !important; width: auto !important; height: auto !important; overflow: visible !important;
      clip-path: none !important; white-space: normal !important;
    }
  }
}
