/* Home page hero: a night-horizon scene (St. John's on the left, the Bay du Nord vessel on the right, a red line between them),
   the headline, and the working search bar. Then the summary line and the map section.
   Loaded on the home page only (lib/postbuild.mjs adds the link). Colours and type come from the tokens in site.css.
   The artwork is two inline SVG layers on a 1600 x 860 grid (lib/hero/scene.svg, lib/hero/route.svg). */

/* z-index 5: the results panel can hang below the hero over the next section. The sticky header (10) stays above. */
.home-hero { position: relative; z-index: 5; isolation: isolate; background: var(--raven); }

/* ---- Layout ----
   Phones and small tablets (under 60rem): the headline and the search bar first, the scene as a strip tucked up under them.
   From 60rem: one stage the shape of the artwork, with the headline and the search bar laid over the sky. Everything in the
   stage is sized from the stage's own width (cqw), so the copy and the drawing scale together and the headline never
   runs into the red line. The vw lines before each cqw line are for browsers that don't know cqw yet. */
/* width: 100% matters: with a fixed shape, a max-height would otherwise narrow the stage to keep the shape instead of just trimming it */
.hh-stage { position: relative; width: 100%; max-width: 120rem; margin: 0 auto; container-type: inline-size; }
.hh-copy { position: relative; z-index: 2; padding-top: clamp(2.25rem, 9vw, 3.5rem); }
.home-hero h1 { margin: 0; max-width: none; font-size: clamp(2.3rem, 1.15rem + 5.2vw, 3.55rem); line-height: 1.03; letter-spacing: -.035em; font-weight: 600; text-wrap: balance; }

.hh-art { position: relative; z-index: 0; height: clamp(14.5rem, 58vw, 34rem); margin-top: -3.25rem; overflow: hidden; pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 24%, #000 80%, transparent 100%); }
.hh-art > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; }
/* A little film grain over the whole scene so the dark gradients don't band */
.hh-art::after { content: ""; position: absolute; inset: 0; opacity: .1; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"); }

@media (min-width: 60rem) {
  /* Height: the artwork's shape, but never under 34rem, and not taller than the screen (less the header) unless that would
     cut off more than a tenth of the sea. The drawing is anchored at the top, so a shorter stage only trims the water. */
  .hh-stage { aspect-ratio: 1600 / 860; min-height: 34rem; max-height: max(calc(100vh - 4.5rem), min(47.3vw, 56.7rem)); max-height: max(calc(100svh - 4.5rem), min(47.3vw, 56.7rem)); }
  .hh-copy { position: absolute; top: 0; left: 0; right: 0; padding-top: clamp(2.5rem, 6vw, 7.2rem); padding-top: clamp(2.5rem, 6cqw, 7.2rem); }
  .hh-l { display: block; }
  .home-hero h1 { font-size: clamp(2.4rem, 4.7vw, 5.6rem); font-size: clamp(2.4rem, 4.7cqw, 5.6rem); }
  .hh-art { position: absolute; inset: 0; height: auto; margin: 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 80%, transparent 100%); }
}
/* Wider than the stage's cap, its sides fade into the page */
@media (min-width: 120rem) {
  .hh-art {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, #000 0, #000 80%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, #000 0, #000 80%, transparent 100%);
    mask-composite: intersect;
  }
}

/* ---- The red line and the labels ----
   The line, the dots and the labels are drawn on the 1600 x 860 grid, so on a small screen (where the grid is scaled down
   to about a quarter) they would be hairline thin and tiny. --k thickens the strokes and --lk and --sk set the label sizes
   (and --dy keeps the two lines of the right-hand label apart) for each screen size. */
