/* ==========================================================================
   Wicker — chrome shared by every page
   preloader · cursor · nav · marquee · code · cards · footer
   ========================================================================== */

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--navy);
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  padding: var(--gutter);
}

.preloader[hidden] { display: none; }

.preloader__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  grid-row: 1;
}

/* The braid symbol from the design pack (portrait, 108x230). */
.preloader__mark {
  width: auto;
  height: 72px;
  opacity: 0;
}

.preloader__word {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gray-500);
  overflow: hidden;
}

.preloader__word span {
  display: inline-block;
  transform: translateY(110%);
}

.preloader__foot {
  grid-row: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.preloader__count {
  font-family: var(--font-sans);
  font-size: clamp(3.5rem, 14vw, 11rem);
  line-height: 0.8;
  letter-spacing: -0.05em;
  font-weight: 500;
  color: var(--on-navy);
  font-variant-numeric: tabular-nums;
}

.preloader__meta {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray-500);
  text-align: right;
  padding-bottom: 0.6rem;
  line-height: 1.9;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

/* Logo in the preloader foot — the design-pack file, never typed. */
.preloader__meta img {
  width: auto;
  height: 44px;
}

.preloader__bar {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--gutter) + 8.5rem);
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.preloader__bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
}

/* The curtain that wipes the loader away, revealing the hero underneath. */
.preloader__curtain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--navy);
  transform-origin: top;
  pointer-events: none;
}

.preloader__curtain[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Custom cursor
   -------------------------------------------------------------------------- */

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9997;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  will-change: transform;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--copper);
}

.cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  transition: width 0.4s var(--ease-out-expo),
              height 0.4s var(--ease-out-expo),
              margin 0.4s var(--ease-out-expo),
              background-color 0.4s var(--ease-out-expo),
              border-color 0.4s var(--ease-out-expo);
}

.cursor-ring.is-hot {
  width: 74px;
  height: 74px;
  margin: -37px 0 0 -37px;
  background: rgba(217, 124, 80, 0.1);
  border-color: var(--c-accent);
}

/* Over a light section the ring must invert or it vanishes. */
.cursor-ring.on-paper { border-color: rgba(13, 26, 50, 0.4); }

html.has-cursor,
html.has-cursor * { cursor: none !important; }

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  transition: height 0.5s var(--ease-out-expo),
              background-color 0.5s var(--ease-out),
              border-color 0.5s var(--ease-out),
              backdrop-filter 0.5s var(--ease-out);
  border-bottom: 1px solid transparent;
}

.nav.is-compact {
  height: var(--nav-h-compact);
  background: rgba(10, 21, 42, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--line-dark-soft);
}

.nav.is-hidden { transform: translateY(-100%); }
.nav { transition-property: height, background-color, border-color, transform; }

.nav__inner {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

/* The logo is always the design-pack SVG (Quicksand lettering is embedded in
   the file). Never retype the name in the site font. Clear space around it is
   at least one leaf of the braid, roughly 12% of the logo height — hence the
   padding on .brand. */
.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 6px 0;
}

.brand__logo {
  width: auto;
  height: 60px;      /* 124px wide: never below the 120px minimum */
  flex: none;
}

.footer .brand__logo { height: 64px; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.4vw, 2.25rem);
}

.nav-menu a {
  font-size: 0.875rem;
  letter-spacing: -0.005em;
  color: var(--gray-300);
  transition: color 0.3s var(--ease-out);
}

.nav-menu a:hover,
.nav-menu a[aria-current="page"] { color: var(--on-navy); }

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

.nav .btn { height: 42px; padding-inline: 1.25rem; }

.nav__env {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gray-500);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* Burger */
.burger {
  display: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  position: relative;
  flex: none;
}

.burger i {
  position: absolute;
  left: 11px;
  width: 22px;
  height: 1.5px;
  background: var(--white);
  transition: transform 0.45s var(--ease-out-expo), opacity 0.25s;
}

.burger i:nth-child(1) { top: 18px; }
.burger i:nth-child(2) { top: 25px; }

.burger.is-open i:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.burger.is-open i:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 1000px) {
  .nav-menu, .nav__env { display: none; }
  .burger { display: block; }
  .nav__actions .btn--ghost { display: none; }
}

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 890;
  background: var(--navy);
  padding: calc(var(--nav-h) + 2rem) var(--gutter) var(--gutter);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.7s var(--ease-out-expo);
  pointer-events: none;
}

.drawer.is-open {
  clip-path: inset(0 0 0 0);
  pointer-events: auto;
}

.drawer__links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.drawer__links a {
  font-size: clamp(2rem, 9vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  font-weight: 500;
  border-bottom: 1px solid var(--line-dark-soft);
  padding-block: 0.5rem;
  opacity: 0;
  transform: translateY(24px);
}

.drawer.is-open .drawer__links a {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease-out) var(--d, 0s),
              transform 0.7s var(--ease-out-expo) var(--d, 0s);
}

.drawer__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-500);
}

/* --------------------------------------------------------------------------
   Marquee
   -------------------------------------------------------------------------- */

.marquee-wrap {
  position: relative;
  overflow: hidden;
  border-block: 1px solid var(--c-line);
  padding-block: clamp(1rem, 2vw, 1.6rem);
  background: var(--c-bg);
  color: var(--c-ink);
  display: flex;
}

