:root {
    color-scheme: dark;

    --bg: #121512;
    --panel: #1a201a;
    --panel-2: #161a17;

    --border: #3b4339;

    --gold: #dfc38c;
    --gold-soft: #b69a6f;

    --text: #f3f0e8;
    --muted: #b8c0b5;

    --green: #b6dfb0;
    --red: #ffb8aa;

    font:
        16px / 1.55
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at 75% 8%,
            rgba(223, 195, 140, 0.055),
            transparent 31rem
        ),
        linear-gradient(
            180deg,
            #111411,
            #121512 70%
        );

    color: var(--text);
}

button,
input,
textarea {
    font: inherit;
}

button,
a,
summary {
    cursor: pointer;
}

button {
    min-height: 44px;
    padding: 0.65rem 1rem;

    background: var(--gold);
    color: #222a21;

    border: 1px solid transparent;
    border-radius: 5px;

    font-weight: 650;

    transition:
        transform 160ms ease,
        filter 160ms ease,
        background 160ms ease,
        border-color 160ms ease;
}

button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
}

button.secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

button.secondary:hover {
    border-color: var(--gold-soft);
    background: rgba(223, 195, 140, 0.05);
}

button.danger {
    background: transparent;
    color: var(--red);
    border-color: rgba(255, 184, 170, 0.45);
}

a {
    color: var(--gold);
}

a:hover {
    color: #efd9ae;
}

:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.12;
    font-weight: 500;
    letter-spacing: -0.04em;
}

h2 {
    font-size: 1.55rem;
    font-weight: 550;
    line-height: 1.3;
}

h3 {
    font-size: 1rem;
}

small,
.muted {
    color: var(--muted);
}


/* =========================
   HEADER
========================= */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 2rem;

    padding: 1.5rem 5vw;

    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(15px);
}

.brand {
    text-decoration: none;

    font-size: 1.55rem;
    font-weight: 750;

    letter-spacing: 0.1em;

    color: var(--text);
}

.brand span {
    color: var(--gold);
}

.brand small {
    display: block;

    margin-top: 0.25rem;

    font-size: 0.58rem;
    font-weight: 450;

    letter-spacing: 0.18em;
}

#account {
    display: flex;
    align-items: center;

    gap: 1rem;

    font-size: 0.85rem;
}


/* =========================
   MAIN LAYOUT
========================= */

main {
    max-width: 1400px;

    min-height: 70vh;

    margin: auto;

    padding: 3rem 5vw 5rem;
}

.eyebrow {
    margin-bottom: 0.7rem;

    color: var(--gold);

    font-size: 0.72rem;

    text-transform: uppercase;

    letter-spacing: 0.18em;
}

.intro {
    display: flex;
    justify-content: space-between;
    align-items: end;

    gap: 2rem;

    margin-bottom: 2rem;
}

.intro p {
    max-width: 660px;

    margin-bottom: 0;

    color: var(--muted);
}

.layout {
    display: grid;

    grid-template-columns:
        280px
        minmax(0, 1fr);

    gap: 2rem;
}


/* =========================
   PROJECT LIBRARY
========================= */

.project-list {
    display: grid;
    align-content: start;

    gap: 0.75rem;
}

.project-card {
    width: 100%;

    padding: 1.1rem;

    text-align: left;

    background: var(--panel);

    color: var(--text);

    border: 1px solid var(--border);
    border-left: 3px solid transparent;

    transition:
        border-color 180ms ease,
        background 180ms ease,
        transform 180ms ease;
}

.project-card:hover {
    background: #222822;

    border-color: #555f51;

    transform: translateX(2px);
}

.project-card[aria-current="true"] {
    border-color: var(--gold);
    border-left-color: var(--gold);

    background:
        linear-gradient(
            90deg,
            rgba(223, 195, 140, 0.08),
            var(--panel) 45%
        );
}

.project-card strong,
.project-card small {
    display: block;

    margin-bottom: 0.35rem;
}


/* =========================
   PANELS
========================= */

.panel {
    margin-bottom: 1.25rem;

    padding: 1.5rem;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,0.015),
            transparent 45%
        ),
        var(--panel);

    border: 1px solid var(--border);
    border-radius: 8px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;

    gap: 1rem;
}

