/* Safi · base, tokens, type, chrome */

:root {
  --paper: #eeeae0;
  --ink: #0e0f0b;
  --night: #0c0d10;
  --stamp: #2e37e6;
  --stamp-deep: #1a20a8;
  --stamp-soft: #7c84ff;
  --alarm: #ff4a1c;
  --amber: #f2b33d;

  /* the live theme, tweened by js/app.js as sections pass */
  --bg: var(--paper);
  --fg: var(--ink);
  --acc: var(--stamp);
  --line: color-mix(in oklab, var(--fg) 16%, transparent);
  --mute: color-mix(in oklab, var(--fg) 58%, transparent);

  --f-display: 'Anybody', 'Arial Narrow', sans-serif;
  --f-text: 'Schibsted Grotesk', system-ui, sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, monospace;
  --f-ar: 'Reem Kufi', 'Noto Kufi Arabic', sans-serif;

  --gut: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-io: cubic-bezier(0.7, 0, 0.2, 1);
  --r: 4px;

  /* speckled stamp ink: a tiled alpha mask, rasterised once (an SVG filter would re-run on every repaint) */
  --ink-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -5 4.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")
    0 0 / 240px 240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-text);
  font-size: clamp(16px, 1.05vw + 0.3rem, 18.5px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: none;
}
body.is-loading {
  overflow: hidden;
}
img,
svg,
canvas {
  display: block;
  max-width: 100%;
}
a {
  color: inherit;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
p {
  margin: 0 0 1em;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: inherit;
}
::selection {
  background: var(--acc);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 2px;
}
code {
  font-family: var(--f-mono);
  font-size: 0.82em;
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 3px;
}

/* ---------- type ---------- */
.display,
.display-l,
.display-m,
.display-s {
  font-family: var(--f-display);
  font-weight: 820;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.035em;
  line-height: 0.9;
  text-wrap: balance;
}
.display {
  font-size: clamp(3.4rem, 10.4vw, 11.5rem);
}
.display-l {
  font-size: clamp(3.2rem, 9vw, 9.5rem);
}
.display-m {
  font-size: clamp(2.5rem, 5.8vw, 6rem);
}
.display-s {
  font-size: clamp(1.6rem, 2.9vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.ital {
  font-style: italic;
  font-weight: 260;
  font-variation-settings: 'wdth' 60;
  letter-spacing: -0.02em;
}
.mono {
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.5;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.9em;
  margin-bottom: clamp(1.2rem, 2.5vw, 2rem);
  color: var(--mute);
}
.eyebrow span {
  color: var(--acc);
}
.eyebrow::after {
  content: '';
  flex: 0 0 3rem;
  height: 1px;
  background: currentColor;
  order: 1;
}
.eyebrow span {
  order: 0;
}

/* the stamp highlight: a slab of stamp ink, slightly crooked, inked edges */
.stamped {
  position: relative;
  display: inline-block;
  color: var(--bg);
  padding: 0.02em 0.14em 0.08em;
  margin: 0 -0.04em;
  transform: rotate(-1.6deg);
  isolation: isolate;
}
.stamped::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--acc);
  -webkit-mask: var(--ink-mask);
  mask: var(--ink-mask);
  clip-path: inset(0 var(--stamp-clip, 0%) 0 0);
}
.stamped--sm {
  font-weight: 700;
  padding: 0 0.25em 0.05em;
}
.stamped--alarm::before {
  background: var(--alarm);
}
.tag {
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.72em;
  letter-spacing: 0.03em;
  padding: 0.12em 0.45em;
  border: 1px solid currentColor;
  border-radius: 3px;
  white-space: nowrap;
}

/* ---------- split text ---------- */
.split-line {
  overflow: clip;
  overflow-clip-margin: 0.12em;
  padding-bottom: 0.04em;
}

/* ---------- wordmark ---------- */
.wm {
  font-family: var(--f-display);
  font-weight: 860;
  font-variation-settings: 'wdth' 118;
  letter-spacing: -0.05em;
  line-height: 1;
}
.wm__i {
  position: relative;
  display: inline-block;
}
.wm__i i {
  position: absolute;
  left: 50%;
  top: 0.02em;
  width: 0.2em;
  height: 0.2em;
  translate: -50% 0;
  background: var(--acc);
}

/* ---------- buttons ---------- */
.btn {
  --h: 3.1rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  height: var(--h);
  padding: 0 1.3rem;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition:
    color 0.35s var(--ease),
    transform 0.35s var(--ease);
  white-space: nowrap;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--acc);
  transform: translateY(101%);
  transition: transform 0.45s var(--ease);
}
.btn:hover::before,
.btn:focus-visible::before {
  transform: translateY(0);
}
.btn b {
  font-weight: 500;
  transition: transform 0.35s var(--ease);
}
.btn:hover b {
  transform: translateX(4px);
}
.btn--ink {
  background: var(--fg);
  color: var(--bg);
}
.btn--ink:hover {
  color: var(--paper);
}
.btn--line {
  border: 1px solid var(--fg);
}
.btn--line:hover {
  color: var(--paper);
  border-color: var(--acc);
}
.btn--paper {
  background: var(--paper);
  color: var(--ink);
}
.btn--paper:hover {
  color: var(--paper);
}
.btn--alarm {
  background: var(--alarm);
  color: var(--ink);
}
.btn--alarm::before {
  background: var(--paper);
}
.btn--alarm b {
  opacity: 0.6;
}

