/* ============================================================================
   DESIGN YOURS v8 — ARCHITECTURAL DRAWING CONFIGURATOR
   Brand: Green Oak Solar (public name: Oak Frame Solar)
   Aesthetic: cream paper, ink lines, Swift Oak A2 title block.
   Palette inherits from the OFS site (--primary olive, --secondary terracotta).
   ============================================================================ */

:root {
    /* OFS palette — must match the site index.html / configurator-v4 */
    --primary:   #3E4C38;
    --secondary: #C29478;
    --accent:    #1a1a1a;
    --light:     #F5F5F0;
    --white:     #FFFFFF;
    --muted:     #798A76;
    --border:    #E0DCD4;

    /* Drawing-surface palette — Swift Oak A2 feel */
    --paper:        #F7F4EC;
    --paper-deep:   #EDE7D9;
    --ink:          #1a1a1a;
    --ink-soft:     #5b5a55;
    --ink-feint:    rgba(26,26,26,0.35);
    --ink-ghost:    rgba(26,26,26,0.15);

    --font-display: 'Playfair Display', serif;
    --font-body:    'Inter', sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, monospace;
    --transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    font-family: var(--font-body);
    color: var(--accent);
    background: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
}

/* ===== Site nav (mirrors v4) ===== */
.site-nav {
    position: sticky; top: 0; z-index: 90;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: 1400px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem;
}
.nav-logo {
    font-family: var(--font-display);
    font-weight: 800; font-size: 1.3rem;
    color: var(--primary);
    letter-spacing: 0.04em;
    text-decoration: none;
}
.nav-menu {
    list-style: none; display: flex; gap: 1.4rem; align-items: center;
}
.nav-menu a {
    color: var(--accent); text-decoration: none;
    font-weight: 500; font-size: 0.92rem;
    transition: var(--transition);
}
.nav-menu a:hover, .nav-menu a.active { color: var(--secondary); }
.nav-menu a.nav-cta {
    background: var(--primary); color: var(--white);
    padding: 0.5rem 1rem; border-radius: 4px;
}
.nav-menu a.nav-cta:hover { background: var(--secondary); color: var(--white); }
.hamburger { display: none; background: none; border: 0; cursor: pointer; gap: 4px; flex-direction: column; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--accent); }

/* ===== Page head ===== */
.page-head {
    max-width: 1400px; margin: 0 auto;
    padding: 1.5rem 1.5rem 0.75rem;
}
.page-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--primary);
    letter-spacing: 0.05em;
}
.page-sub {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.2rem;
}
.stepper {
    display: flex;
    gap: 1.4rem;
    margin-top: 1rem;
    padding-bottom: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
.stepper .step {
    font-family: var(--font-body);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    position: relative;
    padding: 0 0 0.6rem 0;
    transition: var(--transition);
}
.stepper .step:hover { color: var(--accent); }
.stepper .step.active {
    color: var(--primary);
    font-weight: 600;
}
.stepper .step.active::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--primary);
}

/* ===== Drawing stage ===== */
.drawing-stage {
    position: relative;
    max-width: 1400px;
    margin: 1rem auto 0;
    aspect-ratio: 16 / 10;
    background: var(--paper);
    border: 1px solid var(--ink-ghost);
    border-radius: 4px;
    overflow: hidden;
}
#frameCanvas {
    display: block;
    width: 100%; height: 100%;
    touch-action: none;
}

/* ===== Dim overlay (SVG sat on top of canvas) ===== */
.dim-overlay {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.dim-overlay .dim-line {
    stroke: var(--ink); stroke-width: 0.6;
    fill: none;
}
.dim-overlay .dim-tick {
    stroke: var(--ink); stroke-width: 0.6;
}
.dim-overlay .dim-label {
    fill: var(--ink);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
}
.dim-overlay .dim-label-sub {
    fill: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 10px;
}

/* ===== Title block ===== */
.title-block {
    position: absolute;
    bottom: 14px;
    right: 14px;
    background: var(--paper);
    border: 0.6px solid var(--ink);
    padding: 8px 10px;
    min-width: 220px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink);
    letter-spacing: 0.02em;
    line-height: 1.5;
}
.title-block-row-top {
    display: flex; flex-direction: column;
    align-items: center;
    border-bottom: 0.5px solid var(--ink);
    padding-bottom: 4px; margin-bottom: 4px;
}
.title-block-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.08em;
    color: var(--primary);
}
.title-block-strap {
    color: var(--ink-soft);
    font-style: italic;
    font-size: 9.5px;
    letter-spacing: 0.04em;
}
.title-block-grid {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 2px 8px;
}
.title-block-grid dt {
    color: var(--ink-soft);
    text-transform: uppercase;
    font-weight: 500;
    font-size: 9.5px;
    letter-spacing: 0.06em;
}
.title-block-grid dd {
    color: var(--ink);
    font-weight: 500;
}

