/* QLOGIX "Quarter" - Customs clearance page (pages/src/customs-clearance.html, built by pages/build.py).
   Loaded after ../styles.css and ../sub.css; everything here is prefixed cc-.
   The page's own idea: the border paperwork as a navy customs file that ticks itself off, and a round customs
   stamp (the live quarter in its centre) that lands on it. Further down, the paperwork runs ahead of the truck. */

/* ---------- hero ---------- */
.cc-hero .sp-hero__h1 em { display: block; }
/* the full stop of "cleared." is the quarter wedge */
.cc-stop { display: inline-block; width: .2em; height: .2em; margin-left: .06em; border-radius: 0 100% 0 0; background: var(--brand-400); }

/* the picture: the file (quarter corner top-right) and the stamp overlapping its bottom-left, as the homepage's
   photograph and dial. Sizes are shares of the column (cqw), so the stamp always covers the same part of the file. */
.cc-hero__side { container-type: inline-size; }
.cc-art { --sw: 37cqw; --in: 15cqw; --drop: 12cqw; position: relative; padding-bottom: var(--drop); }

.cc-file {
  --cp: clamp(20px, 6.6cqw, 42px);
  position: relative; display: flex; flex-direction: column;
  aspect-ratio: 4 / 5; /* a minimum: a long translation makes it taller */
  margin-left: var(--in);
  padding: var(--cp) var(--cp) 0;
  background: var(--navy-950); color: #fff;
  border-radius: var(--r) var(--q) var(--r) var(--r);
}
/* a quarter hour of minute ticks along the quarter corner */
.cc-file__q { position: absolute; top: 0; right: 0; width: var(--q); height: var(--q); overflow: visible; fill: none; stroke-linecap: round; pointer-events: none; }
.cc-file__q path { vector-effect: non-scaling-stroke; }
.cc-file__tag { display: flex; align-items: flex-start; gap: 12px; padding-right: calc(var(--q) * .5); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; color: var(--brand-300); }
.cc-file__tag .bar { width: 26px; height: 5px; margin-top: .45em; }
.cc-file__t { margin-top: clamp(8px, 2.2cqw, 14px); padding-right: calc(var(--q) * .4); font-family: var(--display); font-weight: 750; font-size: clamp(1.6rem, 7cqw, 2.6rem); line-height: 1; letter-spacing: -.03em; text-wrap: balance; overflow-wrap: break-word; }

.cc-file__list { margin: clamp(16px, 5cqw, 30px) 0 clamp(16px, 4cqw, 26px); border-top: 1.5px solid rgba(255, 255, 255, .14); }
.cc-file__list li { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: clamp(12px, 3cqw, 16px); align-items: center; padding-block: clamp(9px, 2.3cqw, 14px); border-bottom: 1.5px solid rgba(255, 255, 255, .14); }
.cc-box { grid-row: 1 / span 2; display: block; width: 26px; height: 26px; border-radius: 6px 12px 6px 6px; background: var(--brand-400); color: var(--navy-950); }
.cc-box svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cc-file__list b { grid-column: 2; font-family: var(--display); font-weight: 650; font-size: clamp(1rem, 3.6cqw, 1.25rem); line-height: 1.2; letter-spacing: -.01em; overflow-wrap: break-word; }
.cc-file__list span { grid-column: 2; font-size: clamp(.8125rem, 2.6cqw, .9375rem); line-height: 1.35; color: var(--on-dark); }

/* the last line: the stamp covers its left end */
.cc-file__done {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: calc(var(--sw) - var(--drop) + 22px);
  margin: auto calc(-1 * var(--cp)) 0;
  padding: 16px var(--cp) 16px calc(var(--sw) - var(--in) + clamp(14px, 3.4cqw, 22px));
  border-radius: 0 0 var(--r) var(--r);
  background: var(--brand-400); color: var(--navy-950);
  font-family: var(--display); font-weight: 750; font-size: clamp(1.1rem, 4.6cqw, 1.75rem); line-height: 1.05; letter-spacing: -.025em;
}
.cc-file__done span { min-width: 0; text-wrap: balance; }

