/* ═══════════════════════════════════════════════════════════════
   C64 COPY PROTECTION REFERENCE — Shared Stylesheet
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #fdf9f4;
  --bg-alt: #f5efe6;
  --bg-dark: #1c1917;
  --ink: #1c1917;
  --ink-muted: #57534e;
  --ink-faint: #a8a29e;
  --rust: #b45309;
  --rust-light: #fef3c7;
  --crimson: #9b1c1c;
  --navy: #1e3a5f;
  --teal: #0f766e;
  --border: #e7ddd1;
  --border-dark: #c9b99a;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 1.17rem;
  line-height: 1.8;
}

/* ─── TYPOGRAPHY ─── */
h1, h2, h3, h4 {
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.8rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 700;
  color: var(--navy);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-dark);
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rust);
  font-family: system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

h4 {
  font-size: 1.17rem;
  font-weight: 700;
  color: var(--ink);
  font-family: system-ui, -apple-system, sans-serif;
}

p { color: var(--ink); margin-bottom: 1rem; }

a { color: var(--navy); }
a:hover { color: var(--rust); }

code, .mono {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82em;
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--crimson);
}

pre {
  background: #18181b;
  color: #e4e4e7;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8em;
  line-height: 1.6;
  overflow-x: auto;
  border-left: 4px solid var(--rust);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ─── NAVBAR ─── */
#mainNav {
  background: var(--ink);
  border-bottom: 3px solid var(--rust);
  position: sticky;
  top: 0;
  z-index: 1000;
}

#mainNav .navbar-brand {
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-style: italic;
  color: #fef3c7 !important;
  letter-spacing: 0.03em;
}

#mainNav .nav-link {
  color: #d6d3d1 !important;
  font-size: 0.78rem;
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem !important;
  transition: color 0.2s;
}
#mainNav .nav-link:hover { color: #fef3c7 !important; }

/* ─── HERO ─── */
#hero {
  background: var(--ink);
  color: white;
  padding: 1.0rem 0 0.8rem;
  position: relative;
  overflow: hidden;
}

#hero h1 {
  color: #fdf9f4;
  font-size: clamp(1.4rem, 2.6vw, 2.0rem) !important;
}

#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 80% 50%, rgba(180,83,9,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(30,58,95,0.15) 0%, transparent 50%);
  pointer-events: none;
}

.hero-kicker {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.3rem;
  display: block;
}

.hero-lead {
  font-size: 0.97rem;
  color: #d6d3d1;
  max-width: 640px;
  line-height: 1.6;
}

.hero-meta {
  font-size: 0.82rem;
  color: #78716c;
  font-family: system-ui, -apple-system, sans-serif;
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid #292524;
}

/* ─── INDEX CARDS ─── */
.doc-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.8rem 2rem;
  text-decoration: none;
  display: block;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
  height: 100%;
}

.doc-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.10);
  border-color: var(--border-dark);
  transform: translateY(-2px);
  color: inherit;
}

.doc-card.accent-rust  { border-top: 4px solid var(--rust); }
.doc-card.accent-navy  { border-top: 4px solid var(--navy); }
.doc-card.accent-teal  { border-top: 4px solid var(--teal); }
.doc-card.accent-crimson { border-top: 4px solid var(--crimson); }
.doc-card.accent-purple  { border-top: 4px solid #7c3aed; }
.doc-card.accent-amber   { border-top: 4px solid #d97706; }

.doc-number {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  color: var(--ink-faint);
  font-weight: 500;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 0.5rem;
}

.doc-card h3 {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 0.6rem;
}

.doc-card p {
  font-size: 1.02rem;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.doc-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
}

.doc-topic {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  background: var(--bg-alt);
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 7px;
}

.doc-card:hover .doc-topic { border-color: var(--border-dark); }

.doc-arrow {
  display: inline-block;
  margin-left: 0.3em;
  transition: transform 0.15s;
}

.doc-card:hover .doc-arrow { transform: translateX(4px); }

/* ─── CONTENT LAYOUT ─── */
.intro-banner {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 3rem;
}

.intro-banner p:last-child { margin-bottom: 0; }

.content h2 { margin-top: 3rem; }
.content h2:first-of-type { margin-top: 0; }

/* ─── FOOTNOTES ─── */
.footnote-ref {
  font-size: 0.7em;
  vertical-align: super;
  color: var(--rust);
  text-decoration: none;
  font-weight: 600;
}

.footnote-ref:hover { color: var(--crimson); }

.footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.footnotes li { margin-bottom: 0.6rem; }

/* ─── TABLES ─── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-alt);
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
}

tr:last-child td { border-bottom: none; }

/* ─── SIDEBAR ─── */
.sidebar {
  background: var(--bg-alt);
  border-left: 4px solid var(--rust);
  border-radius: 6px;
  padding: 1.5rem;
  margin: 2rem 0;
}

.sidebar h4 {
  color: var(--rust);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.sidebar p:last-child { margin-bottom: 0; }

/* ─── IMAGE FIGURES ─── */
figure {
  margin: 2rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

figcaption {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-top: 0.8rem;
  font-style: italic;
}

/* ─── BLOCKQUOTES ─── */
blockquote {
  background: var(--bg-alt);
  border-left: 4px solid var(--navy);
  margin: 1.5rem 0;
  padding: 1.2rem 1.5rem;
  border-radius: 4px;
}

blockquote p { margin-bottom: 0; color: var(--ink-muted); }

/* ─── LISTS ─── */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

li { margin-bottom: 0.5rem; }

/* ─── SECTION RULE ─── */
.section-rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ─── FOOTER ─── */
footer {
  background: #2b2926;
  color: #d6d3d1;
  padding: 3rem 0 2rem;
  margin-top: 4rem;
  border-top: 3px solid var(--rust);
  font-size: 0.95rem;
  line-height: 1.7;
}

footer a { color: #fef3c7; }
footer a:hover { color: white; }

footer strong {
  color: #e7e5e4;
  font-family: Georgia, serif;
  font-size: 1.1rem;
}

footer .mt-2 { margin-top: 0.8rem !important; }
footer .mt-3 { margin-top: 1.5rem !important; }

footer em { font-style: italic; }

/* ─── BACK TO TOP BUTTON ─── */
#backToTop:hover { background: #92400e !important; transform: translateY(-2px); }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  h2 { margin-top: 2rem; }
  
  .intro-banner {
    padding: 1.5rem;
  }
  
  table {
    font-size: 0.95rem;
  }
  
  th, td {
    padding: 0.8rem;
  }
}