/* ===== Scale bar ===== */
.scale-bar {
    position: absolute;
    bottom: 14px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink);
    letter-spacing: 0.02em;
}
.scale-bar-track {
    display: flex;
    border: 0.6px solid var(--ink);
    height: 7px;
    width: 150px;
}
.scale-bar-seg {
    flex: 1;
    border-right: 0.6px solid var(--ink);
}
.scale-bar-seg:last-child { border-right: none; }
.scale-bar-seg:nth-child(odd) { background: var(--ink); }
.scale-bar-labels {
    display: flex; justify-content: space-between;
    width: 150px; margin-top: 2px;
    color: var(--ink-soft);
}
.scale-bar-caption {
    margin-top: 4px;
    font-style: italic;
    color: var(--ink-soft);
    font-size: 9.5px;
}

/* ===== View toggle ===== */
.view-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    background: var(--paper);
    border: 0.6px solid var(--ink-feint);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    font-family: var(--font-mono);
}
.view-toggle button {
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: var(--transition);
}
.view-toggle button:hover { color: var(--ink); }
.view-toggle button.active {
    background: var(--ink);
    color: var(--paper);
}

/* ===== Render mode toggle (v7.5) — mirrors view-toggle, sits below it ===== */
.render-toggle {
    position: absolute;
    top: 56px;
    right: 14px;
    display: flex;
    background: var(--paper);
    border: 0.6px solid var(--ink-feint);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    font-family: var(--font-mono);
}
.render-toggle button {
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: var(--transition);
}
.render-toggle button:hover { color: var(--ink); }
.render-toggle button.active {
    background: var(--ink);
    color: var(--paper);
}

/* ===== Config panels (tab-driven option groups) ===== */
.config-panels {
    max-width: 1400px;
    margin: 1.2rem auto 0;
    padding: 0 1.5rem;
}
.panel {
    display: none;
    animation: panelFadeIn 0.18s ease-out;
}
.panel.active { display: block; }
@keyframes panelFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}
.panel-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}
.panel-lead {
    font-size: 0.92rem;
    color: var(--accent);
    margin-bottom: 0.8rem;
    max-width: 720px;
    line-height: 1.55;
}
.panel-note,
.panel-foot {
    font-size: 0.78rem;
    color: var(--muted);
    max-width: 720px;
    line-height: 1.55;
    font-style: italic;
    margin-top: 0.5rem;
}
.panel-foot { margin-top: 0.9rem; }
.opt-h3 {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-top: 1.2rem;
    margin-bottom: 0.4rem;
}
.info-list {
    margin: 0.4rem 0 0 1.2rem;
    color: var(--accent);
    font-size: 0.92rem;
    line-height: 1.55;
}
.info-list li { margin-bottom: 0.3rem; }
.info-list strong { color: var(--primary); }

/* Bay-count chips reused in the Structure panel */
.config-chips {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.chip {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.2;
    text-align: left;
}
.chip small {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.1rem;
    font-weight: 400;
}
.chip:hover {
    border-color: var(--secondary);
    color: var(--primary);
}
.chip.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.chip.active small { color: rgba(255,255,255,0.75); }

/* Generic option row — pill-style buttons, used by every option group */
.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.opt {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.2;
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
}
.opt small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 400;
}
.opt:hover:not(:disabled) {
    border-color: var(--secondary);
    color: var(--primary);
}
.opt.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.opt.active small { color: rgba(255,255,255,0.75); }
.opt:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Quote panel summary table */
.quote-summary {
    margin-top: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--white);
}
.quote-summary .qs-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--border);
}
.quote-summary .qs-row:last-child { border-bottom: none; }
.quote-summary .qs-row.total {
    background: var(--light);
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}
.quote-summary .qs-label { color: var(--accent); }
.quote-summary .qs-amount {
    font-family: var(--font-mono);
    color: var(--primary);
    font-weight: 600;
}
.quote-cta {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-start;
}

