/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background-color: #16213e;
    color: #fff;
    padding: 0.75rem 1rem;
    border-bottom: 3px solid #0f3460;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.logo:hover {
    text-decoration: underline;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 1.25rem;
}

.site-nav a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

.site-nav a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Main */
.page-main {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
}

/* Intro */
.intro-section {
    margin-bottom: 2rem;
}

.intro-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.intro-content h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #16213e;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.intro-lead {
    font-size: 1.1rem;
    color: #4a4a6a;
    margin-bottom: 1rem;
}

/* Worksheet grid */
.worksheet-section {
    margin-bottom: 2.5rem;
}

.worksheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 800px) {
    .worksheet-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* Input panel */
.input-panel,
.results-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.input-panel h2,
.results-panel h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #16213e;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.field-group {
    margin-bottom: 1.25rem;
}

.field-group label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
    color: #2a2a40;
}

.field-group input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.field-group input[type="number"]:focus {
    outline: none;
    border-color: #0f3460;
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.field-hint {
    display: block;
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.25rem;
}

.range-group {
    margin-bottom: 1.5rem;
}

.range-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0 0.25rem;
    accent-color: #0f3460;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #888;
}

#factor-display {
    font-weight: 700;
    color: #0f3460;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-secondary {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #f0f0f0;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Results panel */
.result-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: #f0f4f8;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #0f3460;
}

.primary-result {
    background: #e8f0fe;
    border-left-color: #16213e;
}

.result-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.25rem;
}

.result-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: #16213e;
    line-height: 1.2;
}

.result-note {
    display: block;
    font-size: 0.8rem;
    color: #777;
    margin-top: 0.25rem;
}

.dti-breakdown {
    margin-top: 0.5rem;
}

.dti-breakdown h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #2a2a40;
}

.dti-bar-container {
    margin-bottom: 0.75rem;
}

.dti-bar {
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.dti-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.front-end {
    background: #0f3460;
}

.back-end {
    background: #e94560;
}

.dti-label {
    font-size: 0.85rem;
    color: #444;
}

/* Rent vs Buy */
.rent-vs-buy {
    margin-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.25rem;
}

.rent-vs-buy h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #2a2a40;
}

.comparison-intro {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 1rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

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

.comparison-col {
    background: #fafafa;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e0e0e0;
}

.comparison-col h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #16213e;
}

.comparison-col p {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: #333;
}

.comparison-note {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.5rem;
}

.comparison-disclaimer {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

/* Supporting content */
.supporting-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.supporting-inner h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #16213e;
    margin-bottom: 1.25rem;
}

.scenario-walkthrough {
    margin-bottom: 2rem;
}

.scenario-walkthrough p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #333;
    max-width: 70ch;
}

.qa-block {
    margin-bottom: 2rem;
}

.qa-block h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #2a2a40;
}

.qa-block details {
    margin-bottom: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
}

.qa-block summary {
    font-weight: 600;
    cursor: pointer;
    color: #16213e;
    font-size: 0.95rem;
}

.qa-block details p {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #444;
    padding-left: 0.5rem;
    border-left: 2px solid #e0e0e0;
}

.assumptions-block {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 1.25rem;
}

.assumptions-block h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #2a2a40;
}

.assumptions-block ul {
    list-style: disc;
    padding-left: 1.5rem;
    font-size: 0.9rem;
    color: #444;
}

.assumptions-block li {
    margin-bottom: 0.4rem;
}

/* Footer */
.site-footer {
    background: #16213e;
    color: #ccc;
    padding: 1.25rem 1rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.footer-meta a,
.footer-ecosystem a {
    color: #e0e0e0;
    text-decoration: none;
}

.footer-meta a:hover,
.footer-ecosystem a:hover {
    text-decoration: underline;
}

.footer-version {
    display: block;
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

/* Print styles */
@media print {
    .site-header,
    .site-footer,
    .button-row,
    .intro-section {
        display: none;
    }
    .worksheet-grid {
        grid-template-columns: 1fr;
    }
    body {
        background: #fff;
        color: #000;
    }
}

/* Ad slot placeholder */
#ad-slot {
    min-height: 120px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    border-radius: 6px;
    color: #999;
    font-size: 0.8rem;
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
