/* ============================================================
   treymorrow.ai — design tokens
   Theme: "Red ARES" — governed-memory / audit-log identity
   ============================================================ */

:root {
  /* Color */
  --bg:            #0b0a09;   /* near-black, warm */
  --bg-surface:    #161311;   /* card / panel surface */
  --bg-surface-2:  #1f1b18;   /* raised surface (hover, code blocks) */
  --line:          #2c2521;   /* hairline dividers */
  --red:           #b3122e;   /* garnet — primary accent, ARES mark */
  --red-bright:    #e8432f;   /* ember — hover / active state */
  --red-dim:       #5c1420;   /* muted red for backgrounds/tags */
  --text:          #ece7e1;   /* primary text */
  --text-muted:    #948d86;   /* secondary text */
  --text-faint:    #5f5a55;   /* tertiary / timestamps */

  /* Type */
  --font-display: "Space Grotesk", "Arial Narrow", sans-serif;
  --font-body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Scale */
  --step-0: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
  --step-3: clamp(2.5rem, 2rem + 2vw, 3.75rem);

  --max-w: 780px;
  --max-w-wide: 1100px;
}

@media (prefers-color-scheme: light) {
  /* Site is intentionally single-theme (dark/governance aesthetic).
     Left as a hook if a light mode is ever wanted. */
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

img { max-width: 100%; display: block; }

/* ---------- Layout shells ---------- */

.wrap {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.prose {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(11, 10, 9, 0.92);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand .mark {
  width: 9px;
  height: 9px;
  background: var(--red);
  display: inline-block;
  transform: rotate(45deg);
}

.brand .dot {
  color: var(--red);
}

nav.site-nav {
  display: flex;
  gap: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

nav.site-nav a {
  color: var(--text-muted);
  transition: color 0.15s ease;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

nav.site-nav a:hover,
nav.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* ---------- Hero ---------- */

.hero-cols {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  justify-content: space-between;
}

.hero-text { flex: 1; }

.hero-photo { flex-shrink: 0; }

.hero-photo img {
  width: 210px;
  height: 210px;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--line);
  display: block;
}

@media (max-width: 640px) {
  .hero-cols { flex-direction: column-reverse; gap: 1.5rem; }
  .hero-photo img { width: 100px; height: 100px; }
}

.hero {
  padding: 4.5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.hero .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red-bright);
  margin: 0 0 1rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
  max-width: 14ch;
}

.hero p.lede {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 55ch;
  margin: 0 0 2rem;
}

.hero .cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--line);
  display: inline-block;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn.primary {
  background: var(--red);
  border-color: var(--red);
  color: #0b0a09;
  font-weight: 700;
}

.btn.primary:hover { background: var(--red-bright); border-color: var(--red-bright); }

.btn.ghost { color: var(--text-muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--red); }

/* ---------- Signature element: the ledger ---------- */
/* A running audit-log strip, styled after ARES's own governance log.
   Grounded in the real architecture (typed memory networks + audit
   records) rather than decorative. */

.ledger {
  margin-top: 3rem;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  overflow: hidden;
}

.ledger-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ledger-head .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 0 0 rgba(232, 67, 47, 0.6);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232, 67, 47, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(232, 67, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 67, 47, 0); }
}

.ledger-row {
  display: grid;
  grid-template-columns: 8rem 6.5rem 1fr 8rem;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
}

.ledger-row:last-child { border-bottom: none; }

.ledger-row .tag {
  color: var(--red-bright);
}

.ledger-row .hash {
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .ledger-row { grid-template-columns: 5.5rem 1fr; }
  .ledger-row .hash, .ledger-row span:nth-child(2) { display: none; }
}

/* ---------- Pillars ---------- */

.pillars {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--line);
}

.pillars h2, .section-heading {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 2rem;
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.pillar {
  background: var(--bg);
  padding: 1.75rem;
}

.pillar .num {
  font-family: var(--font-mono);
  color: var(--red);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

.pillar h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
}

.pillar p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

@media (max-width: 800px) {
  .pillar-grid { grid-template-columns: 1fr; }
}

/* ---------- Blog listing ---------- */

.post-list { padding: 3rem 0; }

.post-item {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.post-item:first-of-type { border-top: 1px solid var(--line); }

.post-item .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
  padding-top: 0.3rem;
}

.post-item h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0 0 0.4rem;
  transition: color 0.15s ease;
}

.post-item a:hover h3 { color: var(--red-bright); }

.post-item p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.series-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--red-bright);
  background: var(--red-dim);
  padding: 0.15rem 0.5rem;
  margin-bottom: 0.6rem;
}

/* ---------- Post page ---------- */

.post-header {
  padding: 3.5rem 0 2rem;
  border-bottom: 1px solid var(--line);
}

.post-header .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.post-header h1 {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.post-header .dek {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 60ch;
}

article.post-body {
  padding: 3rem 0;
  font-size: 1.08rem;
}

article.post-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 2.5rem 0 1rem;
}

article.post-body h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
}

article.post-body p { margin: 0 0 1.25rem; }

article.post-body blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--red);
  color: var(--text-muted);
  font-style: italic;
}

article.post-body code {
  font-family: var(--font-mono);
  background: var(--bg-surface-2);
  padding: 0.15rem 0.4rem;
  font-size: 0.9em;
}

article.post-body pre {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  padding: 1rem;
  overflow-x: auto;
}

.series-nav {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.series-nav a:hover { color: var(--red-bright); }

/* ---------- Projects ---------- */

.project-featured {
  padding: 2rem 2.5rem;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  margin: 2rem 0 0;
}

.project-featured h2 {
  font-family: var(--font-display);
  font-size: var(--step-1);
  margin: 0.75rem 0 1rem;
}

.project-featured > p {
  color: var(--text-muted);
  margin: 0 0 1.75rem;
  max-width: 62ch;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.project-card {
  background: var(--bg);
  padding: 1.75rem;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0.5rem 0 0.6rem;
}

.project-card > p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

.repo-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.repo-link:hover { color: var(--red-bright); }

@media (max-width: 680px) {
  .project-grid { grid-template-columns: 1fr; }
  .project-featured { padding: 1.5rem; }
}

/* ---------- Background grid ---------- */

#bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 2.5rem 0 3rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--red-bright); }
