/* =====================================================
   COIxist — Shared chrome ("Paper & Ink")
   Reset, typography, header, footer, buttons, reveal.
   Loaded by every page after tokens.css + fonts.css.
   ===================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
strong { font-weight: 500; }
::selection { background: var(--accent); color: #fff; }

[id] { scroll-margin-top: calc(var(--nav-height) + var(--bar-height) + 24px); }

h1, h2, h3, h4 {
  font-weight: 400;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(32px, 3.6vw, 50px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 20px;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section { padding: var(--section-y) 0; }
.section--tight { padding: clamp(48px, 6vw, 88px) 0; }

/* ─── ACCESSIBILITY ─── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--text-on-ink);
  border-radius: 6px;
  font-size: 14px;
}

.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── ANNOUNCEMENT BAR ─── */
.bar {
  height: var(--bar-height);
  background: var(--ink);
  color: var(--text-on-ink);
  font-size: 13px;
  display: flex;
  align-items: center;
}

.bar .container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
}

.bar a {
  color: var(--text-on-ink-2);
  transition: color 200ms;
}

.bar a:hover { color: #fff; }

/* ─── HEADER ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(250, 250, 248, 0.92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 240ms var(--ease);
}

.nav.is-scrolled { border-bottom-color: var(--line); }

.nav-inner {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  font-size: 15px;
}

.nav-links a,
.nav-text {
  color: var(--text);
  transition: color 200ms;
}

.nav-links a:hover,
.nav-text:hover { color: var(--text-3); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
  justify-self: center;
}

.wordmark img { width: 26px; height: 26px; }
.wordmark .x { color: var(--logo-glow); }
.wordmark .ist { color: var(--logo-accent); }

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  font-size: 15px;
}

.nav-menu {
  display: none;
  font-size: 15px;
  padding: 8px 0;
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--paper);
  padding: calc(var(--nav-height) + var(--bar-height) + 16px) var(--gutter) 40px;
  flex-direction: column;
  gap: 4px;
  z-index: 99;
  border-top: 1px solid var(--line);
  overflow-y: auto;
}

.mobile-nav.is-open { display: flex; }

.mobile-nav a {
  font-size: 28px;
  letter-spacing: -0.02em;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.mobile-nav .btn { margin-top: 24px; align-self: flex-start; font-size: 16px; }

body.nav-open { overflow: hidden; }

/* ─── BUTTONS + LINKS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 6px 0 18px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), transform 200ms var(--ease);
}

.btn--pill { background: var(--accent); color: #fff; }
.btn--pill:hover { background: var(--accent-ink); }

.btn--ink { background: var(--ink); color: var(--text-on-ink); }
.btn--ink:hover { background: #22272f; }

.btn--light { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn--light:hover { background: var(--paper-2); }

.btn--lg { height: 48px; padding: 0 8px 0 22px; font-size: 15.5px; }

.btn .arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 14px;
  transition: transform 240ms var(--ease);
}

.btn--light .arrow { background: var(--paper-2); }
.btn:hover .arrow { transform: translateX(2px); }
.btn--lg .arrow { width: 34px; height: 34px; }

.btn--text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: color 200ms, border-color 200ms;
}

.btn--text:hover { color: var(--accent); border-color: var(--accent); }

/* "↳ Read more" — Legora's return-arrow link */
.more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  color: var(--text-2);
  transition: color 200ms;
}

.more::before {
  content: '↳';
  font-size: 15px;
  line-height: 1;
}

.more:hover { color: var(--accent); }

/* ─── FOOTER ─── */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(48px, 6vw, 88px) 0 32px;
  font-size: 14px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 96px);
  margin-bottom: clamp(40px, 5vw, 72px);
}

.footer-brand p {
  color: var(--text-2);
  margin-top: 14px;
  max-width: 34ch;
  line-height: 1.5;
}

.footer-brand a.email {
  display: inline-block;
  margin-top: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.footer-cols h4 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 14px;
  letter-spacing: 0;
}

.footer-cols ul { list-style: none; }
.footer-cols li { padding: 4px 0; }
.footer-cols a { color: var(--text); transition: color 200ms; }
.footer-cols a:hover { color: var(--text-3); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-3);
  font-size: 13px;
}

/* ─── REVEAL ─── */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

[data-reveal].is-in { opacity: 1; transform: none; }

html.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .btn, .btn .arrow, .more { transition: none; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-inner { grid-template-columns: 1fr auto; }
  .wordmark { justify-self: start; }
  .nav-actions .nav-text,
  .nav-actions .btn { display: none; }
  .nav-menu { display: inline-block; }
  .footer-top { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .bar { font-size: 12.5px; }
  .bar a { display: none; }
}
