/* PUCK team bags: what every storefront page shares.
   Tokens, the site header and footer, and the two kinds of button.

   The palette is a rink: ice, puck black, and the two paint colours used for the lines
   (blue line, centre line). Type is one family, Archivo, used across its width axis. */

:root {
  --ice: #f1f4f5;          /* fresh sheet: the page */
  --ice-shade: #e3e8ea;    /* scraped ice: panels */
  --hall: #d5d9da;         /* rink-hall grey, the configurator's stage */
  --ink: #000;
  --ink-soft: #414a50;
  --rule: #b7bdc0;
  --blue: #0033a0;         /* blue line */
  --red: #c8102e;          /* centre line, face-off dots */

  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --head-h: 68px;
  --gutter: clamp(18px, 2.8vw, 44px);
  /* the one left edge everything on a page starts from (and the right one it ends at):
     the gutter, or further in once the window is wider than the 1680 px the layout is drawn for */
  --edge: max(var(--gutter), calc((100vw - 1680px) / 2));
  --r: 3px;
}

/* ------------------------------------------------------------------ header */

.site-head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--head-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 var(--edge);
  font: 500 15px/1 var(--font);
  color: var(--ink);
  transition: background-color 0.25s, box-shadow 0.25s;
}
.site-head.is-solid {
  background: color-mix(in srgb, var(--ice) 86%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--rule);
}
/* on the configurator pages the header is part of the page, not floating over it */
.site-head--static {
  position: relative;
  background: var(--ice);
  box-shadow: 0 1px 0 var(--rule);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 86px;
  margin-left: -1px;          /* the P's own side space, so the mark starts on the page edge */
  aspect-ratio: 640 / 168;
  background: currentColor;
  -webkit-mask: url(../assets/img/puck-logo.png) center / contain no-repeat;
  mask: url(../assets/img/puck-logo.png) center / contain no-repeat;
}
.brand-sub {
  padding-left: 12px;
  border-left: 1.5px solid currentColor;
  line-height: 1.5;
}

