/* ==========================================================================
   JobsiteSpecs.com — Core Stylesheet
   Optimized for High-RPM Google AdSense, Zero-CLS, Instant Loading & Mobile
   ========================================================================== */

:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-secondary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent: #0284c7;           /* High-trust jobsite blue */
    --accent-hover: #0369a1;
    --accent-light: #e0f2fe;
    --safety-amber: #d97706;     /* Construction safety amber */
    --safety-yellow: #f59e0b;
    --safety-bg: #fffbeb;
    --safety-border: #fde68a;
    --blueprint-bg: #f8fafc;
    --blueprint-line: #cbd5e1;
    --brand-dark: #0f172a;
    --border: #e2e8f0;
    --border-focus: #0284c7;
    --cost-green: #15803d;
    --cost-bg: #f0fdf4;
    --cost-border: #bbf7d0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Navigation */
.site-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-logo strong {
    color: var(--accent);
}

.brand-logo .tld {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
}

.logo-icon {
    font-size: 1.45rem;
}

.nav-links {
    display: flex;
    gap: 22px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    transition: color 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
}

/* Breadcrumb Navigation */
.breadcrumb-container {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-primary);
    font-weight: 500;
}

/* Ad Placements — Strict CLS = 0 Rules */
.ad-wrapper-top {
    display: flex;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.ad-wrapper-post-result {
    margin: 32px 0;
    display: flex;
    justify-content: center;
}

.ad-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    background: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
}

.ad-badge {
    font-size: 10px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 4px 0 2px 0;
    line-height: 1;
}

.ad-demo-text {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    padding: 0 16px;
}

/* Leaderboard fixed height: 90px on desktop to eliminate CLS */
.ad-leaderboard {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

/* High-CTR Post-Result Native Ad */
.ad-post-result {
    width: 100%;
    min-height: 140px;
    padding: 12px;
    background: #ffffff;
}

/* Sidebar 300x600 Half-page sticky ad */
.ad-sidebar-sticky {
    width: 300px;
    height: 600px;
    margin-bottom: 24px;
}

.ad-placeholder, .ad-placeholder-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Hero Section */
.hero-section {
    padding: 40px 0 24px 0;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.025em;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 780px;
    margin: 0 auto;
}

/* Hub Grid Layout (Home) */
.hub-layout {
    padding-bottom: 60px;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.hub-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hub-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.hub-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.hub-badge {
    background: var(--accent-light);
    color: var(--accent-hover);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: 4px;
}

.hub-icon {
    font-size: 1.6rem;
}

.hub-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hub-card h2 a {
    color: var(--text-primary);
    text-decoration: none;
}

.hub-card h2 a:hover {
    color: var(--accent);
}

.hub-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    flex-grow: 1;
}

.hub-specs-list {
    list-style: none;
    margin-bottom: 20px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.hub-specs-list li {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 3px 0;
    position: relative;
    padding-left: 16px;
}

.hub-specs-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.hub-btn {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--accent-hover);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    text-align: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.hub-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

/* Trust Section */
.trust-section {
    margin-top: 48px;
    padding: 40px 0;
    border-top: 1px solid var(--border);
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.trust-item {
    text-align: center;
}

.trust-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 12px;
}

.trust-item h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.trust-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Tool Dedicated Page Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    padding-top: 24px;
    padding-bottom: 60px;
}

.calculator-column {
    display: flex;
    flex-direction: column;
}

.calc-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.calc-title-group h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-top: 4px;
}

.calc-badge {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent-hover);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px;
    border-radius: 4px;
}

.calc-desc {
    font-size: 0.98rem;
    color: var(--text-secondary);
    margin: 12px 0 24px 0;
}

/* Form Styles */
.calc-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-calculate {
    background: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
    align-self: flex-start;
}

.btn-calculate:hover {
    background: var(--accent-hover);
}

/* Results Display */
.results-box {
    margin-top: 24px;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.result-metric-highlight {
    background: var(--accent-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-hover);
}

.metric-value {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--accent-hover);
    line-height: 1.1;
    margin: 4px 0;
}

.metric-unit {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.result-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.detail-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
}

.detail-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Material Cost Estimate Card (High-CPC Trigger) */
.cost-estimate-card {
    background: var(--cost-bg);
    border: 1px solid var(--cost-border);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    margin-bottom: 20px;
}

.cost-header {
    margin-bottom: 14px;
}

.cost-badge {
    background: #dcfce7;
    color: var(--cost-green);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.cost-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #14532d;
}

