/* ============================================================
   Tapestry Engine — shared site styles
   ============================================================ */

:root {
  /* Core palette */
  --bg:           #0a1124;
  --bg-elev:      #111a37;
  --bg-card:      #15203f;
  --bg-card-hi:  #1b2a52;
  --border:       #25315c;
  --border-hi:    #3a4a82;

  /* Brand */
  --gold:         #e8b75a;
  --gold-2:       #f3c873;
  --gold-dim:     #b4863c;
  --gold-glow:    rgba(232,183,90,0.18);
  --indigo:       #6b7fe0;
  --indigo-2:     #8a9bef;
  --indigo-dim:   #4b5dba;
  --indigo-glow:  rgba(107,127,224,0.18);

  /* Type */
  --text:         #e8ebf5;
  --text-dim:     #a3acca;
  --text-muted:   #6c769a;
  --text-faint:   #4a547a;

  /* Semantic */
  --ok:           #7ad3a5;
  --warn:         #f0b96a;
  --err:          #ed7a8a;

  --radius:       10px;
  --radius-lg:    14px;
  --radius-sm:    6px;

  --font-sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', ui-monospace, Menlo, monospace;

  --shadow-card: 0 1px 0 0 rgba(255,255,255,0.03) inset, 0 12px 32px -16px rgba(0,0,0,0.5);
  --shadow-pop:  0 20px 60px -20px rgba(0,0,0,0.6), 0 0 0 1px var(--border);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Tapestry weave texture — very subtle background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    /* vertical indigo threads */
    linear-gradient(90deg, transparent 0, transparent calc(50% - 0.5px), rgba(107,127,224,0.04) calc(50% - 0.5px), rgba(107,127,224,0.04) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    /* horizontal gold threads */
    linear-gradient(0deg, transparent 0, transparent calc(50% - 0.5px), rgba(232,183,90,0.025) calc(50% - 0.5px), rgba(232,183,90,0.025) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  background-size: 56px 56px, 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 0%, transparent 75%);
}

/* Soft glow blobs (added per-page if wanted) */
.glow-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.glow-bg::before, .glow-bg::after {
  content: '';
  position: absolute;
  width: 60vw; height: 60vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
}
.glow-bg::before {
  top: -25vw; left: -15vw;
  background: radial-gradient(circle, var(--indigo-glow), transparent 70%);
}
.glow-bg::after {
  top: 15vh; right: -20vw;
  background: radial-gradient(circle, var(--gold-glow), transparent 70%);
  opacity: 0.25;
}

/* ============================================================
   Layout
   ============================================================ */

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

.wrap-narrow {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 32px;
}

section { position: relative; z-index: 1; }

/* ============================================================
   Top navigation
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 17, 36, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(37, 49, 92, 0.6);
}
.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.nav-brand svg { width: 28px; height: 28px; flex: none; }
.nav-brand .nb-name { font-weight: 600; }
.nav-brand .nb-sub { color: var(--text-muted); font-weight: 400; font-size: 12px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 999px; margin-left: 4px; font-family: var(--font-mono); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-links a.active { color: var(--gold); background: rgba(232,183,90,0.08); }
.nav-links a.ext::after {
  content: '↗';
  font-size: 11px;
  opacity: 0.6;
  margin-left: 1px;
}
.nav-spacer { flex: 1; }
.nav-cta {
  font-size: 13px;
  padding: 8px 14px;
  background: var(--gold);
  color: #0a1124;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 600;
  transition: background .15s, transform .1s;
}
.nav-cta:hover { background: var(--gold-2); }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: #0a1124;
}
.btn-primary:hover { background: var(--gold-2); }
.btn-secondary {
  background: transparent;
  border-color: var(--border-hi);
  color: var(--text);
}
.btn-secondary:hover { background: rgba(255,255,255,0.04); border-color: var(--indigo-dim); color: var(--text); }
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 8px 12px;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ============================================================
   Headings / text
   ============================================================ */

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(40px, 4.8vw, 60px); letter-spacing: -0.03em; }
h2 { font-size: clamp(28px, 3.2vw, 40px); letter-spacing: -0.025em; }
h3 { font-size: 20px; }
p { margin: 0; color: var(--text-dim); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.eyebrow::before {
  content: '';
  width: 10px; height: 1px;
  background: var(--gold);
}

.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
}

.lead {
  font-size: 19px;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 640px;
}

code, .mono { font-family: var(--font-mono); }
.inline-code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(107,127,224,0.1);
  color: var(--indigo-2);
  border: 1px solid rgba(107,127,224,0.18);
}

.dim { color: var(--text-dim); }
.muted { color: var(--text-muted); }
.gold { color: var(--gold); }
.indigo { color: var(--indigo-2); }

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.card-row {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 880px) {
  .card-row { grid-template-columns: 1fr; }
}

/* ============================================================
   Terminal
   ============================================================ */

.terminal {
  background: linear-gradient(180deg, #0d1530 0%, #0b1128 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  font-family: var(--font-mono);
  font-size: 13.5px;
  position: relative;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
}
.term-dot { width: 11px; height: 11px; border-radius: 50%; background: #2a3463; }
.term-dot.r { background: #cf5a6b; }
.term-dot.y { background: #c99850; }
.term-dot.g { background: #5fae84; }
.term-title {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}
.term-body {
  padding: 20px 22px 24px;
  line-height: 1.7;
  color: var(--text);
  min-height: 200px;
}
.term-line { display: block; white-space: pre-wrap; }
.term-prompt { color: var(--indigo-2); user-select: none; }
.term-cmd { color: var(--text); }
.term-flag { color: var(--gold); }
.term-arg { color: var(--indigo-2); }
.term-out { color: var(--text-dim); }
.term-ok { color: var(--ok); }
.term-warn { color: var(--warn); }
.term-comment { color: var(--text-muted); font-style: italic; }
.term-cursor {
  display: inline-block;
  width: 8px; height: 16px;
  background: var(--gold);
  vertical-align: -3px;
  margin-left: 2px;
  animation: blink 1.1s steps(2) infinite;
}
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* ============================================================
   Footer
   ============================================================ */

.footer {
  margin-top: 120px;
  padding: 56px 0 48px;
  border-top: 1px solid var(--border);
  background: rgba(10, 17, 36, 0.6);
  position: relative;
  z-index: 1;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}
@media (max-width: 880px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
.footer h4 {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.footer a:hover { color: var(--text); }
.footer-meta {
  max-width: 1240px;
  margin: 40px auto 0;
  padding: 24px 32px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   Misc utilities
   ============================================================ */

.divider { height: 1px; background: var(--border); margin: 60px 0; }
.section-pad { padding: 96px 0; }
.section-pad-sm { padding: 60px 0; }

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(107,127,224,0.1);
  color: var(--indigo-2);
  border: 1px solid rgba(107,127,224,0.22);
}
.tag-pill.gold { background: rgba(232,183,90,0.08); color: var(--gold); border-color: rgba(232,183,90,0.22); }
.tag-pill.green { background: rgba(122,211,165,0.08); color: var(--ok); border-color: rgba(122,211,165,0.22); }
.tag-pill.gray { background: rgba(255,255,255,0.04); color: var(--text-dim); border-color: var(--border); }

/* Anchor scroll offset under sticky nav */
:target { scroll-margin-top: 84px; }

/* Selection */
::selection { background: rgba(232,183,90,0.32); color: var(--text); }
