/* Merkabit — site styles. Option A (deep contemplative) palette. */

:root {
  /* base palette */
  --bg: #0A0F1F;
  --bg-elev-1: #11172C;
  --bg-elev-2: #161D34;
  --line: rgba(245, 240, 230, 0.08);
  --line-strong: rgba(245, 240, 230, 0.16);
  --line-gold: rgba(212, 175, 55, 0.32);

  --ink: #F5F0E6;
  --ink-mid: rgba(245, 240, 230, 0.78);
  --ink-dim: rgba(245, 240, 230, 0.55);
  --ink-faint: rgba(245, 240, 230, 0.35);

  --gold: #D4AF37;
  --gold-soft: #C8A24A;
  --copper: #B87333;
  --teal: #2C5F66;

  --status-open: #D4AF37;
  --status-confirmed: #6FB78A;
  --status-refuted: #C56B5C;

  /* type */
  --font-display: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  --font-body: "Source Serif 4", "Source Serif Pro", "Lora", Georgia, serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* rhythm */
  --rule: 1px;
  --measure: 68ch;
  --gutter: clamp(20px, 4vw, 56px);
  --section-y: clamp(72px, 9vw, 132px);

  /* radii — geometry prefers little rounding */
  --r-1: 2px;
  --r-2: 4px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--ink); }

::selection { background: rgba(212, 175, 55, 0.35); color: var(--ink); }

/* ---------- typography ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.005em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(40px, 5.6vw, 76px); line-height: 1.04; letter-spacing: -0.012em; }
h2 { font-size: clamp(28px, 3.4vw, 46px); line-height: 1.12; }
h3 { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; }
h4 { font-size: 18px; line-height: 1.3; }

p { margin: 0 0 1em; }
p, li { text-wrap: pretty; }

.lede {
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.55;
  color: var(--ink-mid);
  max-width: var(--measure);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.eyebrow--mid { color: var(--ink-dim); }

.mono { font-family: var(--font-mono); }
code, kbd { font-family: var(--font-mono); font-size: 0.92em; }

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

.page {
  min-height: 100%;
}

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

.wrap--narrow { max-width: 920px; }
.wrap--wide   { max-width: 1360px; }

section { padding: var(--section-y) 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.section-head .eyebrow { white-space: nowrap; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 15, 31, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap--wide {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  height: 64px;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.brand .logo-mark { width: 28px; height: 28px; flex: none; }
.brand .wordmark {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.02em;
}
.brand .wordmark .small { color: var(--ink-dim); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; font-family: var(--font-mono); display: block; line-height: 1; margin-top: 2px; }

.nav { display: flex; gap: 28px; justify-self: center; }
.nav a {
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mid);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover, .nav a.active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.nav-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  margin-top: 80px;
  background: var(--bg);
}
.site-footer .wrap--wide {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 40px;
}
.site-footer h4 {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  font-weight: 400;
  margin-bottom: 14px;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--ink-mid); }
.site-footer a:hover { color: var(--gold); }
.site-footer .meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
}

/* ---------- hairlines / dividers ---------- */

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

.lattice-divider {
  height: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='28' viewBox='0 0 56 28'><g fill='none' stroke='%23D4AF37' stroke-width='0.6' opacity='0.45'><path d='M0 14 L14 0 L28 14 L42 0 L56 14'/><path d='M0 14 L14 28 L28 14 L42 28 L56 14'/></g></svg>");
  background-repeat: repeat-x;
  background-position: center;
  opacity: 0.55;
}

/* ---------- buttons / pills ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border: 1px solid var(--gold);
  color: var(--ink);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.btn:hover { background: var(--gold); color: var(--bg); }
.btn--solid { background: var(--gold); color: var(--bg); }
.btn--solid:hover { background: var(--gold-soft); color: var(--bg); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink-mid); }
.btn--ghost:hover { background: transparent; color: var(--ink); border-color: var(--gold); }
.btn .arrow { transition: transform 160ms ease; }
.btn:hover .arrow { transform: translateX(3px); }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--ink-mid);
  border-radius: 999px;
}
.pill--gold { border-color: var(--line-gold); color: var(--gold); }
.pill--confirmed { border-color: rgba(111,183,138,0.4); color: var(--status-confirmed); }
.pill--open { border-color: rgba(212,175,55,0.45); color: var(--status-open); }
.pill--refuted { border-color: rgba(197,107,92,0.45); color: var(--status-refuted); }

/* ---------- card ---------- */

