/* ═══════════════════════════════════════════════════
   raaid.net — dark terminal, editorial content
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg:             #0c0c12;
  --surface:        #181820;
  --surface-alt:    #1e1e28;
  --text:           #e2e0dc;
  --text-secondary: #b0b0b8;
  --accent:         #a89cd8;
  --accent-hover:   #c4b8f0;
  --highlight:      #ccb060;
  --border:         #252530;
  --border-card:    #353545;

  --sim-accent:     #6ea1f7;
  --sim-hover:      #5ec9b6;
  --sim-muted:      #8b8b94;
  --sim-disabled:   #3a3a48;

  --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body:    system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;

  --max-w: 800px;
}

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Base ── */
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ── Navigation ── */
.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.nav-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-name:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Hero ── */
.hero {
  display: flex;
  align-items: stretch;
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.hero-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

.hero-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.hero-body strong {
  color: var(--text);
  font-weight: 600;
}

.hero-portrait-wrap {
  flex-shrink: 0;
  width: 240px;
  min-height: 240px;
  align-self: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border-card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.hero-portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Sections ── */
section {
  margin-bottom: 3.5rem;
}

section > h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 15px;
}

/* ── Essay Cards ── */
.essay-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.essay-card {
  display: block;
  padding: 1.4rem 1.6rem;
  background: var(--surface);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.essay-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 161, 247, 0.15), 0 4px 16px rgba(110, 161, 247, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.essay-card:hover .essay-title {
  color: var(--accent);
}

.essay-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  transition: color 0.15s;
}

.essay-desc {
  display: block;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}

.essay-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ── Simulation Grid ── */
.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.sim-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.sim-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 161, 247, 0.15), 0 4px 16px rgba(110, 161, 247, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.sim-card:hover .sim-title {
  color: var(--accent);
}

.sim-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.sim-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  transition: color 0.15s;
}

.sim-desc {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── CTA Section ── */
.cta-section {
  background: var(--surface);
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 2rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.cta-section h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.cta-section p {
  color: var(--text-secondary);
  line-height: 1.8;
}

.cta-section a {
  font-weight: 600;
}

/* ── See-All Links ── */
.see-all-wrap {
  margin-top: 0.75rem;
}

.see-all {
  font-size: 15px;
  font-weight: 500;
}

/* ── Footer (new homepage) ── */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.5rem;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--accent);
}

.colophon {
  font-size: 13px;
  color: var(--text-secondary);
  opacity: 0.5;
}


/* ══════════════════════════════════════════════════════
   Section page components (essays/library/work/about)
   ══════════════════════════════════════════════════════ */

/* ── Page header (used on all section landing pages) ── */
.page-header {
  margin-bottom: 3rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-card);
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.page-intro {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.8;
  max-width: 620px;
  margin: 0.5rem 0 1.5rem;
  padding: 0.5rem 0;
}

.page-intro a {
  color: var(--accent);
}

/* ── Topic jump nav (essays page) ── */
.topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 2.5rem;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.topic-nav a {
  color: var(--highlight);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.topic-nav a:hover {
  border-bottom-color: var(--highlight);
}

/* ── Topic section heading (essays page, library categories) ── */
.topic-section {
  margin-bottom: 3rem;
}

.topic-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Essay card with optional INTERACTIVE tag ── */
.essay-card .essay-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--highlight);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.essay-card .essay-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.6rem;
}

.essay-card .essay-meta .essay-date {
  margin-top: 0;
}

/* ── Library card ── */
.lib-card {
  display: block;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-card);
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lib-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(110, 161, 247, 0.15), 0 4px 16px rgba(110, 161, 247, 0.08);
  text-decoration: none;
}

.lib-card:hover .lib-card-title {
  color: var(--accent);
}

.lib-card .lib-card-title {
  display: block;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.15s;
}

.lib-card .lib-card-author {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.lib-card .lib-card-note {
  display: block;
  margin-top: 0.6rem;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Work page sections ── */
.work-section {
  margin-bottom: 2.75rem;
}

.work-section h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.work-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 16px;
}

.work-section ul {
  list-style: none;
  padding: 0;
}

.work-section li {
  color: var(--text-secondary);
  line-height: 1.7;
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.65rem;
  font-size: 16px;
}

.work-section li::before {
  content: '→';
  color: var(--highlight);
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
}

.work-section a {
  color: var(--accent);
  font-weight: 500;
}

/* ── About page hero with portrait ── */
.about-header {
  display: flex;
  gap: 2.25rem;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-card);
}

/* ── About body content ── */
.about-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.about-body p {
  margin-bottom: 1.1rem;
}

.about-body strong {
  color: var(--text);
  font-weight: 600;
}

.about-body a {
  color: var(--accent);
}

.about-body h2 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 2.25rem 0 0.75rem;
}

.about-body ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.about-body li {
  padding-left: 1.25rem;
  position: relative;
  margin-bottom: 0.55rem;
}

.about-body li::before {
  content: '→';
  color: var(--highlight);
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
}


/* ══════════════════════════════════════════════════════
   Backward-compatible styles for existing pages
   (will be refined when we update individual pages)
   ══════════════════════════════════════════════════════ */

/* ── Back link ── */
.back-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

/* ── Pixel art sprites (existing pages until updated) ── */
.sprite {
  display: block;
  margin: 0.75rem 0 1.25rem;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Generic h1 (section landing pages: essays/, library/, etc.) ── */
h1 {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ── Horizontal rules ── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

hr.double {
  border-top: 3px double var(--border);
}

/* ── Blog/essay listing ── */
.year-label {
  font-family: var(--font-mono);
  font-weight: bold;
  color: var(--highlight);
  margin-top: 1.5rem;
  margin-bottom: 0.25rem;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.year-label:first-of-type {
  margin-top: 0.5rem;
}

.blog-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0 0.3rem 1.5rem;
}

.blog-row:hover {
  background: rgba(110, 161, 247, 0.04);
}

.blog-row a {
  flex: 1;
}

.blog-row.draft a::before {
  content: '[DRAFT] ';
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  color: var(--highlight);
  letter-spacing: 0.03em;
}

.blog-row.draft {
  opacity: 0.7;
}

.blog-row .dir-date {
  min-width: 70px;
  text-align: right;
}

/* ── Directory listing ── */
.dir-header {
  display: flex;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: bold;
  color: var(--text-secondary);
  padding: 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dir-header .col-name { flex: 1; }
.dir-header .col-date { min-width: 100px; }
.dir-header .col-desc { min-width: 200px; }

.dir-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.35rem 0;
}

.dir-row:hover {
  background: rgba(110, 161, 247, 0.04);
}

.dir-row .dir-icon {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 40px;
}

.dir-row a {
  flex: 1;
  font-family: var(--font-mono);
  font-weight: bold;
}

.dir-date {
  font-family: var(--font-mono);
  min-width: 100px;
  color: var(--text-secondary);
  font-size: 13px;
}

.dir-desc {
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

/* ── Post content ── */
.post h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.post .date {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 13px;
}

.post p {
  margin-bottom: 1rem;
}

.post h2 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
  color: var(--accent);
}

.post h3 {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.post ul, .post ol {
  margin: 0 0 1rem 1.5rem;
}

.post li {
  margin-bottom: 0.35rem;
}

.post img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.post blockquote {
  border-left: 3px solid var(--highlight);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin: 1rem 0;
  font-style: italic;
}

.post code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 3px;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.post pre code {
  background: none;
  padding: 0;
}

/* ── Library section styles ── */
.section-header {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 14px;
  margin: 2rem 0 0.5rem;
  padding: 0.35rem 0.5rem;
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--highlight);
  background: var(--surface);
}

.section-header:first-of-type {
  margin-top: 0;
}

.lib-entry {
  margin-bottom: 1rem;
  padding-left: 1rem;
}

.lib-note {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 0.15rem;
  font-style: italic;
}

/* ── Old footer (existing sub-pages) ── */
.footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  gap: 1.5rem;
}

.footer a {
  color: var(--text-secondary);
}

.footer a:hover {
  color: var(--accent);
}

/* ── Intro (legacy) ── */
.intro {
  margin: 1rem 0 2rem;
  line-height: 1.8;
}

.intro .highlight {
  color: var(--accent);
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   Responsive — tablet (≤860px) and mobile (≤640px)
   ══════════════════════════════════════════════════════ */

/* ── Tablet: stack hero, tighten spacing ── */
@media (max-width: 860px) {
  .hero {
    flex-direction: column-reverse;
    align-items: center;
    gap: 1.75rem;
    text-align: left;
  }

  .hero-content {
    width: 100%;
  }

  .hero-portrait-wrap {
    width: 240px;
    min-height: 240px;
    height: 240px;
    align-self: center;
  }

  .hero h1 {
    font-size: 30px;
    text-align: center;
  }

  .hero-body {
    text-align: center;
  }
}

/* ── Mobile (phones) ── */
@media (max-width: 640px) {
  body {
    padding: 1.5rem 1.1rem 2rem;
    font-size: 16px;
  }

  /* Navigation */
  .nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
  }

  .nav-name {
    font-size: 20px;
  }

  .nav-links {
    gap: 1.25rem;
    flex-wrap: wrap;
  }

  .nav-links a {
    font-size: 14px;
  }

  /* Hero */
  .hero {
    margin-bottom: 2.5rem;
    gap: 1.5rem;
  }

  .hero-portrait-wrap {
    width: 200px;
    min-height: 200px;
    height: 200px;
  }

  .hero h1 {
    font-size: 24px;
    line-height: 1.3;
  }

  .hero-body {
    font-size: 15px;
  }

  /* Sections */
  section {
    margin-bottom: 2.5rem;
  }

  section > h2 {
    font-size: 19px;
  }

  .section-desc {
    font-size: 14px;
  }

  /* Essay cards */
  .essay-card {
    padding: 1rem 1.1rem;
  }

  .essay-title {
    font-size: 17px;
  }

  .essay-desc {
    font-size: 14px;
  }

  /* Simulation grid → single column */
  .sim-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .sim-card {
    padding: 1.1rem;
  }

  /* CTA */
  .cta-section {
    padding: 1.4rem 1.25rem;
  }

  .cta-section h2 {
    font-size: 19px;
  }

  .cta-section p {
    font-size: 15px;
  }

  /* Footer */
  footer {
    margin-top: 3rem;
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 1rem;
  }

  /* ── Backward-compat: section landing pages ── */
  .dir-header { display: none; }

  .dir-row {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .dir-row a {
    min-width: auto;
    width: 100%;
  }

  .dir-date, .dir-desc {
    font-size: 12px;
  }

  .dir-desc {
    display: none;
  }

  .blog-row {
    padding-left: 0.5rem;
    flex-wrap: wrap;
  }

  .blog-row a {
    flex: 1 1 100%;
    min-width: 0;
  }

  .blog-row .dir-date {
    text-align: left;
  }

  /* ── Section page headers ── */
  .page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
  }

  .page-header h1 {
    font-size: 28px;
  }

  .page-intro {
    font-size: 15px;
  }

  /* ── About header stacks ── */
  .about-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
  }

  /* ── Library cards on mobile ── */
  .lib-card {
    padding: 1.1rem 1.2rem;
  }

  .lib-card .lib-card-title {
    font-size: 17px;
  }

  /* ── Work sections on mobile ── */
  .work-section h2 {
    font-size: 20px;
  }

  .work-section p,
  .work-section li {
    font-size: 15px;
  }

  /* ── About body on mobile ── */
  .about-body {
    font-size: 15px;
  }

  .about-body h2 {
    font-size: 20px;
  }

  /* ── Backward-compat: post content (essays) ── */
  .post h1 {
    font-size: 24px;
    line-height: 1.25;
  }

  .post h2 {
    font-size: 18px;
    margin-top: 1.5rem;
  }

  .post h3 {
    font-size: 16px;
  }

  .post p, .post li {
    font-size: 16px;
  }

  .post pre {
    font-size: 12px;
    padding: 0.75rem;
  }

  .post img {
    margin: 0.75rem 0;
  }
}

/* ── Very small phones (≤380px) ── */
@media (max-width: 380px) {
  .nav-links {
    gap: 0.85rem;
  }

  .hero h1 {
    font-size: 22px;
  }

  .hero-portrait-wrap {
    width: 170px;
    min-height: 170px;
    height: 170px;
  }
}