.site-nav {
  display: flex;
  gap: clamp(18px, 2.4vw, 34px);
}
.site-nav a {
  position: relative;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.head-end {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}
.req-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 8px 0 14px;
  color: inherit;
  text-decoration: none;
  border: 1.5px solid currentColor;
  border-radius: var(--r);
  transition: background-color 0.18s, color 0.18s;
}
.req-link:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
/* the count sits on a puck */
.req-count {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.req-link:hover .req-count { background: #fff; color: var(--ink); }
.req-count[data-empty="true"] { background: none; color: inherit; border: 1.5px solid currentColor; }

.nav-toggle {
  display: none;
  min-height: 40px;
  padding: 0 12px;
  font: inherit;
  color: inherit;
  background: none;
  border: 1.5px solid transparent;
  border-radius: var(--r);
  cursor: pointer;
}

.site-head :focus-visible,
.site-foot :focus-visible,
.cta:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

@media (max-width: 860px) {
  :root { --head-h: 60px; }
  .site-head { grid-template-columns: auto 1fr; }
  .brand-sub { display: none; }
  .nav-toggle { display: inline-block; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: 6px var(--edge) 16px;
    background: var(--ice);
    box-shadow: 0 1px 0 var(--rule), 0 18px 30px -18px rgba(0, 0, 0, 0.35);
  }
  .site-head.is-open { background: var(--ice); }
  .site-head.is-open .site-nav { display: flex; }
  .site-nav a { padding: 14px 0; font-size: 18px; border-top: 1px solid var(--rule); }
  .site-nav a::after { display: none; }
}

/* ------------------------------------------------------------------ buttons */

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  font: 600 16px/1.1 var(--font);
  color: #fff;
  background: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s;
}
.cta:hover { background: var(--blue); border-color: var(--blue); }
.cta--line { color: var(--ink); background: transparent; }
.cta--line:hover { color: #fff; background: var(--ink); border-color: var(--ink); }
.cta--light { color: var(--blue); background: #fff; border-color: #fff; }
.cta--light:hover { color: #fff; background: var(--ink); border-color: var(--ink); }
.cta--ghost { color: #fff; background: transparent; border-color: #fff; }
.cta--ghost:hover { color: var(--blue); background: #fff; border-color: #fff; }

/* ------------------------------------------------------------------ footer */

.site-foot {
  padding: clamp(40px, 6vw, 72px) var(--edge) 26px;
  font: 400 15px/1.5 var(--font);
  color: #fff;
  background: var(--ink);
}
.foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) repeat(2, minmax(0, 2fr));
  gap: 32px var(--gutter);
}
.foot-brand .brand-mark { width: 150px; margin-left: -2px; }
.foot-brand p { margin: 18px 0 0; max-width: 26em; color: #b9c0c4; }
.foot-col h2 {
  margin: 0 0 12px;
  font: 600 15px/1.3 var(--font);
  color: #b9c0c4;
}
.foot-col ul { margin: 0; padding: 0; list-style: none; }
.foot-col a {
  display: inline-block;
  padding: 5px 0;
  color: #fff;
  text-decoration: none;
}
.foot-col a:hover { text-decoration: underline; text-underline-offset: 4px; }
.foot-base {
  margin-top: clamp(36px, 5vw, 64px);
  padding-top: 18px;
  border-top: 1px solid #2c3236;
  color: #b9c0c4;
  font-size: 14px;
}
.foot-base p { margin: 0; }

@media (max-width: 700px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------ page cover */
/* What you see between two pages: a black sheet with the puck on it, led by a blue line.
   Leaving, it comes up from below and covers the page. The next page starts covered and the
   sheet carries on upwards, so the two halves read as one move.
     html.is-leaving    set on a click on an internal link (src/store/site.js)
     html.is-arriving   set by a one-line script in the head, so it holds from the first paint
     html.is-revealing  set once the page is ready to be seen */

.page-cover {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  visibility: hidden;
}
.page-cover i {
  position: absolute;
  inset: 0;
  transform: translateY(101%);
}
.page-cover i:first-child { background: var(--blue); }
.page-cover i:last-child { background: #000; }
.page-cover i:last-child::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 30px; height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: #fff;
}

.is-leaving .page-cover { visibility: visible; pointer-events: auto; }
.is-leaving .page-cover i {
  transform: none;
  transition: transform 0.5s cubic-bezier(0.76, 0, 0.24, 1);
}
.is-leaving .page-cover i:last-child { transition-delay: 0.07s; }

.is-arriving .page-cover {
  visibility: visible;
  /* if the page's script never runs, the cover still goes */
  animation: cover-failsafe 0.01s 6s forwards;
}
.is-arriving .page-cover i { transform: none; }
@keyframes cover-failsafe { to { visibility: hidden; } }

.is-revealing .page-cover { visibility: visible; }
.is-revealing .page-cover i {
  transform: translateY(-101%);
  transition: transform 0.62s cubic-bezier(0.76, 0, 0.24, 1);
}
.is-revealing .page-cover i:first-child { transition-delay: 0.07s; }

/* ------------------------------------------------------------------ webbing */
/* The rules that divide a page are lengths of the bags' own webbing: weave, edging, a row of
   stitches along each side, and a box tack where it is sewn down, woven in the two colours a
   rink's lines are painted in. The same strap, in the bag's colours, stands between stage and
   sheet in the configurators. src/store/webbing.js lays it off its roll. */
.webbing {
  position: relative;
  z-index: 1;
}
.webbing-band {
  position: relative;
  height: 34px;
  background-color: var(--accent);
  background-image:
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.1) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.14) 0 2px, transparent 2px 4px);
  border-block: 5px solid var(--trim);
  box-shadow: 0 8px 16px -10px rgb(0 0 0 / 0.4);
  transition: background-color 0.5s, border-color 0.5s;
}
.webbing-band::before,
.webbing-band::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  border-top: 2px dashed var(--stitch);
  opacity: 0.85;
  transition: border-color 0.5s;
}
.webbing-band::before { top: 2px; }
.webbing-band::after { bottom: 2px; }
.webbing-band .tack {
  position: absolute;
  top: 2px;
  width: 34px;
  height: calc(100% - 4px);
  fill: none;
  stroke: var(--stitch);
  stroke-width: 2;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
  transition: stroke 0.5s;
}
.webbing-band .tack:nth-of-type(1) { left: 14%; }
.webbing-band .tack:nth-of-type(2) { right: 14%; }
.webbing--blue { --accent: var(--blue); --trim: #001c62; --stitch: #f2f2ee; }
.webbing--red { --accent: var(--red); --trim: #7d0a1d; --stitch: #f2f2ee; }

/* ------------------------------------------------------------------ the roll of webbing */
/* A strap arrives by coming off a roll: on the configurator pages when they open, on the
   landing page when its last section comes into view. This is that roll, seen from the front:
   the webbing's own colours and weave, shaded as a cylinder, its edging showing as a ring at
   each end. --turn moves the weave so the roll reads as turning. */
.strap-roll {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background-color: var(--accent);
  background-image:
    linear-gradient(180deg, rgb(0 0 0 / 0.55) 0%, rgb(255 255 255 / 0.36) 24%, rgb(255 255 255 / 0.05) 46%, rgb(0 0 0 / 0.3) 76%, rgb(0 0 0 / 0.66) 100%),
    repeating-linear-gradient(0deg, rgb(0 0 0 / 0.16) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.14) 0 2px, transparent 2px 4px);
  background-position: 0 0, 0 var(--turn, 0), 0 0;
  border-inline: 7px solid var(--trim);
  border-radius: 7px / 46%;
  box-shadow: 0 12px 16px -5px rgb(0 0 0 / 0.5), inset 0 0 0 1px rgb(0 0 0 / 0.28);
}
/* the same roll standing up, for a strap that lies flat */
.strap-roll--flat {
  background-image:
    linear-gradient(90deg, rgb(0 0 0 / 0.55) 0%, rgb(255 255 255 / 0.36) 24%, rgb(255 255 255 / 0.05) 46%, rgb(0 0 0 / 0.3) 76%, rgb(0 0 0 / 0.66) 100%),
    repeating-linear-gradient(90deg, rgb(0 0 0 / 0.16) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg, rgb(255 255 255 / 0.14) 0 2px, transparent 2px 4px);
  background-position: 0 0, var(--turn, 0) 0, 0 0;
  border-inline: 0;
  border-block: 6px solid var(--trim);
  border-radius: 46% / 7px;
  box-shadow: 10px 0 16px -5px rgb(0 0 0 / 0.5), inset 0 0 0 1px rgb(0 0 0 / 0.28);
}
/* standing at the end of a .webbing strap while it is being laid */
.webbing-roll {
  position: absolute;
  top: -4px;
  height: calc(100% + 8px);
  opacity: 0;
}

/* ------------------------------------------------------------------ helpers */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 200;
  padding: 12px 16px;
  font: 600 15px/1 var(--font);
  color: #fff;
  background: var(--ink);
  border-radius: var(--r);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }
