/* MYARA — base tokens, type and shared chrome.
   Page-specific styles live in their own files (home.css, pages.css, product.css). */

:root {
  --paper: #f6f6f4;
  --white: #ffffff;
  --ink: #0a0a0b;
  --ink-2: #1b1c1e;
  --graphite: #6b6e70;
  --mist: #a9adaf;
  --hair: rgba(10, 10, 11, 0.14);
  --hair-strong: rgba(10, 10, 11, 0.32);
  --ice: #bfcfd6;
  --accent: #36d1c4;
  --blueprint: #0a0c0e;

  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-sans: "Inter Tight", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 3vw, 40px);
  /* the nav grows with the logo (logo height + its padding) */
  --nav-h: calc(var(--logo-size) * 0.86 * var(--logo-y) + 46px);
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-dim: var(--graphite);
  --line: var(--hair);
}

body[data-theme="dark"] {
  --bg: var(--blueprint);
  --fg: #e9eef0;
  --fg-dim: #7d8a90;
  --line: rgba(191, 207, 214, 0.16);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--ink); color: var(--white); }
body[data-theme="dark"] ::selection { background: var(--accent); color: var(--blueprint); }

/* ---------- type primitives ---------- */

.mono,
.label {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.label { font-size: 10px; color: var(--fg-dim); }

.display {
  font-family: var(--font-sans);
  font-weight: 200;
  letter-spacing: -0.02em;
  line-height: 0.95;
  text-transform: uppercase;
}

/* ---------- nav ---------- */

.mx-nav {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-h);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 26px var(--gutter) 0;
  z-index: 50;
  pointer-events: none;
  mix-blend-mode: difference;
  color: #fff;
}

.mx-nav > * { pointer-events: auto; }

/* Wordmark: MYARA in an extended grotesk (Archivo, variable weight and width), stretched wider
   and taller, widely tracked, shown like an old CRT / LED hologram: fine scanlines, a slow
   breathing and, rarely, a short horizontal glitch of the whole word.
   Every look knob is a variable on :root — tweak them in devtools on :root, or open any page
   with ?tune for sliders. Archivo is loaded with its full axes (wght 100–900, wdth 62–125). */
:root {
  --logo-size: 52px;     /* font size */
  --logo-size-phone: 33px; /* font size on phones (under 640px wide) */
  --logo-weight: 390;    /* 100–900 */
  --logo-wdth: 116;      /* font width axis, 62–125 */
  --logo-track: 0.57em;  /* letter spacing */
  --logo-x: 0.8;        /* extra horizontal stretch */
  --logo-y: 0.63;        /* extra vertical stretch */
  --logo-scan: 0.55;     /* scanline darkness: 1 = off, lower = stronger lines */
}

.mx-logo {
  position: relative;
  display: inline-block;
  font-family: "Archivo", var(--font-sans);
  font-size: var(--logo-size);
  font-weight: var(--logo-weight);
  font-variation-settings: "wdth" var(--logo-wdth), "wght" var(--logo-weight);
  line-height: 0.86;
  letter-spacing: var(--logo-track);
  text-transform: uppercase;
  /* the stretch is a transform: shell.js measures the word and reserves its stretched size */
  width: calc(var(--logo-w, 5.25em) * var(--logo-x));
  height: calc(var(--logo-h, 0.86em) * var(--logo-y));
}

.mx-logo .lg-word {
  display: inline-block;
  white-space: nowrap;
  transform: scale(var(--logo-x), var(--logo-y));
  transform-origin: left top;
  /* scanlines: every third pixel row dimmed */
  -webkit-mask-image: repeating-linear-gradient(to bottom, #000 0 2px, rgba(0, 0, 0, var(--logo-scan)) 2px 3px);
  mask-image: repeating-linear-gradient(to bottom, #000 0 2px, rgba(0, 0, 0, var(--logo-scan)) 2px 3px);
}

.mx-logo .lg-word {
  position: relative;
  animation: mx-crt 7s ease-in-out infinite, mx-glitch 11s steps(1, end) infinite;
}


@keyframes mx-crt {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.86; }
}

@keyframes mx-glitch {
  0%, 92%, 100% { translate: 0 0; }
  92.6% { translate: -3px 0; }
  93.2% { translate: 2px 0; }
  93.8% { translate: 0 0; }
}


@media (prefers-reduced-motion: reduce) {
  .mx-logo .lg-word { animation: none; }
}

/* the wide logo and the links share the top line only on wide screens */
@media (max-width: 1280px) {
  :root { --nav-h: calc(var(--logo-size) * 0.86 * var(--logo-y) + 84px); }
  .mx-nav { flex-direction: column; gap: 14px; }
}

body[data-page="logo"] .mx-readout { display: none; }

/* industry metrics, bottom-left corner of the home page */
.mx-note {
  transition: opacity 0.2s linear;
  position: fixed;
  z-index: 40;
  left: var(--gutter);
  bottom: 22px;
  width: min(440px, calc(100vw - 2 * var(--gutter)));
  margin: 0;
  color: var(--fg);
  pointer-events: none;
}

.mx-note__kicker {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.mx-note__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 18px;
  max-width: 440px;
  margin: 0;
}

.mx-note__stats div { margin: 0; }

.mx-note__stats dt {
  font-family: var(--font-mono);
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 400;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.mx-note__stats dd {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.mx-note__src {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist);
}

.mx-links {
  display: flex;
  gap: clamp(14px, 2.6vw, 36px);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.mx-links a {
  position: relative;
  padding: 6px 0;
  opacity: 0.62;
  transition: opacity 0.4s var(--ease);
}

.mx-links a:hover,
.mx-links a[aria-current="page"] { opacity: 1; }

.mx-links a .idx { opacity: 0.5; margin-right: 0.5em; }

.mx-links a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
}

/* ---------- fixed technical readouts ---------- */

.mx-readout {
  position: fixed;
  z-index: 40;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
  pointer-events: none;
  white-space: pre;
  line-height: 1.7;
}

.mx-readout--bl { left: var(--gutter); bottom: 18px; }
.mx-readout--br { right: var(--gutter); bottom: 18px; text-align: right; }

.mx-readout { transition: opacity 0.8s var(--ease); }

body.is-reading .mx-readout { opacity: 0; }

/* content dissolves into the paper under the nav instead of colliding with it */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--nav-h) + 24px);
  background: linear-gradient(to bottom, var(--bg) 55%, transparent);
  z-index: 45;
  pointer-events: none;
}

/* ---------- page transition veil ---------- */

.mx-veil {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.9s var(--ease);
}

body.is-ready .mx-veil { opacity: 0; }
body.is-leaving .mx-veil { opacity: 1; transition-duration: 0.45s; }

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

.mx-main { position: relative; z-index: 1; }

.hairline { height: 1px; background: var(--line); border: 0; margin: 0; }

@media (max-width: 640px) {
  .mx-links .idx { display: none; }
  .mx-links { gap: 14px; letter-spacing: 0.1em; }
  :root { --nav-h: calc(var(--logo-size-phone) * 0.86 * var(--logo-y) + 66px); }
  .mx-nav { flex-direction: column; gap: 12px; padding-top: 18px; }
  .mx-logo { font-size: var(--logo-size-phone); }
  .mx-note { bottom: 16px; }
  .mx-note__stats { gap: 0 10px; }
  .mx-note__stats dt { font-size: 15px; }
  .mx-note__stats dd { font-size: 8px; }
  .mx-note__src { display: none; }
  .mx-readout--bl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
