/* The nav: the Boarding pass (js/nav.js), picked Nov 21. Hairline and Departures live in versions/r21-options-night.
   The pass is two pieces of card: a cream pass (the bar: logo, links, a seat code) with water moving in it, and a
   light water-blue stub ("Plan my trip"),
   joined at a perforated tear line with a notch at each end. It sits low, with air above it (Sam: the old nav was too high).
   The finish (Sam, Nov 21: "a flat, generic strip of paper, add more detail"): paper grain, a faint guilloche, a little
   edge thickness, a crisp contact shadow under a soft one, punched perforation holes, letterpress type on the stub. */

html[data-navo="pass"] .nav {
  --stub: 176px; --h: 60px; --notch: 9px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .06 0 0 0 0 .23 0 0 0 0 .25 0 0 0 -.42 .25'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --guilloche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='60' viewBox='0 0 96 60'%3E%3Cg fill='none' stroke='%2319B5B8' stroke-opacity='.16' stroke-width='.6'%3E%3Cpath d='M0 30 C12 14 24 14 36 30 S60 46 72 30 S96 14 96 30'/%3E%3Cpath d='M0 30 C12 46 24 46 36 30 S60 14 72 30 S96 46 96 30'/%3E%3Cpath d='M0 22 C16 8 32 8 48 22 S80 36 96 22'/%3E%3Cpath d='M0 38 C16 52 32 52 48 38 S80 24 96 38'/%3E%3Cpath d='M0 26 C12 18 24 18 36 26 S60 34 72 26 S96 18 96 26'/%3E%3Cpath d='M0 34 C12 42 24 42 36 34 S60 26 72 34 S96 42 96 34'/%3E%3C/g%3E%3C/svg%3E");
  inset: 28px var(--gutter) auto; height: var(--h); padding: 0 var(--stub) 0 24px; color: var(--ink);
}

/* the pass: cream card, its own grain and a faint guilloche band, notches cut where it meets the stub */
html[data-navo="pass"] .nav::before, html[data-navo="pass"] .nav.is-on-paper::before {
  inset: 0 var(--stub) 0 0; opacity: 1; border-radius: 16px 0 0 16px;
  background:
    var(--grain) 0 0 / 180px 180px,
    var(--guilloche) 0 50% / 96px 60px repeat-x,
    linear-gradient(180deg, #FFFEFA 0%, #FFFBF2 60%, #FBF4E6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -2px 0 rgba(15, 59, 64, .07), inset 0 0 0 1px rgba(15, 59, 64, .05);
  -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000);
  mask-composite: intersect;
}
html[data-navo="pass"] .nav::before { background-blend-mode: multiply, normal, normal; }
/* the water (js/nav.js): a WebGL canvas over the paper, multiplied so the grain and the guilloche still show through,
   cut to the same shape (rounded left end, the notches at the tear line) */
.nvp-water { display: none; }
html[data-navo="pass"] .nvp-water {
  display: block; position: absolute; left: 0; top: 0; width: calc(100% - var(--stub)); height: 100%; z-index: -1; pointer-events: none;
  border-radius: 16px 0 0 16px; mix-blend-mode: multiply;
  -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle var(--notch) at 100% 0, #0000 97%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 97%, #000);
  mask-composite: intersect;
}
/* the paper's shadow on its own layer (a drop-shadow filter on the fixed nav cost frames while the film scrolls under it):
   a crisp contact edge under a soft lift */
html[data-navo="pass"] .nav::after {
  content: ""; position: absolute; inset: 0; z-index: -2; border-radius: 16px; pointer-events: none;
  box-shadow: 0 1px 1.5px rgba(8, 40, 50, .14), 0 3px 6px rgba(8, 45, 70, .07), 0 16px 30px rgba(8, 45, 70, .14);
}

html[data-navo="pass"] .brand { transform: none; }
html[data-navo="pass"] .brand svg { height: 34px; }

