@layer layout {
  /* ===
     Grid, sections, hairline structure.
     Sections are separated by 1px rules, not by empty space alone.
     === */

  .wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

  .wrap--narrow { max-width: 820px; }

  /* 12-column grid. Children opt in with .col-n / .col-n@md. */
  .grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s6) var(--s5); }

  .grid--tight { gap: var(--s4); }

  /* Section rhythm --- */

  .section {
    position: relative;
    padding-block: clamp(var(--s8), 9vw, var(--s10));
    background: var(--bg);
    color: var(--text);
  }

  .section--tight { padding-block: clamp(var(--s7), 6vw, var(--s9)); }

  /* The hairline that separates every major section. */
  .section + .section::before {
    content: '';
    position: absolute;
    inset-block-start: 0;
    inset-inline: var(--gutter);
    height: 1px;
    background: var(--line);
  }

  /* --- the cut
     The site-wide signature: a 1px red rule that draws itself left→right
     when its section enters the viewport. Same duration, same easing,
     everywhere — this is the motif that ties the pages together. */

  .cut {
    position: relative;
    height: 1px;
    margin-block: var(--s6);
    background: var(--line);
    overflow: hidden;
  }

  .cut::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--red);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--d-slow) var(--e-out);
  }

  .cut.is-in::after { transform: scaleX(1); }

  @media (prefers-reduced-motion: reduce) {
    .cut::after { transform: scaleX(1); }
  }

  .sec-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s4) var(--s6);
    margin-bottom: var(--s7);
  }

  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--s3);
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    font-weight: 500;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
    color: var(--muted);
  }

  .eyebrow__idx { color: var(--accent-text); font-variant-numeric: tabular-nums; }

  .eyebrow::after { content: ''; width: clamp(24px, 6vw, 72px); height: 1px; background: var(--line); }

  .sec-head__title { max-width: 22ch; }
  .sec-head__aside { max-width: 44ch; color: var(--muted); font-size: var(--t-sm); }

  /* Everything is full width until 700px; only the spans the pages actually use
     are defined. */
  .col-12, .col-7, .col-6, .col-5, .col-4 { grid-column: span 12; }

  @media (min-width: 700px) {
    .col-6, .col-4 { grid-column: span 6; }
  }

  @media (min-width: 1000px) {
    .col-7 { grid-column: span 7; }
    .col-5 { grid-column: span 5; }
    .col-4 { grid-column: span 4; }
  }

  /* --- ruled list
     Proof points and spec rows as a hairline table, not as icon cards. */

  .ruled { border-block-start: 1px solid var(--line); }

  .ruled__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s2) var(--s6);
    padding-block: var(--s5);
    border-block-end: 1px solid var(--line);
  }

  @media (min-width: 800px) {
    .ruled__row { grid-template-columns: 4rem minmax(0, 15rem) minmax(0, 1fr); align-items: start; }
  }

  .ruled__idx {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.12em;
    color: var(--accent-text);
    padding-top: 0.45em;
  }

  .ruled__term {
    font-family: var(--f-display);
    font-size: var(--t-h3);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
  }

  .ruled__desc { color: var(--muted); }

  /* Hovering a row bleeds the red edge in from the left. */
  .ruled__row { position: relative; transition: background var(--d-fast) var(--e-out); }

  .ruled__row::before {
    content: '';
    position: absolute;
    inset-block: -1px auto;
    inset-inline-start: calc(var(--gutter) * -0.5);
    width: 2px;
    height: 100%;
    background: var(--red);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform var(--d-base) var(--e-out);
  }

  @media (hover: hover) {
    .ruled__row:hover::before { transform: scaleY(1); }
  }

  .stack > * + * { margin-block-start: var(--s4); }
  .stack--lg > * + * { margin-block-start: var(--s6); }

  .lede {
    font-size: clamp(18px, 2.1vw, 22px);
    line-height: 1.5;
    letter-spacing: -0.015em;
    max-width: 62ch;
  }

  .prose { max-width: 68ch; }
  .prose > * + * { margin-block-start: var(--s4); }
  .prose h2 { margin-block-start: var(--s8); font-size: clamp(24px, 2.8vw, 34px); }
  .prose h3 { margin-block-start: var(--s7); }
  .prose ul, .prose ol { color: var(--muted); }

  .muted { color: var(--muted); }
  .mono {
    font-family: var(--f-mono);
    font-size: var(--t-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .tabular { font-variant-numeric: tabular-nums; }

  /**
   * P1 — every number that has to line up gets tabular figures. Proportional digits
   * make a column of masses shimmer as the rows change under a filter, which is
   * exactly the wrong impression for a page whose whole claim is precision.
   *
   * The mono face is tabular by default; this covers everywhere Archivo or Plex Sans
   * is setting figures instead.
   */
  .mono,
  .facts__v,
  .hero__spec,
  .counter__n,
  .odo,
  .timeline__year,
  .catalog-table,
  .msg-card__dim,
  .stock-search__hint,
  .inquiry-summary td,
  .hours td { font-variant-numeric: tabular-nums; }
}
