/* Size guide. The page is the size ladder: one sea block with a pinned stage where every plan is drawn
   at one scale, the band copy scrolling beside it (under it on phones), then one calm section and the
   next step. Loaded after site.css and pages.css. */

:root { --ease-io: cubic-bezier(.65, 0, .35, 1); }

/* the header takes the sea colours while the ladder is under it (class set in sizes.js) */
.site-header.sea .logo img { filter: invert(1) hue-rotate(180deg) brightness(1.2); }
/* ---------- the ladder: sea block, stage left, copy right ---------- */

.ladder { overflow-x: clip; padding-bottom: clamp(56px, 8vw, 112px); }
.ladder-grid {
  --pad: clamp(24px, 4vw, 64px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); column-gap: clamp(32px, 4.5vw, 80px);
  max-width: 1640px; margin: 0 auto; padding: 0 var(--pad);
}

.ladder-intro { grid-column: 2; grid-row: 1; min-height: calc(100dvh - var(--header-h)); display: grid; align-content: center; gap: 20px; padding: 48px 0 72px; }
.ladder-intro h1 { font-size: clamp(2.8rem, 1.7rem + 2.7vw, 4.5rem); line-height: .98; letter-spacing: -0.01em; }
.ladder-intro .lede { color: var(--ink-2); }
.ladder-method { font-size: 0.875rem; color: var(--muted); max-width: 54ch; }
.ladder-error { grid-column: 1 / -1; padding: 40px 0; color: var(--ink-2); }
.ladder-method-m { display: none; }

/* ---------- the pinned stage ---------- */

.ladder-stage {
  grid-column: 1; grid-row: 1 / span 8; align-self: start;
  position: sticky; top: var(--header-h); height: calc(100dvh - var(--header-h));
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: 32px 0 28px;
  background: var(--paper);
}

/* one rung per band; the bar is the drawn yacht's length against the 100 */
.rungs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; width: min(100%, 440px); flex: none; }
.rung {
  display: grid; gap: 7px; align-content: end; min-height: 44px; padding: 6px 0 8px;
  border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 0.875rem; text-align: left; cursor: pointer;
  transition: color .25s ease;
}
.rung-bar { display: block; height: 2px; background: currentColor; opacity: .55; transform-origin: 0 50%; transform: scaleX(var(--w, 1)); transition: background-color .25s ease, opacity .25s ease; }
.rung:hover { color: var(--ink); }
.rung[aria-current] { color: var(--ink); }
.rung[aria-current] .rung-bar { background: var(--sky); opacity: 1; }