/* the links: printed type, the current chapter gets a highlighter swipe (the page's .nav__pill, moved by js/main.js) */
html[data-navo="pass"] .nav__links, html[data-navo="pass"] .nav.is-on-paper .nav__links {
  background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 4px;
  font: 600 14px/1 var(--body); letter-spacing: -.005em; color: var(--ink);
}
@media (min-width: 1100px) { html[data-navo="pass"] .nav__links { transform: translate(calc(-50% - var(--stub) / 2), 0); } }
html[data-navo="pass"] .nav__links a { padding: 10px 15px; opacity: .7; transition: opacity .3s ease; }
html[data-navo="pass"] .nav__links a:hover, html[data-navo="pass"] .nav__links a.is-on,
html[data-navo="pass"] .nav.is-on-paper .nav__links a.is-on { opacity: 1; color: var(--ink); }
html[data-navo="pass"] .nav__pill, html[data-navo="pass"] .nav.is-on-paper .nav__pill {
  top: auto; bottom: 10px; height: 10px; background: none; box-shadow: none; border-radius: 0;
}
html[data-navo="pass"] .nav__pill::before {
  content: ""; position: absolute; inset: 0 8px; border-radius: 3px 7px 4px 8px / 5px 3px 6px 4px;
  background: linear-gradient(90deg, rgba(255, 181, 71, .55), rgba(255, 196, 92, .7) 45%, rgba(255, 181, 71, .5));
  transform: skewX(-12deg) rotate(-.6deg); mix-blend-mode: multiply;
}

/* the printed seat code and barcode, just before the tear line */
.nvp-code { display: none; }
@media (min-width: 1100px) {
  html[data-navo="pass"] .nvp-code {
    position: absolute; right: calc(var(--stub) + 22px); top: 50%; transform: translateY(-50%);
    display: grid; justify-items: end; gap: 4px; pointer-events: none;
    font: 500 8.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: rgba(15, 59, 64, .55);
  }
  html[data-navo="pass"] .nvp-code svg { width: 64px; height: 12px; fill: rgba(15, 59, 64, .62); }
}

/* the stub: thicker card, letterpress type, the sun mark as a watermark, its half of each notch and the punched
   perforation down its left edge.
   The tear line is cut with gradient masks only (Sam, Nov 21: in Safari the joint read as "two elements stitched
   together"). It used to be an SVG mask kept in a custom property, which Safari ignored: no holes, no half notches, just a
   straight-edged block butted against the pass. Gradient masks are what already cut the pass's notches in Safari, so the
   stub now uses the same: its half of each notch (two circles at its left corners), a column of punched holes
   (one small circle tiled down a 10 px strip) and the solid card beside the strip, composited into one shape. */