/* the stamp: white face, the logo-blue rim, two lines of text on the ring, the live quarter in the middle */
.cc-stamp { position: absolute; z-index: 2; left: 0; bottom: 0; width: var(--sw); aspect-ratio: 1; border-radius: 50%; background: #fff; box-shadow: 0 0 0 clamp(5px, 1.6cqw, 10px) #fff; }
.cc-stamp svg { width: 100%; height: 100%; }
.cc-stamp__txt { font-family: var(--body); font-weight: 700; font-size: 41px; letter-spacing: .1em; fill: var(--navy-950); }
.cc-stamp::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; box-shadow: 0 0 0 3px var(--brand-400); opacity: 0; pointer-events: none; }

/* the entrance (JS + motion allowed only): the four lines tick themselves off, then the stamp lands and the last line
   floods blue from the stamp's corner. Without it the file shows its finished state. */
@media screen and (prefers-reduced-motion: no-preference) {
  .js .cc-file__q { opacity: 0; transform: rotate(-24deg); transform-origin: 0 100%; transition: opacity .6s .4s, transform 1.4s .4s var(--ease-in-out); }
  .js .cc-box { background: transparent; box-shadow: inset 0 0 0 2px var(--navy-400); transition: background-color .25s, box-shadow .25s; }
  .js .cc-box path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .4s var(--ease-in-out); }
  .js .cc-file__list b { color: var(--on-dark); transition: color .4s; }
  .js .cc-file__done { background: var(--navy-800); color: var(--on-dark); transition: color .4s 2.45s; }
  .js .cc-file__done::before { content: ""; position: absolute; z-index: -1; left: 0; bottom: 0; width: 160%; aspect-ratio: 1; border-radius: 0 100% 0 0; background: var(--brand-400); transform: scale(0); transform-origin: 0 100%; transition: transform 1s 2.38s var(--ease); }
  .js .cc-stamp { opacity: 0; }

  .js .cc-hero__side.is-seen .cc-file__q { opacity: 1; transform: none; }
  .js .cc-hero__side.is-seen .cc-box { background: var(--brand-400); box-shadow: inset 0 0 0 2px var(--brand-400); }
  .js .cc-hero__side.is-seen .cc-box path { stroke-dashoffset: 0; }
  .js .cc-hero__side.is-seen .cc-file__list b { color: #fff; }
  .js .cc-hero__side.is-seen li:nth-child(1) :is(.cc-box, b) { transition-delay: .75s; }
  .js .cc-hero__side.is-seen li:nth-child(1) path { transition-delay: .85s; }
  .js .cc-hero__side.is-seen li:nth-child(2) :is(.cc-box, b) { transition-delay: 1.1s; }
  .js .cc-hero__side.is-seen li:nth-child(2) path { transition-delay: 1.2s; }
  .js .cc-hero__side.is-seen li:nth-child(3) :is(.cc-box, b) { transition-delay: 1.45s; }
  .js .cc-hero__side.is-seen li:nth-child(3) path { transition-delay: 1.55s; }
  .js .cc-hero__side.is-seen li:nth-child(4) :is(.cc-box, b) { transition-delay: 1.8s; }
  .js .cc-hero__side.is-seen li:nth-child(4) path { transition-delay: 1.9s; }
  .js .cc-hero__side.is-seen .cc-file__done { color: var(--navy-950); }
  .js .cc-hero__side.is-seen .cc-file__done::before { transform: none; }
  .js .cc-hero__side.is-seen .cc-stamp { animation: cc-stamp .62s 2s cubic-bezier(.3, 0, .2, 1) both; }
  .js .cc-hero__side.is-seen .cc-stamp::after { animation: cc-ink .9s 2.32s var(--ease) both; }
  .js .cc-hero__side.is-seen .cc-file { animation: cc-thud .5s 2.3s var(--ease); }
}
@keyframes cc-stamp {
  0% { opacity: 0; transform: translate(8%, -18%) scale(1.55) rotate(-18deg); }
  40% { opacity: 1; }
  55% { transform: scale(.93) rotate(1.5deg); }
  76% { transform: scale(1.025) rotate(-.4deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes cc-ink { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes cc-thud { 0%, 100% { transform: none; } 28% { transform: translateY(4px); } }

/* ---------- the paperwork runs ahead of the truck (navy band) ---------- */
/* the band reaches under the closing band, so that band's quarter corner shows navy, not white */
.cc-band { padding-bottom: calc(var(--sec) + var(--q)); margin-bottom: calc(-1 * var(--q)); }
.cc-flow {
  --g: clamp(24px, 4vw, 64px);
  --bx: calc((100% - 2 * var(--g)) * 2 / 3 + var(--g) * 1.5); /* the border: between the second and third step */
  --to: calc((100cqw - 2 * var(--g)) * 5 / 6 + var(--g) * 2); /* where the truck ends: the middle of the third step */
  --lg: clamp(28px, 3.4vw, 48px);
}
.cc-lanes { container-type: inline-size; position: relative; display: grid; gap: clamp(26px, 3vw, 38px); padding: 4px 0 38px; margin-bottom: var(--lg); }
.cc-lane { position: relative; display: grid; gap: 14px; }
.cc-lane > span { font-size: .8125rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; color: var(--brand-300); }
.cc-lane__line { display: block; height: 6px; }
.cc-lane--doc .cc-lane__line { width: calc(var(--bx) - 46px); background: var(--brand-400); border-radius: 1px; transform-origin: 0 50%; }
.cc-lane__ok { position: absolute; left: calc(var(--bx) - 46px); bottom: -13px; width: 32px; height: 32px; margin-left: -6px; border-radius: 50%; background: var(--brand-400); color: var(--navy-950); }
.cc-lane__ok svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.cc-lane--truck .cc-lane__line { height: 2px; margin-block: 2px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .38) 0 8px, transparent 8px 16px); }
.cc-lane__trail { position: absolute; left: 0; bottom: 2px; width: var(--to); height: 2px; background: #fff; transform-origin: 0 50%; }
.cc-lane__dot { position: absolute; left: 0; bottom: -8px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px rgba(255, 255, 255, .22); transform: translateX(var(--to)); }
.cc-lanes__border { position: absolute; top: 0; bottom: 0; left: var(--bx); display: flex; align-items: flex-end; padding-left: 12px; border-left: 2px dashed rgba(255, 255, 255, .42); font-size: .8125rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1; color: #fff; }

.cc-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px var(--g); }
.cc-steps li { position: relative; display: grid; gap: 12px; align-content: start; padding-top: 22px; border-top: 1.5px solid rgba(255, 255, 255, .16); }
.cc-steps li:nth-child(3)::before { content: ""; position: absolute; left: calc(var(--g) * -.5 - 1px); top: calc(-1 * var(--lg)); bottom: 0; border-left: 2px dashed rgba(255, 255, 255, .42); }
.cc-steps__k { font-size: .8125rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5; color: var(--brand-300); }
.cc-steps h3 { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 2.4vw, 2.25rem); line-height: 1.05; letter-spacing: -.03em; overflow-wrap: break-word; }
.cc-steps li > p:last-child { max-width: 40ch; color: var(--on-dark); }

@media screen and (prefers-reduced-motion: no-preference) {
  .js .cc-lane--doc .cc-lane__line { transform: scaleX(0); transition: transform 1.1s .3s var(--ease-in-out); }
  .js .cc-lane__ok { opacity: 0; transform: scale(.4); transition: opacity .3s 1.35s, transform .5s 1.35s var(--ease); }
  .js .cc-lane__trail { transform: scaleX(0); transition: transform 2.4s 1s var(--ease-in-out); }
  .js .cc-lane__dot { transform: none; transition: transform 2.4s 1s var(--ease-in-out); }
  .js .cc-lanes.is-seen :is(.cc-lane__line, .cc-lane__trail) { transform: none; }
  .js .cc-lanes.is-seen .cc-lane__ok { opacity: 1; transform: none; }
  .js .cc-lanes.is-seen .cc-lane__dot { transform: translateX(var(--to)); }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .cc-flow { --bx: 66.667%; --to: 84cqw; }
  .cc-steps { grid-template-columns: 1fr; gap: 0; }
  .cc-steps li { padding-block: 22px 26px; }
  .cc-steps li:nth-child(3)::before { display: none; }
}
@media (max-width: 640px) {
  .cc-art { --sw: 40cqw; --in: 9cqw; --drop: 13cqw; }
  .cc-file { border-radius: var(--r) calc(var(--q) * .8) var(--r) var(--r); }
  .cc-file__q { width: calc(var(--q) * .8); height: calc(var(--q) * .8); }
  .cc-file__done .arr { display: none; }
}

@media print {
  .cc-band { padding-bottom: var(--sec); margin-bottom: 0; }
  .cc-stamp { box-shadow: none; }
}