.marquee-wrap__track {
  display: flex;
  flex: none;
  gap: 0;
  will-change: transform;
}

.marquee-wrap__group {
  display: flex;
  align-items: center;
  flex: none;
  padding-right: 0;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding-inline: clamp(1.25rem, 3vw, 2.5rem);
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  letter-spacing: -0.03em;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}

.marquee-item svg {
  width: clamp(14px, 1.6vw, 20px);
  height: clamp(14px, 1.6vw, 20px);
  color: var(--c-accent);
  flex: none;
}

.marquee-item--dim { color: var(--c-mute); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: clamp(1.5rem, 2.4vw, 2.25rem);
  background: var(--c-bg);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.5s var(--ease-out), transform 0.6s var(--ease-out-expo);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 120% at 50% 110%, rgba(217, 124, 80, 0.09), transparent 62%);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}

.card:hover { border-color: rgba(217, 124, 80, 0.45); transform: translateY(-4px); }
.card:hover::before { opacity: 1; }

.card__num {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  color: var(--c-mute);
  display: block;
  margin-bottom: 1.75rem;
}

.card__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 1.5rem;
  color: var(--c-ink);
}

.card__title {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.card__body {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--c-mute);
}

/* --------------------------------------------------------------------------
   Code blocks
   -------------------------------------------------------------------------- */

.code {
  position: relative;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: #081121;
  overflow: hidden;
  color: var(--on-navy);
  color-scheme: dark;
}

.code__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  border-bottom: 1px solid var(--line-dark);
  background: #16243C;
  min-height: 44px;
}

.code__tabs {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.code__tabs::-webkit-scrollbar { display: none; }

.code__tab {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  white-space: nowrap;
  transition: color 0.3s, background-color 0.3s;
}

.code__tab:hover { color: var(--gray-300); }

.code__tab[aria-selected="true"] {
  color: var(--navy);
  background: var(--copper);
}

.code__title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--gray-500);
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code__copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-500);
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  transition: color 0.3s, border-color 0.3s;
}

.code__copy:hover { color: var(--c-accent); border-color: rgba(217, 124, 80, 0.4); }
.code__copy.is-done { color: var(--c-accent); border-color: var(--c-accent); }
.code__copy svg { width: 12px; height: 12px; }

.code pre {
  margin: 0;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.75;
  tab-size: 2;
}

.code pre::-webkit-scrollbar { height: 8px; }
.code pre::-webkit-scrollbar-thumb { background: var(--gray-700); border-radius: 4px; }
.code pre::-webkit-scrollbar-track { background: transparent; }

.code code { font-family: inherit; white-space: pre; }

.code__panel[hidden] { display: none; }

/* Syntax colours — applied by markup, no highlighter needed. */
.tok-key   { color: #9fb2ff; }
.tok-str   { color: var(--c-accent); }
.tok-num   { color: #f0c36d; }
.tok-bool  { color: #ff9d7a; }
.tok-com   { color: var(--gray-500); font-style: italic; }
.tok-fn    { color: #7ee081; }
.tok-punc  { color: var(--gray-400); }
.tok-flag  { color: #c8cacd; }
.tok-url   { color: #7ee081; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  background: var(--navy);
  color: var(--on-navy);
  padding-top: clamp(4rem, 8vw, 7rem);
  overflow: clip;
  position: relative;
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 4rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
}

@media (max-width: 900px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

.footer__brand p {
  color: var(--gray-500);
  font-size: 0.9375rem;
  max-width: 34ch;
  margin-top: 1rem;
}

.footer__col h4 {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray-500);
  font-weight: 400;
  margin-bottom: 1.25rem;
}

.footer__col ul { display: flex; flex-direction: column; gap: 0.7rem; }

.footer__col a {
  font-size: 0.9375rem;
  color: var(--gray-300);
  transition: color 0.3s var(--ease-out);
}

.footer__col a:hover { color: var(--c-accent); }

/* The large logo that closes the page. It is the design-pack file, unchanged;
   the padding is its clear space (one leaf of the braid). */
.footer__word {
  display: flex;
  justify-content: center;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) clamp(2rem, 5vw, 4rem);
  user-select: none;
}

.footer__word img {
  width: min(100%, 560px);
  height: auto;
}

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  justify-content: space-between;
  align-items: center;
  padding-block: 1.5rem;
  border-top: 1px solid var(--line-dark-soft);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.footer__legal a:hover { color: var(--c-accent); }

.footer__legal-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* The white-label note. Small, deliberate, factual. */
.footer__note {
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--gray-500);
  max-width: 90ch;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line-dark-soft);
  padding-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   Scroll progress bar (docs + home)
   -------------------------------------------------------------------------- */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 950;
  background: transparent;
  pointer-events: none;
}

.scroll-progress i {
  display: block;
  height: 100%;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}

/* Trademark line under the white-label note. */
.footer__note--tm {
  padding-top: 0;
  border-top: 0;
  margin-top: -1.25rem;
}

/* Logo in the mobile drawer foot. */
.drawer__foot .brand__logo { height: 60px; width: auto; }