.hh-over { --k: 3.4; --lk: 2.6; --sk: 2.4; --dy: 14; }
@media (min-width: 30rem) { .hh-over { --k: 2.8; --lk: 2.2; --sk: 2; --dy: 12; } }
@media (min-width: 40rem) { .hh-over { --k: 2.3; --lk: 1.9; --sk: 1.7; --dy: 10; } }
@media (min-width: 48rem) { .hh-over { --k: 1.9; --lk: 1.6; --sk: 1.5; --dy: 8; } }
@media (min-width: 60rem) { .hh-over { --k: 1.35; --lk: 1.3; --sk: 1.3; --dy: 6; } }
@media (min-width: 80rem) { .hh-over { --k: 1; --lk: 1.05; --sk: 1.05; --dy: 1; } }
.hh-rl { stroke-width: calc(1.8px * var(--k)); }
.hh-rg { stroke-width: calc(9px * (1 + (var(--k) - 1) * .45)); }
.hh-leader { stroke-width: calc(1px * var(--k)); stroke-dasharray: calc(1.5px * var(--k)) calc(3.5px * var(--k)); }
.hh-ring, .hh-halo, .hh-pulse { stroke-width: calc(1px * var(--k)); }
.hh-dot { transform-box: fill-box; transform-origin: center; scale: calc(1 + (var(--k) - 1) * .5); }
.hh-pulse, .hh-lbl { transform-box: fill-box; transform-origin: center; }
.hh-la, .hh-lb { font-size: calc(17px * var(--lk)); }
.hh-la { translate: calc((var(--k) - 1) * -6px) 0; }
.hh-sub { font-size: calc(13px * var(--sk)); translate: 0 calc(var(--dy) * 1px); }
@media (max-width: 39.99rem) { .hh-sub { display: none; } }

/* One orchestrated moment on arrival, then stillness: the line draws from St. John's to the vessel with a bright dot at its
   tip, the flare answers with a ring, and the place names appear as the line reaches them. Everything runs once and holds.
   With reduced motion there is none of it: the finished picture is just there. */
@media (prefers-reduced-motion: no-preference) {
  .hh-over { --d: .7s; --t: 2.8s; --ease: cubic-bezier(.55, .05, .25, 1); }
  .hh-leader, .hh-ring { animation: hh-fade .9s ease-out .2s both; }
  .hh-dot { animation: hh-pop .7s cubic-bezier(.2, .8, .2, 1) .25s both; }
  .hh-la { animation: hh-rise .9s ease-out .9s both; }
  .hh-rg, .hh-rl { animation: hh-draw var(--t) var(--ease) var(--d) both; }
  .hh-cm { animation: hh-ride var(--t) var(--ease) var(--d) both; }
  .hh-trav { animation: hh-tip var(--t) linear var(--d) both; }
  .hh-halo { animation: hh-fade .9s ease-out calc(var(--d) + var(--t) - .35s) both; }
  .hh-pulse { animation: hh-ring 1.5s ease-out calc(var(--d) + var(--t) - .25s) both; }
  .hh-lb { animation: hh-rise .9s ease-out calc(var(--d) + var(--t) - .4s) both; }
  .hh-sub { animation: hh-rise .9s ease-out calc(var(--d) + var(--t) - .15s) both; }
}
/* The line is a dash as long as the whole path, pulled across. The gap after it is longer than the path, so no stray dot is drawn at the far end. */
@keyframes hh-draw { from { stroke-dasharray: 1 2; stroke-dashoffset: 1; } to { stroke-dasharray: 1 2; stroke-dashoffset: 0; } }
/* The bright dot is a dash of almost no length riding the same path with the same timing, so it stays at the tip of the line */
@keyframes hh-ride { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1; } }
@keyframes hh-tip { 0% { opacity: 0; } 5% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hh-pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes hh-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hh-ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(2.8); } }

/* ---- The search bar ---- */
.hsearch { position: relative; z-index: 3; width: min(100%, 34rem); height: 3.25rem; margin-top: clamp(1.1rem, 4vw, 1.6rem); scroll-margin-top: 7.5rem; }
@media (min-width: 60rem) {
  .hsearch { width: clamp(20rem, 38vw, 40rem); width: clamp(20rem, 38cqw, 40rem); height: max(2.9rem, 3.5vw); height: max(2.9rem, 3.5cqw); margin-top: clamp(1rem, 1.7vw, 2.2rem); margin-top: clamp(1rem, 1.7cqw, 2.2rem); }
}

