/* Mandala — "The Operator's Ledger"
   Brand system: Ink / Paper / Vermilion (seal only).
   Faces: Fraunces (voice) + JetBrains Mono (operator). No third face.  */

:root {
  --paper: #F7F4EE;
  --ink: #16171B;
  --ink-ground: #141519;
  --paper-on-ink: #ECE7DC;
  --verm: #E4472B;
  --verm-on-ink: #F0583C;
  --muted: #6E6B63;
  --muted-on-ink: #9B978C;
  --hairline: rgba(22, 23, 27, 0.16);
  --hairline-on-ink: rgba(236, 231, 220, 0.18);
  --rule: #16171B;
  --fb: #1877F2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-size: 17px;
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.ink {
  background: var(--ink-ground);
  color: var(--paper-on-ink);
  --hairline: var(--hairline-on-ink);
  --muted: var(--muted-on-ink);
  --verm: var(--verm-on-ink);
  --rule: var(--paper-on-ink);
}

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 560; line-height: 1.08; letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
a { color: inherit; }
.mono, code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
}
code { background: transparent; padding: 0; }
.muted { color: var(--muted); }
.label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Header / footer ---------- */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand svg { display: block; }
.brand .mark-stroke { stroke: currentColor; }
.brand .mark-bindu { fill: var(--verm); }
.wordmark { font-family: "Fraunces", Georgia, serif; font-size: 1.3rem; font-weight: 560; letter-spacing: -0.01em; }
.site-header nav { display: flex; gap: 26px; align-items: center; }
.site-header nav a {
  font-family: "JetBrains Mono", monospace; font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.site-header nav a:hover { color: inherit; }
.site-header nav a.danger:hover { color: var(--verm); }
.user-name { font-family: "JetBrains Mono", monospace; font-size: 0.72rem; color: inherit; }

.site-footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 26px clamp(20px, 4vw, 48px);
  border-top: 1px solid var(--hairline);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: inherit; }

.page { flex: 1; width: 100%; }

/* ---------- Landing: asymmetric hero ---------- */
.hero-wrap {
  max-width: 1280px; margin: 0 auto;
  padding: clamp(48px, 9vh, 110px) clamp(20px, 4vw, 48px) 40px;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 6vw, 96px); align-items: center;
}
.hero-copy .label { display: block; margin-bottom: 26px; }
.hero-copy .label::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--verm); margin-right: 10px; vertical-align: 1px; }
.hero-copy h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  max-width: 13ch;
}
.hero-copy .lede {
  color: var(--muted); font-size: 1.02rem; line-height: 1.65;
  max-width: 46ch; margin: 26px 0 36px;
}
.fineprint {
  font-family: "JetBrains Mono", monospace; font-size: 0.68rem; line-height: 1.7;
  color: var(--muted); max-width: 52ch; margin-top: 20px;
}
.fineprint code { font-size: inherit; color: inherit; }

