/* =====================================================
   Zero-Downtime Schema Migration Guide — main.css
   Color palette:
     --wheat:   #F5DEB3  (background, light surfaces)
     --cream:   #FAF3E0  (page background)
     --charcoal:#36454F  (primary text, headings)
     --rust:    #8B3A3A  (accent, links, highlights)
     --rust-dk: #6B2A2A  (hover rust)
     --sand:    #E8D5A3  (borders, alt row)
     --mist:    #EEE8DC  (code background, subtle fills)
   ===================================================== */

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  background-color: #FAF3E0;
  color: #36454F;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === CSS CUSTOM PROPERTIES === */
:root {
  --wheat:   #F5DEB3;
  --cream:   #FAF3E0;
  --charcoal:#36454F;
  --rust:    #8B3A3A;
  --rust-dk: #6B2A2A;
  --sand:    #E8D5A3;
  --mist:    #EEE8DC;
  --header-h: 68px;
  --max-w: 1400px;
  --radius: 6px;
  --transition: 0.2s ease;
}

/* === TYPOGRAPHY === */
h1,h2,h3,h4,h5,h6 {
  font-family: Georgia, serif;
  color: var(--charcoal);
  line-height: 1.25;
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--rust); margin-top: 0.5em; }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.9rem); border-bottom: 2px solid var(--sand); padding-bottom: 0.25em; }
h2:not(:first-child) { margin-top: 2.2em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); color: var(--rust); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1.2em; }

strong { color: var(--charcoal); font-weight: 700; }

/* === IN-PAGE ANCHOR OFFSET (sticky header) === */
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* === LAYOUT === */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

/* === STICKY HEADER === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--charcoal);
  height: var(--header-h);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.header-inner {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo img {
  height: 42px;
  width: auto;
  filter: brightness(1.1);
}
.site-logo span {
  font-family: Georgia, serif;
  font-size: 1.05rem;
  color: var(--wheat);
  font-weight: 700;
  line-height: 1.2;
  display: none;
}
@media(min-width: 900px) { .site-logo span { display: block; } }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  color: var(--wheat);
  text-decoration: none;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-link .nav-icon { font-size: 1.1rem; }
.nav-link:hover, .nav-link.active {
  background: var(--rust);
  color: #fff;
}
.nav-link.active {
  background: var(--rust);
  font-weight: 700;
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--wheat);
  border-radius: 4px;
  color: var(--wheat);
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: auto;
  transition: background var(--transition);
}
.nav-toggle:hover { background: var(--rust); border-color: var(--rust); }

@media(max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--charcoal);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1rem;
    gap: 0.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  }
  .site-nav.open { display: flex; }
  .nav-link { font-size: 1rem; padding: 0.6rem 1rem; }
}

/* === FOOTER === */
.site-footer {
  background: var(--charcoal);
  color: var(--wheat);
  padding: 2.5rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  color: var(--wheat);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(245,222,179,0.25);
  padding-bottom: 0.4rem;
}
.footer-col a {
  display: block;
  color: var(--sand);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.2rem 0;
  transition: color var(--transition);
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
  max-width: var(--max-w);
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(245,222,179,0.2);
  font-size: 0.8rem;
  color: var(--sand);
  opacity: 0.8;
}

/* === BREADCRUMBS === */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 2rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--sand);
}
.breadcrumbs a { color: var(--rust); text-decoration: none; transition: color var(--transition); }
.breadcrumbs a:hover { color: var(--rust-dk); text-decoration: underline; }
.breadcrumbs .sep { color: #bbb; margin: 0 0.15rem; }
.breadcrumbs .current { color: var(--charcoal); font-weight: 600; }

/* === LINKS === */
a { color: var(--rust); transition: color var(--transition); }
a:hover { color: var(--rust-dk); }

article a, .prose a {
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 3px;
}
article a:hover, .prose a:hover { color: var(--rust-dk); }

/* === CODE BLOCKS === */
pre {
  position: relative;
  background: #2b303b !important;
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-left: 4px solid var(--rust);
  font-size: 0.88rem;
  line-height: 1.6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

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

.copy-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: var(--rust);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: sans-serif;
  transition: background var(--transition), opacity var(--transition);
  opacity: 0.75;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--rust-dk); }