.hsearch__box { display: flex; align-items: stretch; gap: .3rem; height: 100%; padding: .3rem; background: rgba(20, 20, 22, .74); border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05); transition: border-color .15s, box-shadow .15s; }
.hsearch__box:focus-within { border-color: var(--powder); box-shadow: 0 0 0 3px rgba(196, 224, 240, .28), 0 10px 30px rgba(0, 0, 0, .45); }
/* The doubled class beats the site-wide input styles in site.css; the box around the field carries the focus ring */
.hsearch__box .hsearch__in { flex: 1 1 auto; width: auto; min-width: 0; height: 100%; min-height: 0; padding: 0 .75rem 0 .85rem; font: 400 clamp(1rem, .6rem + .85vw, 1.35rem)/1.2 var(--font); color: #fff; background: transparent; border: 0; border-radius: 0; text-overflow: ellipsis; -webkit-appearance: none; appearance: none; }
.hsearch__box .hsearch__in:focus, .hsearch__box .hsearch__in:focus-visible { outline: none; border: 0; }
.hsearch__box .hsearch__in::placeholder { color: var(--muted); opacity: 1; }
.hsearch__box .hsearch__in::-webkit-search-decoration, .hsearch__box .hsearch__in::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.hsearch__go { flex: none; display: grid; place-items: center; height: 100%; aspect-ratio: 1; padding: 0; color: #fff; background: #DE2F28; border: 0; border-radius: 10px; cursor: pointer; transition: background .15s; }
.hsearch__go:hover { background: var(--poppy-hover); }
.hsearch__go:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.hsearch__go svg { display: block; width: clamp(1.2rem, .55rem + .95vw, 1.6rem); height: clamp(1.2rem, .55rem + .95vw, 1.6rem); }

/* White text on the poppy red buttons measured 4.34:1, just under the 4.5:1 AA line. A slightly deeper fill on this page clears it (4.62:1) and is hard to tell apart by eye. */
.btn--red { background: #DE2F28; }
.btn--red:hover { background: var(--poppy-hover); }

.hsearch__panel { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + .5rem); padding: .35rem; background: var(--raven-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 22px 54px rgba(0, 0, 0, .65); }
/* The listbox itself is what scrolls (arrow keys move through it while focus stays in the field), not the box around it */
.hsearch__panel [data-hs-list] { max-height: 23rem; max-height: min(25rem, calc(58svh - .7rem)); overflow-y: auto; overscroll-behavior: contain; }
.hh-grp { margin: 0; padding: .55rem .7rem .25rem; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.hh-opt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .75rem; row-gap: .05rem; align-items: center; padding: .5rem .7rem; color: var(--text); text-decoration: none; border-radius: 8px; }
.hh-opt:hover, .hh-opt[aria-selected="true"] { background: var(--raven-3); }
.hh-opt[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: .55rem; bottom: .55rem; width: 2px; border-radius: 2px; background: var(--poppy); }
.hh-opt__t { grid-column: 1; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.hh-opt__s { grid-column: 1; font-size: .86rem; line-height: 1.3; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hh-opt__k { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: .1rem .55rem; font-size: .75rem; color: var(--powder); border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; }
.hh-opt mark { color: var(--powder); background: none; font-weight: 700; }
.hh-opt--all { margin-top: .25rem; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: .7rem; padding-bottom: .7rem; }
.hh-opt--all .hh-opt__t { font-weight: 500; color: var(--soft); }
.hh-empty { margin: 0; padding: .7rem .7rem .4rem; color: var(--soft); font-size: .95rem; }

@media (max-width: 48rem) { .hsearch__panel [data-hs-list] { max-height: 18rem; max-height: min(20rem, calc(42svh - .7rem)); } }

@media print { .hh-art { display: none; } }

/* ---- The one-line summary, beside the "Latest jobs" heading ----
   The site's section head puts the heading on the left and a note on the right from 56rem up, and stacks them below that.
   The summary and the "checked daily" note share the right-hand column, and the heading sits on the first line of the summary. */
.sec__head--lead { row-gap: .6rem; }
.sec__head--lead .sh-side { display: grid; gap: .55rem; min-width: 0; }
.sec__head--lead .sh-side p { max-width: 36rem; text-wrap: pretty; }
.sec__head--lead .sh-side .lead { color: var(--soft); }
.sec__head--lead .sh-side p:not(.lead) { font-size: .92rem; }
@media (min-width: 56rem) { .sec__head--lead { align-items: baseline; } }

/* ---- Map section (sits just above the news) ---- */
/* The news section under it draws its own top line, so only the top is ruled here */
.mapsec { padding: clamp(2.75rem, 6vw, 4.75rem) 0; border-top: 1px solid var(--line); }
.mapsec__in { display: grid; gap: 1.75rem 3rem; align-items: center; }
.mapsec__copy { min-width: 0; }
.mapsec h2 { margin: 0 0 .7rem; font-size: clamp(1.7rem, 1.1rem + 1.7vw, 2.4rem); line-height: 1.08; letter-spacing: -.03em; }
.mapsec p { margin: 0; max-width: 34ch; color: var(--soft); text-wrap: pretty; }
@media (min-width: 66rem) { .mapsec__in { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); } }
