/* SimpleAF — shared styles. Palette and type follow watchmanstower.com. */
:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-deep: #010409;
  --surface: #161b22;
  --surface-2: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --green: #3fb950;
  --green-dim: rgba(63, 185, 80, 0.15);
  --amber: #d29922;
  --mono: 'SF Mono', ui-monospace, 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Dot-grid backdrop that fades out below the fold, plus a slow drifting glow. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(rgba(139, 148, 158, 0.18) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 75%);
}

body::after {
  content: '';
  position: fixed;
  top: -30vh;
  left: 50%;
  width: 90vw;
  height: 70vh;
  z-index: -1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(31, 111, 235, 0.16), transparent);
  animation: drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  from { transform: translateX(-60%) scale(1); }
  to   { transform: translateX(-40%) scale(1.15); }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
}

.topbar .brand img { width: 26px; height: 26px; border-radius: 6px; }
.topbar .brand:hover { text-decoration: none; }

.topbar nav { display: flex; gap: 20px; }
.topbar nav a { color: var(--text-muted); }
.topbar nav a:hover, .topbar nav a[aria-current] { color: var(--text); text-decoration: none; }

/* ── Header / hero ───────────────────────────────────── */
header.hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
}

.org-name {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.05;
}

.org-name .af {
  background: linear-gradient(120deg, var(--accent) 10%, #a5d6ff 50%, var(--accent) 90%);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent); /* fallback if text clipping is unsupported */
  animation: sheen 6s linear infinite;
}

@keyframes sheen { to { background-position: -200% center; } }

.tagline {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--green);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 14px;
}

.lede {
  font-size: 1.2rem;
  line-height: 1.7;
  max-width: 640px;
  margin-top: 24px;
}

.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 6px 12px;
  background: var(--green-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--green);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6);
  animation: ping 2s ease-out infinite;
}

@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.6); }
  80%  { box-shadow: 0 0 0 8px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}

/* ── Terminal ────────────────────────────────────────── */
.terminal {
  margin-top: 40px;
  background: rgba(1, 4, 9, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(88, 166, 255, 0.04);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.terminal-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.terminal-bar span { margin-left: 8px; }

.terminal-body {
  padding: 18px 20px;
  min-height: 11.5em;
  line-height: 1.8;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-body .prompt { color: var(--green); user-select: none; }
.terminal-body .cmd { color: var(--text); }
.terminal-body .ok { color: var(--green); }
.terminal-body .warn { color: var(--amber); }
.terminal-body .key { color: var(--accent); }

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--text);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ── Sections ────────────────────────────────────────── */
section {
  padding: 48px 0;
  border-bottom: 1px solid var(--border);
}

section:last-of-type { border-bottom: none; padding-bottom: 72px; }

h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 22px;
}

h2::before { content: '// '; color: var(--accent); }

p { margin-bottom: 16px; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--text-muted); }

/* ── Cards with cursor spotlight ─────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(88, 166, 255, 0.12), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.card:hover { border-color: rgba(88, 166, 255, 0.45); transform: translateY(-2px); }
.card:hover::before { opacity: 1; }

.card h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 8px; }
.card p { font-size: 0.87rem; color: var(--text-muted); line-height: 1.55; }

.card .skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.card .skills code {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 2px 7px;
  color: var(--accent);
  background: rgba(56, 139, 253, 0.1);
  border: 1px solid rgba(56, 139, 253, 0.25);
  border-radius: 20px;
}

/* ── Ownership-chain diagram ─────────────────────────── */
.chain {
  margin-top: 28px;
  padding: 22px 12px 10px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.chain svg { display: block; width: 100%; height: auto; }
.chain .node rect { fill: #161b22; stroke: #30363d; }
.chain .node.top rect { stroke: #3fb950; }
.chain .node text { font-family: var(--mono); font-size: 11px; fill: #e6edf3; }
.chain .node text.sub { font-size: 9px; fill: #8b949e; }
.chain .edge { stroke: #58a6ff; stroke-width: 1.5; fill: none; stroke-dasharray: 4 5; animation: flow 1.2s linear infinite; }
.chain figcaption { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); text-align: center; margin-top: 10px; }

@keyframes flow { to { stroke-dashoffset: -18; } }

/* ── Lists ───────────────────────────────────────────── */
.log { list-style: none; }

.log li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}

.log li:last-child { border-bottom: none; }
.log time, .log .tag { font-family: var(--mono); font-size: 0.72rem; color: var(--text-muted); padding-top: 3px; }
.log strong { font-weight: 600; }
.log .note { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.principles { list-style: none; }

.principles li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.principles li:last-child { border-bottom: none; }
.principles .marker { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); flex-shrink: 0; }
.facts .marker { min-width: 3.5em; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); }

/* ── Receipts (subscriptions replaced) ───────────────── */
.receipt {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--bg-deep);
  border: 1px dashed var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.receipt .row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.receipt s { color: var(--text-muted); opacity: 0.7; }
.receipt .total { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--green); }

/* ── Contact ─────────────────────────────────────────── */
.contact-box {
  margin-top: 8px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.9;
}

.contact-box .prompt { color: var(--green); user-select: none; }
.contact-box .cmd { color: var(--text); }

.reveal-btn {
  font: inherit;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(56, 139, 253, 0.1);
  border: 1px solid rgba(56, 139, 253, 0.35);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.reveal-btn:hover { background: rgba(56, 139, 253, 0.2); }

/* ── Legal pages ─────────────────────────────────────── */
.legal header.hero { padding: 40px 0 32px; }
.legal .org-name { font-size: clamp(2rem, 5vw, 2.6rem); }
.legal section { padding: 32px 0; }
.legal h3 { font-size: 1rem; margin: 20px 0 8px; }
.legal ul { margin: 0 0 16px 20px; }
.legal li { margin-bottom: 8px; }
.legal p, .legal li { font-size: 0.97rem; }

.summary-box {
  margin-top: 24px;
  padding: 18px 20px;
  background: var(--green-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: 10px;
}

.summary-box ul { margin: 8px 0 0 20px; }
.summary-box li { margin-bottom: 4px; }

.meta-line { font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); margin-top: 12px; }

/* ── Footer ──────────────────────────────────────────── */
footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

footer nav { display: flex; gap: 18px; font-family: var(--mono); font-size: 0.75rem; }
footer nav a { color: var(--text-muted); }
footer nav a:hover { color: var(--text); }

/* ── Scroll-in reveal (only when JS has marked the page) ─ */
.js .fade { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .fade.in { opacity: 1; transform: none; }

@media (max-width: 640px) {
  header.hero { padding: 36px 0; }
  .grid { grid-template-columns: 1fr; }
  section { padding: 36px 0; }
  .lede { font-size: 1.05rem; }
  .log li { grid-template-columns: 1fr; gap: 2px; }
  .topbar nav { gap: 14px; }
  .terminal { font-size: 0.72rem; }
}

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