/* ---------- nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem var(--gut);
  color: var(--fg);
  transition:
    transform 0.6s var(--ease),
    background-color 0.3s;
}
.nav.is-hidden {
  transform: translateY(-110%);
}
.nav.is-solid {
  background: color-mix(in oklab, var(--bg) 94%, transparent);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  font-size: 1.85rem;
}
.brand__ar {
  font-family: var(--f-ar);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--acc);
  translate: 0 -0.1em;
}
.nav__links {
  display: flex;
  gap: 1.6rem;
  margin-left: auto;
  font-size: 0.9rem;
}
.nav__links a {
  position: relative;
  text-decoration: none;
  padding: 0.3rem 0;
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.nav__links a:hover::after,
.nav__links a.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}
.nav__status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
}
.nav__status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  position: relative;
}
/* the pulse is a ring that scales and fades: transform and opacity only, so it stays off the main thread */
.nav__status i::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  70%,
  100% {
    transform: scale(3);
    opacity: 0;
  }
}
.nav__cta {
  --h: 2.6rem;
}
.nav__burger {
  display: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  position: relative;
}
.nav__burger i {
  position: absolute;
  left: 30%;
  right: 30%;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.4s var(--ease);
}
.nav__burger i:first-child {
  top: 42%;
}
.nav__burger i:last-child {
  top: 56%;
}
.nav__burger[aria-expanded='true'] i:first-child {
  transform: translateY(3px) rotate(45deg);
}
.nav__burger[aria-expanded='true'] i:last-child {
  transform: translateY(-3px) rotate(-45deg);
}
.menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  padding: 5rem var(--gut) 2rem;
  background: var(--fg);
  color: var(--bg);
}
.nav.is-menu {
  color: var(--bg);
  background: transparent;
}
.nav.is-menu .nav__burger {
  border-color: color-mix(in oklab, var(--bg) 30%, transparent);
}
.menu[hidden] {
  display: none;
}
.menu a {
  font-family: var(--f-display);
  font-weight: 800;
  font-variation-settings: 'wdth' 96;
  font-size: clamp(2.2rem, 11vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-decoration: none;
}

/* ---------- grain + cursor ---------- */
.grain {
  position: fixed;
  inset: -4%;
  z-index: 90;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(4) infinite;
}
@keyframes grain {
  25% {
    transform: translate(-3%, 2%);
  }
  50% {
    transform: translate(2%, -3%);
  }
  75% {
    transform: translate(-1%, 3%);
  }
}
.cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 95;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: var(--acc);
  pointer-events: none;
  display: grid;
  place-items: center;
  /* grows with scale, not width/height, so it never triggers layout */
  scale: 0.16;
  transition:
    scale 0.4s var(--ease),
    opacity 0.3s;
  opacity: 0;
}
.cursor.is-on {
  opacity: 1;
}
.cursor.is-big {
  scale: 1;
}
.cursor__label {
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper);
  opacity: 0;
  transition: opacity 0.25s;
}
.cursor.is-big .cursor__label {
  opacity: 1;
}
@media (hover: none), (pointer: coarse) {
  .cursor {
    display: none;
  }
}

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--night);
  color: var(--paper);
  display: grid;
  place-items: center;
}
.loader__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.loader__count {
  position: absolute;
  left: var(--gut);
  bottom: 1.4rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--f-mono);
  font-variation-settings: 'wdth' 87;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.loader__count b {
  font-family: var(--f-display);
  font-size: 2.4rem;
  font-weight: 800;
  font-variation-settings: 'wdth' 70;
  min-width: 2.2ch;
  text-align: right;
}
.loader__seal {
  position: relative;
  width: min(34vw, 220px);
  height: min(34vw, 220px);
  color: var(--stamp-soft);
  opacity: 0;
}

@media (max-width: 1080px) {
  .nav__links,
  .nav__status {
    display: none;
  }
  .nav__cta {
    margin-left: auto;
  }
}
@media (max-width: 640px) {
  .nav__cta {
    display: none;
  }
  .nav__burger {
    display: block;
    margin-left: auto;
  }
  .hide-sm {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grain {
    animation: none;
  }
  .nav__status i::after {
    animation: none;
  }
}