.pill {
    display: inline-block;

    padding: 0.2rem 0.65rem;

    border: 1px solid var(--border);
    border-radius: 30px;

    font-size: 0.73rem;

    white-space: nowrap;
}

.pill.accepted {
    color: var(--green);

    border-color: #526c4e;
}

.pill.changes_requested {
    color: var(--gold);

    border-color: #8d744e;
}

.pill.expired {
    color: var(--red);

    border-color: rgba(255, 184, 170, 0.45);
}

.pill.superseded {
    color: var(--muted);
}


/* =========================
   FORMS
========================= */

.form-grid {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 1rem;
}

.full {
    grid-column: 1 / -1;
}

label {
    display: block;

    color: var(--muted);

    font-size: 0.86rem;
}

input,
textarea {
    display: block;

    width: 100%;

    margin-top: 0.4rem;

    padding: 0.7rem 0.8rem;

    background: #121712;

    color: var(--text);

    border: 1px solid #515b4e;
    border-radius: 4px;

    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

input:focus,
textarea:focus {
    border-color: var(--gold-soft);

    box-shadow:
        0 0 0 3px
        rgba(223, 195, 140, 0.08);

    outline: none;
}

textarea {
    min-height: 95px;

    resize: vertical;
}

input[type="checkbox"] {
    flex: 0 0 22px;

    width: 22px;
    height: 22px;

    margin: 2px 0 0;

    accent-color: var(--gold);
}

.check {
    display: flex;
    align-items: start;

    gap: 0.8rem;

    margin: 1.25rem 0;

    color: var(--text);
}

.actions {
    display: flex;
    flex-wrap: wrap;

    gap: 0.65rem;

    margin-top: 1.4rem;
}

.help {
    margin: 0.8rem 0;

    color: var(--muted);

    font-size: 0.85rem;
}


/* =========================
   LOGIN
========================= */

.auth {
    max-width: 460px;

    margin: 4vh auto;

    padding: 2rem;

    border: 1px solid var(--border);
    border-radius: 8px;

    background:
        linear-gradient(
            145deg,
            rgba(223, 195, 140, 0.04),
            transparent 45%
        ),
        var(--panel);
}

.auth input {
    margin-bottom: 1rem;
}


/* =========================
   QUOTATION
========================= */

.amount {
    color: var(--gold);

    font-size: 2rem;
    font-weight: 550;

    line-height: 1.25;
}

.quote-top {
    display: flex;
    justify-content: space-between;

    gap: 2rem;

    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;

    border-bottom: 1px solid var(--border);
}

.quote-top p {
    margin-bottom: 0.4rem;
}

.quote-section {
    margin: 1.6rem 0;
}

.quote-section p {
    white-space: pre-wrap;

    overflow-wrap: anywhere;
}

.quote-grid {
    display: grid;

    grid-template-columns:
        1fr
        1fr;

    gap: 1.5rem;
}

.quote-grid h3 {
    margin-bottom: 0.4rem;

    color: var(--muted);

    font-weight: 500;
}


/* =========================
   TERMS
========================= */

details {
    margin-top: 1.2rem;
    padding-top: 1rem;

    border-top: 1px solid var(--border);
}

summary {
    min-height: 40px;

    color: var(--gold);

    font-weight: 600;
}

.terms p {
    font-size: 0.88rem;
}

.terms h3 {
    margin-top: 1.5rem;
}


/* =========================
   HISTORY
========================= */

.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 1rem;

    padding: 1rem 0;

    border-bottom: 1px solid var(--border);
}

.history-row p {
    margin: 0;

    font-size: 0.85rem;
}

.history-row button {
    flex-shrink: 0;
}


/* =========================
   CUSTOMER DECISIONS
========================= */

.receipt {
    margin: 1.2rem 0;

    padding: 1rem 1.2rem;

    background: #253026;

    border-left: 3px solid var(--green);
}

.receipt.change {
    border-color: var(--gold);
}

.receipt p {
    margin-bottom: 0.5rem;

    white-space: pre-wrap;

    overflow-wrap: anywhere;
}