html[data-navo="pass"] .nav__cta, html[data-navo="pass"] .nav.is-on-paper .nav__cta {
  --hole: 2.2px; --pitch: 6px; --hx: 3.8px;
  position: absolute; right: 0; top: 0; bottom: 0; margin: 0; width: var(--stub); height: auto; transform: none;
  display: flex !important; align-items: center; justify-content: flex-start; overflow: hidden;
  padding: 0 0 0 26px !important; border-radius: 0 16px 16px 0; color: var(--ink);
  /* light water blue (Sam, Nov 21: "instead of green, more blue, light blue, like water"), with a slow sheen of light */
  background:
    var(--grain) 0 0 / 180px 180px,
    linear-gradient(105deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .38) 48%, rgba(255, 255, 255, 0) 61%) 0 0 / 300% 100%,
    radial-gradient(130% 160% at 18% 0%, rgba(190, 243, 247, .9) 0%, rgba(190, 243, 247, 0) 62%),
    linear-gradient(180deg, #7FD8E6 0%, #55C2D6 55%, #3AAFC8 100%);
  background-blend-mode: soft-light, normal, normal, normal;
  animation: nvp-sheen 9s ease-in-out infinite alternate;
  /* the same top and bottom edge as the pass, so the two read as one card (no step at the tear line) */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -2px 0 rgba(10, 80, 100, .12), inset -1px 0 0 rgba(255, 255, 255, .25);
  /* layers, top first: notch top, notch bottom (each intersected), the holes strip, the card beside it (added) */
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 0, #0000 97%, #000),
    radial-gradient(circle var(--notch) at 0 100%, #0000 97%, #000),
    radial-gradient(circle var(--hole) at var(--hx) 50%, #0000 62%, #000 100%) 0 50% / 10px var(--pitch) repeat-y,
    linear-gradient(#000, #000) 10px 0 / calc(100% - 10px) 100% no-repeat;
  -webkit-mask-composite: source-in, source-in, source-over, source-over;
  mask:
    radial-gradient(circle var(--notch) at 0 0, #0000 97%, #000),
    radial-gradient(circle var(--notch) at 0 100%, #0000 97%, #000),
    radial-gradient(circle var(--hole) at var(--hx) 50%, #0000 62%, #000 100%) 0 50% / 10px var(--pitch) repeat-y,
    linear-gradient(#000, #000) 10px 0 / calc(100% - 10px) 100% no-repeat;
  mask-composite: intersect, intersect, add, add;
}
html[data-navo="pass"] .nav__cta::before { display: none; }
@keyframes nvp-sheen { from { background-position: 0 0, 100% 0, 0 0, 0 0; } to { background-position: 0 0, 0% 0, 0 0, 0 0; } }
/* at the end (css/book.css marks the nav .is-at-book and points the arrow down): on the light water stub the label stays
   ink, a sun-yellow label doesn't read on aqua */
html[data-navo="pass"] .nav.is-at-book .nav__cta .nvo-cta small { color: rgba(15, 59, 64, .78); }
html[data-navo="pass"] .nav__cta .pb { display: none; }
.nvo-cta, .nvp-mark { display: none; }
html[data-navo="pass"] .nvo-cta { position: relative; z-index: 1; display: grid; justify-items: start; gap: 5px; }
html[data-navo="pass"] .nvo-cta small {
  font: 500 9px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: rgba(15, 59, 64, .66);
}
html[data-navo="pass"] .nvo-cta b {
  display: inline-flex; align-items: center; gap: 8px; font: 800 16px/1 var(--display); letter-spacing: -.015em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45), 0 -1px 0 rgba(10, 70, 90, .2);   /* pressed into the card */
}
html[data-navo="pass"] .nvo-cta i { font-style: normal; color: var(--ink); transition: transform .3s ease; }
html[data-navo="pass"] .nav__cta:hover .nvo-cta i { transform: translateX(4px); }
html[data-navo="pass"] .nvp-mark {
  display: block; position: absolute; right: -14px; bottom: -14px; width: 74px; height: auto; transform: rotate(-12deg);
  fill: rgba(255, 255, 255, .22); stroke: rgba(255, 255, 255, .22); pointer-events: none;
}
html[data-navo="pass"] .nav__cta:hover { background-blend-mode: soft-light, normal; filter: brightness(1.08); }
html[data-navo="pass"] .nav__cta:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; }

/* phone: a shorter pass, a narrower stub, no seat code */
@media (max-width: 760px) {
  html[data-navo="pass"] .nav { --stub: 138px; --h: 54px; --notch: 8px; inset: 16px 14px auto; padding-left: 16px; }
  html[data-navo="pass"] .brand svg { height: 28px; }
  html[data-navo="pass"] .nav__cta, html[data-navo="pass"] .nav.is-on-paper .nav__cta {
    --hole: 2px; --pitch: 6.5px; --hx: 3.6px;
    padding-left: 20px !important;
  }
  html[data-navo="pass"] .nvo-cta b { font-size: 14px; }
  html[data-navo="pass"] .nvo-cta small { font-size: 7.5px; letter-spacing: .14em; }
  html[data-navo="pass"] .nvp-mark { width: 58px; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-navo="pass"] .nav__links a, html[data-navo="pass"] .nvo-cta i { transition: none; }
  html[data-navo="pass"] .nav__cta { animation: none; }
}