.fb-login {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--fb); color: #fff; text-decoration: none;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600; font-size: 0.98rem; padding: 14px 26px; border-radius: 7px;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s;
}
.fb-login:hover { background: #1465CF; }
.fb-login:active { transform: translateY(1px) scale(0.99); }

/* The mark, drawn as its own blueprint */
.hero-mark { position: relative; display: grid; place-items: center; }
.hero-mark svg { width: min(400px, 82%); height: auto; display: block; }
.blueprint-grid line { stroke: currentColor; opacity: 0.05; stroke-width: 0.25; }
.mark-circle, .mark-square { stroke: currentColor; fill: none; }
.mark-circle { stroke-width: 3.4; stroke-dasharray: 277; stroke-dashoffset: 0; }
.mark-square { stroke-width: 2.6; stroke-dasharray: 249; stroke-dashoffset: 0; }
.mark-bindu-hero { fill: var(--verm); transform-origin: 50px 50px; }

@media (prefers-reduced-motion: no-preference) {
  .mark-circle { animation: draw 1.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .mark-square { animation: draw 1.3s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .mark-bindu-hero { animation: bindu-in 0.5s 1.15s cubic-bezier(0.34, 1.4, 0.64, 1) both, breathe 4.5s 2s ease-in-out infinite; }
  @keyframes draw { from { stroke-dashoffset: 277; } to { stroke-dashoffset: 0; } }
  @keyframes bindu-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
  @keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
  .reveal { animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .reveal:nth-child(2) { animation-delay: 0.08s; }
  .reveal:nth-child(3) { animation-delay: 0.16s; }
  .reveal:nth-child(4) { animation-delay: 0.24s; }
  .reveal:nth-child(5) { animation-delay: 0.32s; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
}

/* The ledger strip: a true sequence, so it is numbered */
.ledger {
  max-width: 1280px; margin: 0 auto;
  padding: 20px clamp(20px, 4vw, 48px) clamp(56px, 9vh, 110px);
}
.ledger-row {
  display: grid; grid-template-columns: 110px minmax(0, 1fr);
  gap: 20px; align-items: baseline;
  padding: 22px 0; border-top: 1px solid var(--hairline);
}
.ledger-row:last-child { border-bottom: 1px solid var(--hairline); }
.ledger-no {
  font-family: "JetBrains Mono", monospace; font-size: 0.72rem;
  letter-spacing: 0.14em; color: var(--muted);
}
.ledger-no .seal-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--verm); margin-left: 8px; vertical-align: 1px; }
.ledger-row strong { font-weight: 560; font-size: 1.05rem; letter-spacing: -0.01em; }
.ledger-row span { color: var(--muted); font-size: 0.94rem; display: block; max-width: 62ch; }

/* ---------- Dashboard: the ledger itself ---------- */
.dash { max-width: 1160px; margin: 0 auto; padding: clamp(28px, 5vh, 56px) clamp(20px, 4vw, 48px) 72px; }
.section { margin-bottom: clamp(40px, 7vh, 64px); }
.section-rule {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  border-bottom: 2px solid var(--rule); padding-bottom: 12px; margin-bottom: 8px;
}
.section-rule h2 { font-size: 1.55rem; }
.range { font-family: "JetBrains Mono", monospace; font-size: 0.68rem; letter-spacing: 0.08em; color: var(--muted); }

.business-list { list-style: none; margin: 0; padding: 0; }
.business-list li {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
}
.business-list strong { font-weight: 560; font-size: 1.02rem; }
.business-list .mono { color: var(--muted); }
.badge {
  font-family: "JetBrains Mono", monospace; font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 3px 10px;
  color: var(--muted);
}
.badge.ok { color: var(--ink); border-color: var(--ink); }
.badge.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--verm); margin-right: 7px; vertical-align: 0.5px; }

.picker { display: flex; gap: 22px; flex-wrap: wrap; }
.picker label { display: flex; flex-direction: column; gap: 5px; }
.picker .label { font-size: 0.6rem; }
.picker select {
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem;
  padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 5px;
  background: transparent; color: inherit; max-width: 320px;
}

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  column-gap: clamp(20px, 3vw, 48px); margin-top: 8px;
}
.stat { border-top: 1px solid var(--hairline); padding: 14px 0 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-family: "JetBrains Mono", monospace; font-size: 0.62rem; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat-value {
  font-family: "JetBrains Mono", monospace; font-weight: 500;
  font-size: clamp(1.25rem, 2.2vw, 1.7rem); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.table-scroll { overflow-x: auto; margin-top: 6px; }
table { border-collapse: collapse; width: 100%; }
th {
  text-align: left; font-family: "JetBrains Mono", monospace;
  font-size: 0.62rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule);
}
td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--hairline); font-size: 0.95rem; }
td.num, th.num { text-align: right; }
td.num { font-family: "JetBrains Mono", monospace; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.error-inline { color: var(--verm); font-family: "JetBrains Mono", monospace; font-size: 0.8rem; }
.empty { color: var(--muted); padding: 18px 0; border-top: 1px solid var(--hairline); }

/* ---------- Documents ---------- */
.doc { max-width: 640px; margin: 0 auto; padding: clamp(40px, 7vh, 80px) 24px 80px; }
.doc h1 { font-size: 2.1rem; margin-bottom: 10px; }
.doc h2 { font-size: 1.25rem; margin: 36px 0 10px; }
.doc p, .doc li { font-size: 0.98rem; }
.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc .muted { font-family: "JetBrains Mono", monospace; font-size: 0.7rem; letter-spacing: 0.06em; }
.doc a { color: inherit; text-decoration-color: var(--verm); }
.btn {
  display: inline-block; background: var(--ink); color: var(--paper); text-decoration: none;
  font-family: "JetBrains Mono", monospace; font-size: 0.78rem; letter-spacing: 0.06em;
  padding: 11px 22px; border-radius: 6px; margin-top: 10px;
}
body.ink .btn { background: var(--paper-on-ink); color: var(--ink-ground); }

/* ---------- Responsive collapse ---------- */
@media (max-width: 860px) {
  .hero-wrap { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-mark { order: -1; }
  .hero-mark svg { width: min(220px, 55%); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ledger-row { grid-template-columns: 64px 1fr; }
}

:focus-visible { outline: 2px solid var(--verm); outline-offset: 2px; }