/* ===== Sticky price bar ===== */
.price-bar {
    position: sticky;
    bottom: 0;
    z-index: 60;
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.price-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.7);
}
.price-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
}
.quote-btn {
    background: var(--secondary);
    color: var(--white);
    border: none;
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-body);
}
.quote-btn:hover { background: var(--white); color: var(--primary); }

/* ===== Quote modal ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(26,26,26,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}
.modal.open { display: flex; }
.modal-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 6px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-card h2 {
    font-family: var(--font-display);
    color: var(--primary);
    margin-bottom: 0.4rem;
}
.modal-lead {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}
.modal-card input,
.modal-card textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--light);
}
.modal-card textarea { min-height: 90px; resize: vertical; }
.modal-card input:focus,
.modal-card textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
}
.modal-summary {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
.modal-summary strong { color: var(--primary); display: block; margin-bottom: 0.3rem; }
.modal-buttons { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.modal-buttons button {
    flex: 1;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 4px;
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}
.modal-buttons .cancel { background: var(--border); color: var(--accent); }
.modal-buttons .cancel:hover { background: var(--muted); color: var(--white); }
.modal-buttons .submit { background: var(--primary); color: var(--white); }
.modal-buttons .submit:hover { background: var(--secondary); }
.modal-buttons .submit:disabled { opacity: 0.6; cursor: wait; }
.modal-error {
    color: #C0392B;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    display: none;
}
.modal-error.visible { display: block; }
.modal-success {
    text-align: center;
    padding: 1rem 0;
    display: none;
}
.modal-success.visible { display: block; }
.modal-success h3 {
    font-family: var(--font-display);
    color: var(--primary);
    margin-bottom: 0.6rem;
}
.modal-success p {
    color: var(--muted);
    margin-bottom: 0.4rem;
}

/* ===== Site footer ===== */
.site-footer {
    background: var(--accent);
    color: var(--white);
    padding: 2.5rem 1.5rem 1.5rem;
    margin-top: 0;
}
.footer-container { max-width: 1400px; margin: 0 auto; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem; margin-bottom: 1.5rem;
}
.footer-column h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.06em;
}
.footer-column p,
.footer-column li { color: rgba(255,255,255,0.7); font-size: 0.85rem; }
.footer-column ul { list-style: none; }
.footer-column li { margin-bottom: 0.3rem; }
.footer-column a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: var(--transition);
}
.footer-column a:hover { color: var(--secondary); }
.footer-branding {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--white);
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 1rem; margin-top: 1rem;
    text-align: center;
}
.footer-bottom p {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 0.3rem;
}
.footer-bottom a { color: rgba(255,255,255,0.65); }

/* MANDATORY FMB attribution per root CLAUDE.md */
.built-by-fmb {
    text-align: center;
    padding: 1rem 0 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 1rem;
}
.built-by-fmb a {
    color: #8b7355;
    font-size: 0.75rem;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.built-by-fmb a:hover { color: var(--secondary); }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        background: var(--white);
        padding: 1rem;
        border-bottom: 1px solid var(--border);
    }
    .nav-menu.open { display: flex; }
    .hamburger { display: flex; }

    .drawing-stage { aspect-ratio: 4 / 3; }
    .title-block { min-width: 180px; font-size: 9.5px; }
    .title-block-grid { grid-template-columns: 50px 1fr; }
    .scale-bar-track,
    .scale-bar-labels { width: 110px; }
}

@media (max-width: 500px) {
    .page-head { padding: 1rem 1rem 0.6rem; }
    .page-title { font-size: 1.35rem; }
    .drawing-stage {
        margin: 0.6rem 0 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        aspect-ratio: 1 / 1;
    }
    .config-bar { padding: 0 1rem; }
    .price-bar { padding: 0.85rem 1rem; flex-direction: column; align-items: stretch; text-align: center; }
    .price-bar .quote-btn { width: 100%; }
    .title-block,
    .scale-bar { display: none; }
    .view-toggle { top: 8px; right: 8px; padding: 2px; }
    .view-toggle button { padding: 5px 9px; font-size: 10px; }
}