.copy-btn.copied { background: #4a7c59; opacity: 1; }

/* Inline code */
code {
  background: var(--mist);
  color: var(--rust-dk);
  padding: 0.15em 0.45em;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: 'Courier New', Courier, monospace;
  border: 1px solid var(--sand);
}

/* === SYNTAX HIGHLIGHT OVERRIDES (Prism) === */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #65737e; font-style: italic; }
.token.keyword { color: #bf616a; }
.token.string { color: #a3be8c; }
.token.number { color: #d08770; }
.token.function { color: #8fa1b3; }
.token.operator { color: #ebcb8b; }
.token.punctuation { color: #c0c5ce; }
.token.class-name, .token.builtin { color: #ebcb8b; }

/* === TABLES === */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 400px;
}

thead tr {
  background: var(--charcoal);
  color: var(--wheat);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.03em;
}

tbody tr:nth-child(even) { background: var(--mist); }
tbody tr:nth-child(odd)  { background: #fff; }
tbody tr:hover { background: var(--sand); }

td, th { padding: 0.65rem 1rem; border-bottom: 1px solid var(--sand); }

/* === INTERACTIVE CHECKBOXES === */
ul:has(li > input[type="checkbox"]),
ul.contains-task-list {
  list-style: none;
  padding-left: 0.25rem;
}

li:has(> input[type="checkbox"]),
li.task-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.2rem 0;
  cursor: pointer;
}

li input[type="checkbox"] {
  margin-top: 0.3rem;
  flex-shrink: 0;
  accent-color: var(--rust);
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

li.checked > span,
li:has(input:checked) > span,
li:has(input:checked) {
  text-decoration: line-through;
  opacity: 0.6;
}

/* === ACCORDIONS (FAQ) === */
details {
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: #fff;
  overflow: hidden;
}

details summary {
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--charcoal);
  font-family: Georgia, serif;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
  gap: 1rem;
}
details summary:hover { background: var(--mist); }
details summary::after {
  content: '＋';
  color: var(--rust);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
details[open] > summary { background: var(--mist); border-bottom: 1px solid var(--sand); }
details[open] > summary::after { content: '－'; }

details .details-body { padding: 1rem 1.2rem; }

/* === MERMAID DIAGRAMS === */
.mermaid {
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* === HERO SECTION (home page) === */
.hero {
  background: linear-gradient(135deg, var(--charcoal) 0%, #4a5f6b 100%);
  color: var(--wheat);
  padding: 5rem 2rem 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%238B3A3A' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
  opacity: 0.4;
}
.hero-inner {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  color: var(--wheat);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
  margin-bottom: 1rem;
}
.hero .tagline {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--sand);
  margin-bottom: 1.5rem;
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}
.hero-desc {
  font-size: 1rem;
  color: rgba(245,222,179,0.85);
  max-width: 65ch;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius);
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.28);
}
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: var(--rust-dk); color: #fff; }
.btn-secondary { background: rgba(245,222,179,0.15); color: var(--wheat); border: 2px solid var(--sand); }
.btn-secondary:hover { background: rgba(245,222,179,0.28); color: #fff; }
.btn-accent { background: #5a7f6a; color: #fff; }
.btn-accent:hover { background: #3d6451; color: #fff; }
.btn-icon { font-size: 1.2rem; }

/* === CATEGORY CARDS === */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.category-card {
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(139,58,58,0.15);
  border-color: var(--rust);
  color: inherit;
}
.card-icon { font-size: 2.2rem; }
.card-title {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--charcoal);
}
.card-desc { font-size: 0.9rem; color: #666; line-height: 1.5; }

/* === SUBTOPIC LIST === */
.subtopic-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.subtopic-list li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--charcoal);
  font-family: Georgia, serif;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.subtopic-list li a:hover {
  background: var(--mist);
  border-color: var(--rust);
  transform: translateX(4px);
  color: var(--rust);
}
.subtopic-list li a::before { content: '→'; color: var(--rust); font-size: 0.9rem; }

/* === ARTICLE META / RELATED === */
.related-links {
  background: var(--mist);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 3rem;
}
.related-links h3 {
  font-size: 1rem;
  color: var(--charcoal);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
}
.related-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.related-links ul li a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: #fff;
  border: 1px solid var(--rust);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--rust);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.related-links ul li a:hover { background: var(--rust); color: #fff; }

/* === PHASE BADGE === */
.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--rust);
  color: #fff;
  border-radius: 20px;
  padding: 0.2rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  font-family: sans-serif;
}

/* === FEATURED LINKS STRIP === */
.featured-links {
  margin: 3rem 0 2rem;
}
.featured-links h2 {
  font-size: 1.4rem;
  color: var(--charcoal);
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--sand);
  padding-bottom: 0.4rem;
}
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.featured-item {
  background: #fff;
  border-left: 4px solid var(--rust);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  color: var(--charcoal);
  font-size: 0.9rem;
  transition: background var(--transition), transform var(--transition);
  display: block;
  font-family: Georgia, serif;
}
.featured-item:hover {
  background: var(--mist);
  transform: translateX(3px);
  color: var(--rust);
}

/* === UTILITY === */
.section-intro {
  font-size: 1.05rem;
  color: #555;
  margin-bottom: 2rem;
  line-height: 1.75;
}

.page-title { margin-bottom: 0.25rem; }
.page-subtitle {
  font-size: 1.05rem;
  font-family: sans-serif;
  color: #666;
  margin-bottom: 1.5rem;
  font-weight: normal;
}

hr { border: none; border-top: 2px solid var(--sand); margin: 2.5rem 0; }

blockquote {
  border-left: 4px solid var(--rust);
  padding: 0.75rem 1.25rem;
  background: var(--mist);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  margin: 1.5rem 0;
  color: #555;
}
blockquote p { margin: 0; max-width: none; }

ul, ol { padding-left: 1.5rem; margin-bottom: 1.2em; }
li { margin-bottom: 0.35em; }

img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* === RESPONSIVE === */
@media(max-width: 640px) {
  main { padding: 1.25rem 1rem 3rem; }
  .hero { padding: 3.5rem 1rem 3rem; }
  .btn { padding: 0.7rem 1.2rem; font-size: 0.88rem; }
  pre { font-size: 0.8rem; padding: 1rem; }
  .header-inner { padding: 0 1rem; }
}

@media(min-width: 1200px) {
  main { padding: 2.5rem 3rem 5rem; }
}

