@layer layout {
  .scroll-progress {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    height: 1.5px;
    z-index: 120;
    background: var(--brass);
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: scroll()) {
      @keyframes grow-scroll-progress {
        from {
          transform: scaleX(0);
        }
        to {
          transform: scaleX(1);
        }
      }

      .scroll-progress {
        animation: grow-scroll-progress auto linear;
        animation-timeline: scroll(root block);
      }
    }
  }

  .wrap {
    width: min(var(--max-w), 100% - (var(--gutter) * 2));
    margin-inline: auto;
  }

  /* Two-column Swiss Monograph Spine: 224px left rail + main editorial column */
  .editorial-grid {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    gap: 1.5rem clamp(2rem, 5vw, 4.5rem);
    align-items: start;
  }

  /* Quiet Top Hairline Bar */
  .site-header {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    height: var(--header-h);
    z-index: 80;
    background: var(--bg-header);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-block-end: 1px solid var(--rule);
  }

  .header-grid {
    height: 100%;
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    gap: clamp(1rem, 4vw, 4.5rem);
    align-items: center;
  }

  .wordmark {
    font-family: var(--font-mono);
    font-size: 0.84rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--ink);
    white-space: nowrap;
    justify-self: start;
  }

  .wordmark span {
    color: var(--brass);
  }

  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
  }

  .header-meridian {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .header-tools {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
  }

  .tool-link {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--ink-2);
    letter-spacing: 0.03em;
    white-space: nowrap;
    padding-block: 0.2rem;
    border-block-end: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .tool-link:hover {
    color: var(--ink);
    border-color: var(--brass);
  }

  .tool-sep {
    color: var(--rule-strong);
    font-size: 0.72rem;
    user-select: none;
  }

  .tool-kbd {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-2);
    padding: 0.16rem 0.44rem;
    border: 1px solid var(--rule-strong);
    border-radius: 3px;
    white-space: nowrap;
    transition: border-color 0.2s ease, color 0.2s ease;
  }

  .tool-kbd:hover {
    border-color: var(--brass);
    color: var(--ink);
  }

  /* Main Vertical Flow */
  main {
    padding-block-start: var(--header-h);
  }

  .band {
    padding-block: clamp(4rem, 8.5vh, 6.75rem);
    border-block-end: 1px solid var(--rule);
  }

  .rail-sticky {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
  }

  .rail-label {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-block-end: 0.55rem;
  }

  .rail-meta {
    font-size: 0.84rem;
    line-height: 1.75;
    color: var(--ink-2);
  }

  /* Subtle reveal */
  .reveal {
    opacity: 1;
    transform: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    .reveal.is-pending {
      opacity: 0;
      transform: translateY(14px);
    }

    .reveal.is-visible {
      opacity: 1;
      transform: translateY(0);
      transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
    }
  }

  @media (max-width: 900px) {
    .editorial-grid {
      grid-template-columns: 1fr;
      gap: 1.5rem;
    }

    .rail-sticky {
      position: static;
    }

    .header-grid {
      grid-template-columns: auto 1fr;
      gap: 1rem;
    }

    .header-right {
      justify-content: flex-end;
    }

    .header-meridian {
      display: none;
    }
  }

  @media (max-width: 480px) {
    .header-tools {
      gap: 0.55rem;
    }

    .tool-kbd {
      display: none;
    }
  }
}