.card {
  background: var(--bg-elev-1);
  border: 1px solid var(--line);
  padding: 28px;
  position: relative;
  transition: border-color 200ms ease, transform 200ms ease;
}
.card:hover { border-color: var(--line-gold); }
.card--linked { cursor: pointer; }

.card .corner {
  position: absolute;
  top: 0; left: 0;
  width: 14px; height: 14px;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  opacity: 0.7;
}

/* ---------- table ---------- */

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.tbl th, .tbl td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl th {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-bottom-color: var(--line-strong);
}
.tbl tr:hover td { background: rgba(212, 175, 55, 0.03); }

/* ---------- backgrounds ---------- */

.bg-hex {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='84' height='98' viewBox='0 0 84 98'><g fill='none' stroke='%23F5F0E6' stroke-width='0.5' opacity='0.10'><polygon points='42,2 82,25 82,73 42,96 2,73 2,25'/></g></svg>");
  background-repeat: repeat;
}
.bg-tri {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='34.6' viewBox='0 0 40 34.6'><g fill='none' stroke='%23F5F0E6' stroke-width='0.4' opacity='0.07'><path d='M0 0 L20 34.6 L40 0 Z M0 34.6 L20 0 L40 34.6 Z'/></g></svg>");
}

/* ---------- utilities ---------- */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.gap-sm { gap: 12px; }
.row { display: flex; align-items: center; gap: 16px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.col { display: flex; flex-direction: column; }

.txt-mid { color: var(--ink-mid); }
.txt-dim { color: var(--ink-dim); }
.txt-gold { color: var(--gold); }

.stack-xs > * + * { margin-top: 8px; }
.stack-sm > * + * { margin-top: 14px; }
.stack    > * + * { margin-top: 22px; }
.stack-lg > * + * { margin-top: 36px; }
.stack-xl > * + * { margin-top: 64px; }

/* ---------- mobile nav (hamburger button + drawer) ---------- */

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 0;
  position: relative;
  z-index: 60;
}
.nav-toggle .bar {
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 200ms ease, opacity 200ms ease;
  transform-origin: center;
}
body.nav-open .nav-toggle .bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
body.nav-open .nav-toggle .bar:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle .bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 64px 0 0 0;
  background: var(--bg);
  z-index: 55;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
  overflow-y: auto;
}
body.nav-open .mobile-nav {
  pointer-events: auto;
  opacity: 1;
}
.mobile-nav-inner {
  display: flex;
  flex-direction: column;
  padding: 32px 24px 64px;
  gap: 4px;
}
.mobile-nav a {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--ink);
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.01em;
}
.mobile-nav a.active { color: var(--gold); }
.mobile-nav-cta {
  margin-top: 24px;
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  color: var(--gold) !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase;
  border-bottom: none !important;
  padding: 14px 0 !important;
}

/* ---------- main responsive sweep ---------- */

@media (max-width: 1024px) {
  .site-footer .wrap--wide { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 900px) {
  /* Generic grid utilities collapse */
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }

  /* Header / nav */
  .site-header .wrap--wide {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .nav { display: none; }
  .nav-meta { display: none; }
  .nav-toggle { display: inline-flex; }
  body.nav-open { overflow: hidden; }

  /* Footer collapses to 2 columns, then 1 */
  .site-footer { padding: 40px 0 32px; margin-top: 56px; }
  .site-footer .wrap--wide {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .site-footer .meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
  }

  /* Brand wordmark scaling */
  .brand .wordmark { font-size: 17px; }
  .brand .wordmark .small { font-size: 10px; letter-spacing: 0.14em; }

  /* Wraps tighter on mobile */
  .wrap, .wrap--narrow, .wrap--wide { padding-left: 20px; padding-right: 20px; }

  /* Section heads stack */
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .section-head .eyebrow { white-space: normal; }
}

@media (max-width: 600px) {
  .site-footer .wrap--wide { grid-template-columns: 1fr; }
  .mobile-nav a { font-size: 22px; padding: 14px 4px; }
  .wrap, .wrap--narrow, .wrap--wide { padding-left: 16px; padding-right: 16px; }
}
