/* ==========================================================================
   Markov — brand foundation
   Tokens, reset, and the chrome shared by every page (nav, actions, footer).

   --gold and --ember are also mirrored onto the landing page's world SVG at
   runtime (see assets/main.js) so the two accents have a single source.
   ========================================================================== */

:root {
  /* Palette */
  --ink:    #0a0a0b;   /* page ground          */
  --paper:  #f4f4f0;   /* primary foreground   */
  --fog:    #9d9d97;   /* secondary text       */
  --slate:  #55554f;   /* tertiary / labels    */
  --panel:  #121214;   /* card + console fill  */
  --edge:   #26262a;   /* hairline borders     */
  --dim:    #3a3a3e;   /* ambient node stroke  */
  --haze:   #202024;   /* ambient line stroke  */
  --gold:   #c9a35c;   /* owner / kill switch  */
  --ember:  #a8625a;   /* blocked / refused    */

  /* Type */
  --serif: 'Instrument Serif', Georgia, serif;
  --sans:  'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Rhythm */
  --gutter: clamp(20px, 5vw, 56px);
  --ease:   cubic-bezier(.19, 1, .22, 1);
}

/* --------------------------------------------------------------- base ---- */

html { scroll-behavior: smooth }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--paper); color: var(--ink) }

a { color: var(--paper) }
a:hover { color: var(--fog) }
a:focus-visible,
button:focus-visible { outline: 1px solid var(--paper); outline-offset: 3px }

/* Film grain over the whole page. */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 55;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 300 300' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 7s steps(10) infinite;
}

@keyframes grain {
  0%, 100% { transform: translate(0, 0) }
  20%      { transform: translate(-3%, 2%) }
  40%      { transform: translate(2%, -3%) }
  60%      { transform: translate(-2%, -2%) }
  80%      { transform: translate(3%, 3%) }
}

@keyframes card    { to { opacity: 1; transform: translateY(0) } }
@keyframes breathe { 0%, 100% { opacity: .3 } 50% { opacity: .75 } }
@keyframes drip    { 0% { top: -100% } 60%, 100% { top: 100% } }

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

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px var(--gutter);
  mix-blend-mode: difference;
}
.wordmark { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--paper) }
.wordmark-text { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .35em }
.nav-links { display: flex; gap: 22px; align-items: center }

/* On document pages the nav sits on scrolling text, so it needs a ground. */
.nav--solid {
  mix-blend-mode: normal;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge);
}

/* ------------------------------------------------------------ actions ---- */

/* Underlined mono link. Both colour and rule brighten on hover. */
.rule-link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .15em;
  color: var(--fog);
  text-decoration: none;
  text-transform: uppercase;
  border-bottom: 1px solid var(--slate);
  padding-bottom: 2px;
  transition: color .2s ease, border-color .2s ease;
}
.rule-link:hover { color: var(--paper); border-color: var(--paper) }

/* Solid CTA. */
.btn {
  display: inline-block;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 15px 24px;
  border-radius: 4px;
  transition: opacity .2s ease;
}
.btn:hover { opacity: .85; color: var(--ink) }

/* Shared eyebrow label. */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 18px;
}

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

.site-footer {
  padding: 28px var(--gutter);
  border-top: 1px solid var(--edge);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--slate);
  letter-spacing: .12em;
}

/* Standing disclaimer, shown on every page. */
.footer-note {
  margin: 0 0 20px;
  max-width: 72ch;
  line-height: 1.7;
  letter-spacing: .04em;
  color: var(--slate);
}

.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap }
.foot-link { color: var(--slate); text-decoration: none; transition: color .2s ease }
.foot-link:hover { color: var(--paper) }

/* ------------------------------------------------------ reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important }
  [data-cold] { opacity: 1 !important; transform: none !important }
  html { scroll-behavior: auto }
}

/* ========================================================== responsive === */

/* Paint into the notch, but keep the chrome clear of it. */
.nav {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.site-footer {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

/* Touch devices: grow the hit area of the small mono links to a usable size
   without moving them — the padding is cancelled by an equal negative margin. */
@media (pointer: coarse) {
  .rule-link, .card-link {
    padding-top: 22px;
    margin-top: -22px;
  }
  .foot-link {
    padding: 12px 0;
    margin: -12px 0;
  }
  .btn { padding: 17px 26px }
}

html { -webkit-text-size-adjust: 100% }
a, button, input, [role="button"] { -webkit-tap-highlight-color: rgba(244, 244, 240, .12) }

/* The wordmark's wide tracking plus two links overruns a narrow phone. */
@media (max-width: 620px) {
  .nav { padding-top: 16px; padding-bottom: 16px }
  .wordmark { gap: 10px }
  .wordmark-text { font-size: 12px; letter-spacing: .22em }
  .nav-links { gap: 16px }
}
/* Below this the two nav links cannot both fit; Litepaper also sits in the
   hero and the footer, so it is the one to drop. */
@media (max-width: 430px) {
  .nav-links .rule-link:not(:last-child) { display: none }
}

@media (max-width: 620px) {
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
}
