/* Tube-sheets cluster — editorial journey UX (page-scoped helpers)
   Keeps NPRO navy/cyan/rust. Avoids stacked card grids.

   Geometry model (desktop):
   - Shells that paint a band (rail, navy chapter, meta-strip) stay full-bleed.
   - INNER content uses the same 1240 + 24px inset as .nav-inner / section.block.
   - Do not center each chip; keep a left-reading row on the content grid.
*/

:root{
  --npro-nav-offset: 56px;
  --npro-journey-offset: 52px;
  --npro-content-max: 1240px;
  --npro-content-gutter: 24px;
  /* Matches content left/right edge of a centered 1240 block with 24px padding */
  --npro-content-inline: max(var(--npro-content-gutter), calc((100% - var(--npro-content-max)) / 2 + var(--npro-content-gutter)));
}
html{
  scroll-padding-top: calc(var(--npro-nav-offset) + var(--npro-journey-offset) + 8px);
}

/* Sticky scope: rail sticks under site header until this wrapper ends */
.journey-sticky-scope{
  position: relative;
  width: 100%;
  max-width: none;
  overflow: visible;
}

/* Full-bleed chapter journey rail (edge-to-edge shell) */
.journey-rail{
  position: sticky;
  top: var(--npro-nav-offset);
  z-index: 45; /* below .nav (50–100), above chapter content */
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family:'IBM Plex Mono', monospace; font-size:0.68rem;
  letter-spacing:0.06em; text-transform:uppercase;
  border-top:1px solid rgba(95,200,206,0.18);
  border-bottom:1px solid rgba(95,200,206,0.35);
  background:var(--navy-deep, #0A1A29);
  box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}
.journey-rail-inner{
  display:flex; flex-wrap:wrap; gap:4px 0; align-items:center;
  width: 100%;
  max-width: var(--npro-content-max);
  margin: 0 auto;
  padding: 10px var(--npro-content-gutter);
  box-sizing: border-box;
}
.journey-rail a{
  color:rgba(255,255,255,0.62); text-decoration:none; font-weight:600;
  padding:10px 10px; border-right:1px solid rgba(255,255,255,0.12);
  min-height: 44px; display:inline-flex; align-items:center;
  box-sizing: border-box;
  transition: color .15s ease, box-shadow .15s ease;
}
.journey-rail a:last-child{border-right:none;}
.journey-rail a:hover{color:var(--cyan, #5FC8CE);}
.journey-rail a:focus-visible{
  outline:2px solid var(--cyan, #5FC8CE);
  outline-offset:2px;
}
.journey-rail a[aria-current="true"]{
  color:#fff;
  background: rgba(95,200,206,0.08);
  box-shadow: inset 0 -2px 0 var(--cyan, #5FC8CE);
}
.journey-rail .jr-label{
  color:var(--cyan, #5FC8CE); padding:10px 12px 10px 0; border-right:1px solid rgba(255,255,255,0.12);
  margin-right:4px; min-height:44px; display:inline-flex; align-items:center;
  flex-shrink:0;
}

/* Full-bleed navy band; INNER content aligned to the 1240 content grid */
.journey-sticky-scope > section.block.full-navy,
.journey-sticky-scope > section.block.block-navy,
.journey-sticky-scope > section.full-navy,
.journey-sticky-scope > section.block-navy{
  max-width: none !important;
  width: 100%;
  box-sizing: border-box;
  padding-left: var(--npro-content-inline);
  padding-right: var(--npro-content-inline);
}

.meta-strip{
  display:grid; grid-template-columns:repeat(4,1fr);
  width: 100%;
  max-width: none;
  margin:0;
  padding: 20px var(--npro-content-inline) 28px;
  box-sizing: border-box;
  font-family:'IBM Plex Mono', monospace; font-size:0.72rem;
  background: var(--paper, #F4F5F0);
}
.meta-strip > div{
  padding:14px 16px; border:1px solid var(--paper-line, #DADCD1);
  border-left:none; background:#fff;
}
.meta-strip > div:first-child{border-left:1px solid var(--paper-line, #DADCD1);}
.meta-strip b{display:block; color:var(--rust, #BD5326); letter-spacing:0.06em; margin-bottom:6px; font-size:0.68rem;}
.meta-strip span{color:#33393F; font-size:0.86rem; font-family:'IBM Plex Sans', sans-serif; letter-spacing:0; text-transform:none;}
.meta-strip a{color:var(--cyan-dim, #3D8B90); font-weight:600; text-decoration:none;}
.meta-strip a:hover{text-decoration:underline;}

.chapter{
  position:relative;
  scroll-margin-top: calc(var(--npro-nav-offset) + var(--npro-journey-offset) + 12px);
}
.journey-sticky-scope [id]{
  scroll-margin-top: calc(var(--npro-nav-offset) + var(--npro-journey-offset) + 12px);
}
.chapter-num{
  font-family:'IBM Plex Mono', monospace; font-size:0.7rem; letter-spacing:0.14em;
  color:var(--cyan, #5FC8CE); margin-bottom:8px;
}

.figure-panel{
  margin:0; border:1px solid var(--paper-line, #DADCD1); background:#fff;
  min-width:0; overflow:hidden;
}
.figure-panel img, .figure-panel svg{
  width:100%;
  height:auto;
  display:block;
  max-width:100%;
  object-fit:contain;
  background:transparent;
}
.figure-panel figcaption{
  font-family:'IBM Plex Mono', monospace; font-size:0.7rem; letter-spacing:0.04em;
  color:#5A6570; padding:10px 14px; border-top:1px solid var(--paper-line, #DADCD1);
}
.block-navy .figure-panel, .full-navy .figure-panel{
  border-color:rgba(95,200,206,0.28); background:#0A1A29;
}
.block-navy .figure-panel figcaption, .full-navy .figure-panel figcaption{
  color:rgba(255,255,255,0.55); border-top-color:rgba(95,200,206,0.2);
}
/* Hero / product figures: explicit ratios so dark panels never collapse empty */
.hero .figure-panel{
  align-self:center;
  width:100%;
  background:#0A1A29;
  border-color:rgba(95,200,206,0.28);
}
.hero .figure-panel img{
  width:100%;
  height:auto;
  aspect-ratio:520 / 280;
  min-height:168px;
  object-fit:contain;
}
.hero .figure-panel img[src*="forging-grain-flow"]{
  aspect-ratio:520 / 300;
}
.bg-hero-visual .figure-panel{
  background:#0A1A29;
  border-color:rgba(95,200,206,0.28);
}
.bg-hero-visual .figure-panel.compact{
  flex:0 1 auto; /* do not stretch empty navy below the ribbon */
  width:100%;
}
.bg-hero-visual .figure-panel.compact img{
  width:100%;
  height:auto;
  aspect-ratio:720 / 360;
  min-height:200px;
  object-fit:contain;
}

/* Full-bleed navy bands outside journey-sticky-scope (type / spoke pages) */
section.block.full-navy,
section.block.block-navy,
section.full-navy{
  max-width:none !important;
  width:100% !important;
  margin-left:0 !important;
  margin-right:0 !important;
  box-sizing:border-box;
  padding-left:var(--npro-content-inline) !important;
  padding-right:var(--npro-content-inline) !important;
}

/* Typographic link rails — replaces related-card / index-card grids */
.link-rail{
  display:grid; grid-template-columns:repeat(2,1fr); gap:0;
  border-top:1px solid var(--paper-line, #DADCD1);
}
.link-rail a{
  display:flex; justify-content:space-between; align-items:baseline; gap:16px;
  padding:16px 4px; border-bottom:1px solid var(--paper-line, #DADCD1);
  text-decoration:none; color:var(--ink, #12181D);
}
.link-rail a:nth-child(odd){padding-right:20px; border-right:1px solid var(--paper-line, #DADCD1);}
.link-rail a:nth-child(even){padding-left:20px;}
.link-rail .lr-cat{
  font-family:'IBM Plex Mono', monospace; font-size:0.65rem; letter-spacing:0.08em;
  color:var(--rust, #BD5326); text-transform:uppercase; flex-shrink:0;
}
.link-rail .lr-title{font-size:0.95rem; font-weight:600;}
.link-rail a:hover .lr-title{color:var(--cyan-dim, #3D8B90);}
.block-navy .link-rail, .full-navy .link-rail{border-top-color:rgba(255,255,255,0.15);}
.block-navy .link-rail a, .full-navy .link-rail a{
  color:#fff; border-bottom-color:rgba(255,255,255,0.12);
}
.block-navy .link-rail a:nth-child(odd), .full-navy .link-rail a:nth-child(odd){
  border-right-color:rgba(255,255,255,0.12);
}
.block-navy .link-rail a:hover .lr-title, .full-navy .link-rail a:hover .lr-title{color:var(--cyan, #5FC8CE);}

.rail-group-label{
  font-family:'IBM Plex Mono', monospace; font-size:0.7rem; letter-spacing:0.08em;
  text-transform:uppercase; color:var(--rust, #BD5326); margin:28px 0 0;
}

/* Full-bleed enquiry band — replaces boxed mid-cta cards */
.enquiry-band{
  display:flex; flex-wrap:wrap; gap:16px; align-items:center; justify-content:space-between;
  margin:40px 0 0; padding:28px 0 0; border-top:1px solid var(--paper-line, #DADCD1);
}
.enquiry-band p{margin:0; max-width:48ch; font-size:0.95rem; color:#33393F;}
.enquiry-band .actions{display:flex; gap:10px; flex-wrap:wrap;}
.block-navy .enquiry-band, .full-navy .enquiry-band{border-top-color:rgba(255,255,255,0.15);}
.block-navy .enquiry-band p, .full-navy .enquiry-band p{color:rgba(255,255,255,0.75);}

/* Split trade-off as editorial columns, not pro/con cards */
.split-editorial{
  display:grid; grid-template-columns:1fr 1fr; gap:40px;
  border-top:1px solid var(--paper-line, #DADCD1); padding-top:24px;
}
.split-editorial h4{
  font-family:'IBM Plex Mono', monospace; font-size:0.72rem; letter-spacing:0.08em;
  text-transform:uppercase; margin-bottom:12px;
}
.split-editorial h4.pro{color:var(--cyan-dim, #3D8B90);}
.split-editorial h4.con{color:var(--rust, #BD5326);}
.split-editorial ul{list-style:none; font-size:0.92rem; color:#33393F;}
.split-editorial li{padding:8px 0; border-top:1px solid var(--paper-line, #DADCD1);}
.split-editorial li:first-child{border-top:none; padding-top:0;}

/* Motion */
@media (prefers-reduced-motion: no-preference){
  .chapter .sec-head, .chapter .prose, .chapter .figure-panel, .chapter .tbl-wrap{
    animation:journeyFade .55s ease both;
  }
  @keyframes journeyFade{
    from{opacity:0; transform:translateY(10px);}
    to{opacity:1; transform:none;}
  }
  .hero-fig svg{animation:heroSettle .8s ease both;}
  @keyframes heroSettle{
    from{opacity:0; transform:scale(0.97);}
    to{opacity:1; transform:none;}
  }
}

/* ===== Wide comparison tables — local H-scroll, not stacked cards ===== */
.tbl-wrap,
.table-wrap.journey-table{
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--paper-line, #DADCD1);
  border-radius: 0;
  background: #fff;
  /* Edge cue: content continues horizontally */
  background-image:
    linear-gradient(to right, #fff 30%, rgba(255,255,255,0)),
    linear-gradient(to left, #fff 30%, rgba(255,255,255,0)),
    linear-gradient(to right, rgba(15,36,56,0.14), transparent 18px),
    linear-gradient(to left, rgba(15,36,56,0.14), transparent 18px);
  background-position: left center, right center, left center, right center;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 18px 100%, 18px 100%;
  background-attachment: local, local, scroll, scroll;
}
.tbl-wrap > table,
.table-wrap.journey-table > table{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  margin: 0;
}
.tbl-wrap thead th,
.table-wrap.journey-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
}
.tbl-wrap th:first-child,
.tbl-wrap td:first-child,
.tbl-wrap td.name,
.table-wrap.journey-table th:first-child,
.table-wrap.journey-table td:first-child{
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
  box-shadow: 4px 0 10px -6px rgba(15,36,56,0.35);
}
.tbl-wrap thead th:first-child,
.table-wrap.journey-table thead th:first-child{
  z-index: 3;
  background: var(--navy, #0F2438);
  box-shadow: 4px 0 10px -6px rgba(0,0,0,0.45);
}
.tbl-wrap tbody tr:nth-child(even) td:first-child,
.tbl-wrap tbody tr:nth-child(even) td.name{
  background: #EDEEE7;
}
.tbl-scroll-hint{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5A6570;
  margin: 0 0 10px;
}

/* Anatomy recomposition helpers (page may define .anatomy grid) */
.anatomy .figure-panel{ min-width: 0; }
@media(max-width:900px){
  :root{ --npro-content-gutter: 20px; }
  .meta-strip{grid-template-columns:repeat(2,1fr);}
  .meta-strip > div:nth-child(3){border-left:1px solid var(--paper-line, #DADCD1);}
  .link-rail{grid-template-columns:1fr;}
  .link-rail a:nth-child(odd), .link-rail a:nth-child(even){
    padding-left:4px; padding-right:4px; border-right:none;
  }
  .split-editorial{grid-template-columns:1fr; gap:24px;}
  /* Mobile: chip row may scroll; page itself must not overflow-x */
  .journey-rail-inner{
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    gap: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    /* keep start inset on content grid; allow chips to scroll past */
  }
  .journey-rail a, .journey-rail .jr-label{
    flex-shrink: 0;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.12);
  }
  /* Figure-first stack: drawing then five variables on one mobile scroll path */
  .anatomy{
    display: flex !important;
    flex-direction: column;
    gap: 18px !important;
  }
  .anatomy > .anatomy-fig,
  .anatomy > .figure-panel{ order: 0 !important; }
  .anatomy > .anatomy-list{ order: 1 !important; }
  .anatomy-list li{ padding: 10px 0 !important; }
  .anatomy-list h4{ font-size: 0.92rem !important; }
  .anatomy-list p{ font-size: 0.82rem !important; line-height: 1.4; }
  .anatomy-tag{ width: 52px !important; font-size: 0.68rem !important; }
  .tbl-wrap > table,
  .table-wrap.journey-table > table{ min-width: 640px; }
}
@media(max-width:520px){
  .meta-strip{grid-template-columns:1fr; padding:16px var(--npro-content-inline) 22px;}
  .meta-strip > div{border-left:1px solid var(--paper-line, #DADCD1);}
  .tbl-wrap > table,
  .table-wrap.journey-table > table{ min-width: 560px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce){
  .journey-rail{transition: none;}
  .journey-rail a{transition: none;}
}