.cost-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.cost-option {
    background: #ffffff;
    border: 1px solid var(--cost-border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.cost-option.highlight-truck {
    border-color: #86efac;
    background: #fafffc;
}

.cost-type {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.cost-amount {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cost-green);
}

.cost-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.rule-note {
    background: #fefce8;
    border: 1px solid #fef08a;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.88rem;
    color: #854d0e;
    line-height: 1.45;
}

/* Educational / SEO Section */
.seo-guide-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-top: 24px;
}

.seo-guide-section h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.seo-guide-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 20px 0 8px 0;
    color: var(--text-primary);
}

.seo-guide-section p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.seo-guide-section ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.seo-guide-section li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.formula-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    margin: 16px 0;
    font-family: "Courier New", Courier, monospace;
    font-size: 0.95rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Specs Table */
.table-responsive {
    overflow-x: auto;
    margin: 16px 0;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.specs-table th, .specs-table td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: left;
}

.specs-table th {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--text-primary);
}

/* Sidebar */
.sidebar {
    position: relative;
}

.sidebar-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.sidebar-box h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.ref-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.ref-list strong {
    color: var(--text-primary);
}

/* Footer */
.site-footer {
    background: var(--brand-dark);
    color: #94a3b8;
    padding: 48px 0 24px 0;
    margin-top: 40px;
}

.footer-links-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 28px;
    padding-bottom: 32px;
    border-bottom: 1px solid #1e293b;
}

.footer-col h4 {
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.footer-col p {
    font-size: 0.88rem;
    line-height: 1.5;
    max-width: 400px;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-col a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.15s ease;
}

.footer-col a:hover {
    color: #38bdf8;
}

.ref-summary li {
    font-size: 0.85rem;
}

.footer-bottom {
    padding-top: 24px;
    font-size: 0.8rem;
    text-align: center;
}

.footer-bottom p {
    margin-bottom: 6px;
}

.footer-disclaimer {
    max-width: 750px;
    margin: 8px auto 0 auto;
    font-size: 0.74rem;
    color: #64748b;
}

/* ==========================================================================
   Visual Enhancements: Technical Diagrams, Field Badges, Blueprint Specs
   ========================================================================== */

/* Technical Specification Blueprint Card */
.tech-spec-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin: 28px 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tech-spec-header {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tech-spec-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.01em;
}

.tech-spec-code {
    background: #1e293b;
    border: 1px solid #334155;
    color: #38bdf8;
    font-family: monospace;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.tech-diagram-body {
    padding: 20px;
    background: #fafaf9;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tech-diagram-svg {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.04));
}

.tech-spec-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e7e5e4;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
}

/* Enhanced Jobsite Field Note / Pro Tip Box */
.rule-note {
    background: var(--safety-bg);
    border-left: 4px solid var(--safety-yellow);
    border-top: 1px solid var(--safety-border);
    border-right: 1px solid var(--safety-border);
    border-bottom: 1px solid var(--safety-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 14px 18px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #78350f;
    margin-top: 20px;
}

.rule-note strong {
    color: #92400e;
}

/* Material Takeoff Action Bar (Copy / Print) */
.takeoff-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.btn-takeoff-copy {
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease;
}

.btn-takeoff-copy:hover {
    background: #1e293b;
}

.btn-takeoff-print {
    background: #ffffff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-takeoff-print:hover {
    background: var(--bg-secondary);
    border-color: #cbd5e1;
}

/* Enhanced Hub Card Imagery */
.hub-card-thumb {
    width: 100%;
    height: 110px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.hub-card-thumb svg {
    width: 100%;
    height: 100%;
}

/* Print Stylesheet for Jobsite Pros */
@media print {
    .site-header, .site-footer, .ad-unit-wrapper, .ad-slot, .sidebar, .btn-calculate, .takeoff-actions {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt;
    }
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    .main-layout {
        display: block !important;
    }
    .calc-card {
        border: 1px solid #000000 !important;
        box-shadow: none !important;
        padding: 15px !important;
    }
    .results-box {
        background: #f9f9f9 !important;
        border: 1px solid #000000 !important;
    }
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .ad-leaderboard {
        width: 320px;
        height: 50px;
    }
    .sidebar {
        order: 2;
    }
    .footer-links-grid {
        grid-template-columns: 1fr;
    }
    .nav-links {
        display: none; /* can be expanded to mobile drawer */
    }
}