/* =========================
   MISC
========================= */

.empty {
    padding: 3rem 1.5rem;

    text-align: center;

    color: var(--muted);

    border: 1px dashed var(--border);
    border-radius: 8px;
}

.error {
    color: var(--red);
}

.compare {
    padding: 0.8rem;

    background: #252b24;

    font-size: 0.88rem;
}

.link-box {
    padding: 1rem;

    background: #111711;

    border: 1px solid var(--border);

    word-break: break-all;

    user-select: all;
}

.loading {
    padding: 3rem;

    text-align: center;

    color: var(--muted);
}


/* =========================
   NOTIFICATION
========================= */

#notice {
    display: none;

    position: fixed;

    left: 50%;
    bottom: 1.5rem;

    z-index: 50;

    max-width: 90vw;

    padding: 0.8rem 1.2rem;

    transform: translateX(-50%);

    background: #e6d3a8;
    color: #192016;

    border-radius: 5px;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.4);
}

#notice.visible {
    display: block;
}


/* =========================
   DIALOG
========================= */

dialog {
    width: min(900px, 94vw);
    max-height: 90vh;

    padding: 1.75rem;

    background: var(--panel);

    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 8px;

    overflow: auto;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);

    backdrop-filter: blur(3px);
}

.dialog-head {
    display: flex;
    justify-content: space-between;

    gap: 1rem;
}

.dialog-head button {
    min-width: 44px;
}


/* =========================
   FOOTER
========================= */

footer {
    display: flex;
    justify-content: space-between;

    gap: 1rem;

    padding: 1.5rem 5vw;

    color: var(--muted);

    border-top: 1px solid var(--border);

    font-size: 0.75rem;
}


/* =========================
   RESPONSIVE
========================= */

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

    .project-list {
        grid-template-columns:
            repeat(
                auto-fit,
                minmax(230px, 1fr)
            );
    }

    .intro {
        align-items: start;

        flex-direction: column;
    }

    .quote-top {
        flex-wrap: wrap;
    }

    .site-header {
        padding: 1rem 5vw;
    }

    #account {
        flex-wrap: wrap;
        justify-content: end;
    }

    #account span {
        display: none;
    }
}

@media (max-width: 520px) {
    .form-grid,
    .quote-grid {
        grid-template-columns: 1fr;
    }

    .full {
        grid-column: auto;
    }

    .panel {
        padding: 1.1rem;
    }

    main {
        padding-top: 2rem;
    }

    .amount {
        font-size: 1.7rem;
    }

    footer {
        flex-direction: column;
    }

    .panel-head {
        flex-wrap: wrap;
    }

    .actions button {
        flex: 1;
    }

    dialog {
        padding: 1rem;
    }

    .auth {
        padding: 1.4rem;
    }
}


/* =========================
   REDUCED MOTION
========================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* =========================
   PRINT / PDF
========================= */

.print-only {
    display: none;
}

@media print {
    color-scheme: light;

    body {
        background: white;
        color: black;
    }

    body > * {
        display: none !important;
    }

    body > #modal {
        display: block !important;

        position: static;

        width: 100%;
        max-height: none;

        margin: 0;
        padding: 0;

        background: white;
        color: black;

        border: 0;
    }

    dialog::backdrop {
        display: none;
    }

    .no-print,
    .dialog-head button {
        display: none !important;
    }

    .print-only {
        display: block;
    }

    .amount,
    summary,
    .eyebrow,
    small,
    .muted,
    .quote-grid h3 {
        color: #333;
    }

    .quote-section,
    .quote-top,
    .history-row {
        break-inside: avoid;
    }

    .terms p {
        font-size: 10pt;
    }

    .quote-section p {
        font-size: 11pt;
    }

    .receipt,
    .compare {
        background: white;
        color: black;

        border-color: #777;
    }

    details {
        border-color: #aaa;
    }

    .quote-top {
        border-color: #aaa;
    }

    h1 {
        font-size: 25pt;
    }

    a {
        color: black;
    }

    .pill {
        color: black !important;

        border-color: #999 !important;
    }
}