.ladder-fig { margin: 0; min-height: 0; display: grid; align-content: center; gap: 18px; }
.ladder-canvas {
  position: relative; isolation: isolate; background: var(--paper);
  width: min(100%, calc((100dvh - var(--header-h) - 250px) * 2.012)); aspect-ratio: 33 / 16.4;
}
.lp-layer, .ladder-svg, .ladder-labels { position: absolute; inset: 0; }
.ladder-svg { width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ladder-labels { pointer-events: none; }
.ladder-cap { font-size: 0.875rem; line-height: 1.55; color: var(--ink-2); max-width: 74ch; min-height: 4.7em; }
.ladder-cap a, .band-plan a { color: var(--ink); text-underline-offset: 3px; }

/* plans: light lines on the sea, screened onto the canvas (the canvas is the isolated, sea-filled group).
   A larger band grows out of the stern: the frame slides right while the drawing inside slides left. */
.lp { position: absolute; overflow: hidden; mix-blend-mode: screen; opacity: 0; transform: translateX(-100%); transition: transform .7s var(--ease-io), opacity .2s linear .5s; }
.lp img { display: block; width: 100%; height: 100%; max-width: none; filter: grayscale(1) invert(1) brightness(1.5) contrast(1.15); transform: translateX(100%); transition: transform .7s var(--ease-io); }
.lp[data-state="cur"] { opacity: .8; transform: none; transition: transform 1.2s var(--ease-io), opacity .45s ease; }
.lp[data-state="cur"] img { transform: none; transition: transform 1.2s var(--ease-io); }
.lp[data-state="ghost"] { transform: none; transition: opacity .45s ease; }
.lp[data-state="ghost"] img { transform: none; transition: none; }

/* outlines of the other bands, traced from their plans */
.lo { opacity: 0; transition: opacity .45s ease; }
.lo path, .lo rect { fill: rgb(58 168 236 / .045); stroke: var(--sky); stroke-width: 1.25; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.lo[data-state="all"], .lo[data-state="ghost"] { opacity: 1; }
/* with a non-scaling stroke the dashes are in screen pixels */
.lo-box rect { fill: none; stroke-dasharray: 6 5; }
.lo-box[data-state="cur"] { opacity: 1; }
.lo-box[data-state="cur"] rect { stroke: #fff; stroke-width: 1.75; }

/* dimension lines of the current band: the length runs out from the stern, then the beam opens */
.ld { opacity: 0; transition: opacity .3s ease; }
.ld path { fill: none; stroke: #fff; stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.ld[data-state="cur"] { opacity: 1; transition-duration: .15s; }
.ld-len { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(0); transition: transform .4s var(--ease-io); }
.ld[data-state="cur"] .ld-len { transform: none; transition: transform 1.1s var(--ease-io) .2s; }
.ld-beam { transform-box: fill-box; transform-origin: 50% 50%; transform: scaleY(0); transition: transform .4s var(--ease-io); }
.ld[data-state="cur"] .ld-beam { transform: none; transition: transform .7s var(--ease-io) 1.05s; }

.ladder-scale { fill: none; stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* labels sit in HTML over the drawing so they keep their size at any scale */
.ladder-labels > span { position: absolute; white-space: nowrap; line-height: 1.3; }
.gl { transform: translate(4px, -50%); font-size: 0.75rem; font-weight: 700; color: var(--sky); background: var(--paper); padding: 0 5px; border-radius: 3px; opacity: 0; transition: opacity .45s ease; }
.gl[data-state="all"], .gl[data-state="ghost"] { opacity: 1; }
.dl { font-size: 0.8125rem; font-weight: 600; color: #fff; background: var(--paper); padding: 1px 7px; border-radius: 3px; opacity: 0; transition: opacity .25s ease; }
.dl-len { transform: translate(-50%, -50%); }
.dl-beam { transform: translate(-50%, 0); }
.dl-len[data-state="cur"] { opacity: 1; transition: opacity .4s ease 1s; }
.dl-beam[data-state="cur"] { opacity: 1; transition: opacity .4s ease 1.55s; }
.nb { transform: translate(-50%, -50%); font-size: 0.8125rem; color: var(--ink-2); opacity: 0; transition: opacity .3s ease; }
.nb[data-state="cur"] { opacity: 1; transition-delay: .4s; }
.sl { transform: translate(-50%, 0); font-size: 0.6875rem; color: var(--muted); }

/* reduced motion: site.css already sets every transition to 0s; the delays go too, so each step switches at once */
@media (prefers-reduced-motion: reduce) {
  .ladder *, .ladder *::before, .ladder *::after { transition-delay: 0s !important; }
}

/* ---------- the band copy ---------- */

.band { grid-column: 2; display: grid; gap: 18px; align-content: start; padding-top: 20vh; scroll-margin-top: calc(var(--header-h) - 14vh); }
.band:last-child { padding-bottom: 22vh; }
.band h2 { font-size: clamp(2rem, 1.5rem + 1.4vw, 2.75rem); line-height: 1.05; }
.band h2:focus { outline: none; }
.band h2:focus-visible { outline: 2px solid var(--sky); outline-offset: 4px; }
.band-sub { color: var(--ink-2); }
.band-sub a { color: var(--ink); text-underline-offset: 3px; }
.band-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; margin: 4px 0 0; }
.band-figs div { display: flex; flex-direction: column; gap: 3px; padding-top: 12px; border-top: 1px solid var(--line-strong); min-width: 0; }
.band-figs .wide { grid-column: 1 / -1; }
.band-figs dt { order: 2; font-size: 0.8125rem; color: var(--muted); }
.band-figs dd { margin: 0; font-family: var(--serif); font-size: clamp(1.35rem, 1.1rem + .6vw, 1.7rem); line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.band-cover { font-size: 0.8125rem; color: var(--muted); margin-top: -4px; }
.band-title { font-size: clamp(1.5rem, 1.2rem + .8vw, 1.95rem); line-height: 1.15; margin-top: 22px; }
.band-text { color: var(--ink-2); }
.band-points { margin-top: 4px; }
.band-plan { display: none; font-size: 0.8125rem; color: var(--muted); }
.band-cta { margin-top: 8px; }

/* ---------- phones and narrow windows: the stage pins at the top, the copy runs under it ---------- */

@media (max-width: 900px) {
  .ladder-grid { --pad: var(--gutter); grid-template-columns: minmax(0, 1fr); }
  .ladder-intro { grid-column: 1; grid-row: auto; min-height: 0; padding: 36px 0 24px; gap: 16px; }
  .ladder-intro .ladder-method { display: none; }
  .ladder-method-m { display: block; grid-column: 1; padding-top: 28px; }
  .ladder-stage {
    grid-column: 1; grid-row: auto; height: auto; z-index: 2;
    margin: 0 calc(var(--pad) * -1); padding: 6px var(--pad) 12px; gap: 6px;
    border-bottom: 1px solid var(--line);
  }
  .ladder-stage::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 40px; background: linear-gradient(var(--paper) 30%, transparent); pointer-events: none; }
  .ladder-cap { display: none; }
  .rungs { width: 100%; gap: 6px; }
  .ladder-canvas { width: 100%; }
  .band { grid-column: 1; padding-top: 56px; scroll-margin-top: calc(var(--header-h) + var(--stage-h, 260px) + 12px); }
  .band:last-child { padding-bottom: 40vh; }
  .band-plan { display: block; }
}
@media (max-width: 600px) {
  .ladder-labels .w { display: none; }
  .gl { font-size: 0.6875rem; padding: 0 3px; transform: translate(2px, -50%); }
  .dl { font-size: 0.75rem; padding: 0 5px; }
  .nb { font-size: 0.6875rem; }
  .sl { font-size: 0.625rem; }
  .band-figs { gap: 14px 16px; }
}

/* ---------- what nobody puts on the price sheet ---------- */

.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 24px clamp(32px, 5vw, 88px); align-items: start; }
.sheet-grid h2 { max-width: 14ch; }
.sheet-grid .read { max-width: 62ch; }
.sheet-qs { list-style: none; margin: clamp(36px, 5vw, 56px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px clamp(20px, 3vw, 40px); }
.sheet-qs li { font-family: var(--serif); font-size: clamp(1.25rem, 1.05rem + .6vw, 1.6rem); line-height: 1.25; padding-top: 18px; border-top: 2px solid var(--ink); }
.sheet-after { margin-top: 28px; font-size: 1.0625rem; color: var(--ink-2); max-width: 62ch; }
@media (max-width: 860px) {
  .sheet-grid, .sheet-qs { grid-template-columns: minmax(0, 1fr); }
}
