/* Reset & Base Variables */
:root {
    --bg-color: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --bg-sidebar: #f9fafb;
    --brand-color: #2563eb; /* Overwritten by layout template */
    --brand-hover: #1d4ed8;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --sidebar-width: 280px;
    --header-height: 60px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text-color);
    background: var(--bg-color);
    line-height: 1.6;
    font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: #111827;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    line-height: 1.3;
}

h1 { font-size: 2.25rem; margin-top: 0; }
h2 { 
    font-size: 1.75rem; 
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 0.3em; 
    margin-top: 2em; /* More space for legal headers */
}
h3 { font-size: 1.5rem; }

a { color: var(--brand-color); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: var(--font-mono);
    background: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #db2777; /* Pinkish for code */
}

pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
}
pre code { background: transparent; color: inherit; padding: 0; }

/* Layout Grid */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.site-header {
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(5px);
    z-index: 50;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #111827;
    text-decoration: none;
}

.logo-icon {
    background: var(--brand-color);
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* Sidebar & Content */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.sidebar {
    width: var(--sidebar-width);
    border-right: 1px solid var(--border-color);
    background: var(--bg-sidebar);
    padding: 20px 0;
    overflow-y: auto;
    height: calc(100vh - var(--header-height));
    position: sticky;
    top: var(--header-height);
}

.content-area {
    flex: 1;
    padding: 40px;
    max-width: 900px; /* Optimal reading width */
}

/* Nav Styles */
.nav-section { margin-bottom: 25px; padding: 0 20px; }
.nav-category {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    font-weight: 700;
}
.nav-list ul { list-style: none; padding: 0; margin: 0; }
.nav-list li { margin-bottom: 4px; }
.nav-list a {
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.95rem;
}
.nav-list a:hover { background: #e5e7eb; text-decoration: none; }
.nav-list a.active {
    background: #eff6ff;
    color: var(--brand-color);
    font-weight: 500;
}

/* Footer */
.page-footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--brand-color);
    color: white;
    padding: 8px;
    z-index: 100;
}
.skip-link:focus { top: 0; }

/* Mobile Support */
#menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-color); }

@media (max-width: 850px) {
    .sidebar {
        position: fixed;
        left: -100%;
        top: var(--header-height);
        width: 100%;
        z-index: 40;
        transition: left 0.3s ease;
        border-right: none;
    }
    .sidebar.open { left: 0; }
    #menu-toggle { display: block; }
    .content-area { padding: 20px; }
}

/* Ad Units */
.ad-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  min-height: 90px;
  background-color: #f9fafb; /* Subtle placeholder background */
}

.ad-sidebar {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 250px;
  background-color: #f9fafb;
  border-radius: 8px;
}


/* Make legal pages easier to read */
article.prose p {
    margin-bottom: 1.2em;
}