:root {
    --paper: #f4efe6;
    --ink: #17212b;
    --muted: #64706e;
    --line: #d6cab8;
    --lake: #1f6f8b;
    --pine: #244c3f;
    --berry: #b64045;
    --brass: #d2a24b;
    --white: #fffaf0;
    --shadow: 0 22px 70px rgba(23, 33, 43, 0.16);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(31, 111, 139, 0.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(31, 111, 139, 0.06) 1px, transparent 1px),
        var(--paper);
    background-size: 44px 44px;
    font-family: Manrope, Arial, sans-serif;
    letter-spacing: 0;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(18px, 4vw, 56px);
    background: rgba(244, 239, 230, 0.86);
    border-bottom: 1px solid rgba(23, 33, 43, 0.09);
    backdrop-filter: blur(18px);
    transition: box-shadow 200ms ease, padding 200ms ease;
}

.topbar.is-scrolled {
    padding-top: 12px;
    padding-bottom: 12px;
    box-shadow: 0 10px 40px rgba(23, 33, 43, 0.12);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    text-decoration: none;
    min-width: 220px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--white);
    background: var(--lake);
    border: 3px solid var(--brass);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 25px;
    line-height: 1;
}

.brand strong,
.footer strong {
    display: block;
    font-size: 18px;
    line-height: 1.05;
}

.brand small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav a {
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
}

.nav a:hover {
    color: var(--lake);
    border-bottom-color: var(--brass);
}

.mode-button,
.primary-link,
.secondary-link,
.notice-band button,
.hero-note button,
.audit-form button,
.apply-form button,
.permit-button,
.modal-card button {
    border: 0;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 42px;
    padding: 10px 14px;
    color: var(--white);
    background: var(--pine);
    white-space: nowrap;
}

#mode-dot {
    width: 10px;
    height: 10px;
    background: var(--brass);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(210, 162, 75, 0.24);
}

.hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
    align-items: end;
    gap: clamp(22px, 4vw, 48px);
    min-height: 92vh;
    padding: 150px clamp(18px, 5vw, 72px) 54px;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 120px;
    background: linear-gradient(to top, var(--paper), transparent);
    pointer-events: none;
}

.hero-media {
    position: absolute;
    inset: 0;
    z-index: -2;
}

.hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(244, 239, 230, 0.96) 0%, rgba(244, 239, 230, 0.76) 48%, rgba(244, 239, 230, 0.2) 100%),
        linear-gradient(0deg, rgba(36, 76, 63, 0.55), rgba(36, 76, 63, 0.08));
}

.hero-copy {
    position: relative;
    z-index: 1;
    max-width: 860px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--berry);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1,
h2 {
    margin: 0;
    font-family: "Playfair Display", Georgia, serif;
    line-height: 0.98;
}

h1 {
    max-width: 780px;
    font-size: clamp(46px, 9vw, 112px);
}

h2 {
    font-size: clamp(34px, 5vw, 68px);
}

.lead {
    min-height: 72px;
    max-width: 680px;
    margin: 24px 0 0;
    color: #26343d;
    font-size: clamp(17px, 2vw, 22px);
    line-height: 1.6;
}

.lead::after {
    content: "|";
    display: inline-block;
    margin-left: 3px;
    color: var(--berry);
    animation: blink 1s steps(2, start) infinite;
}

.hero-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 34px;
}

.primary-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 13px 18px;
}

.primary-link {
    color: var(--white);
    background: var(--berry);
}

.secondary-link {
    color: var(--ink);
    background: rgba(255, 250, 240, 0.74);
    border: 1px solid rgba(23, 33, 43, 0.24);
}

.hero-note {
    position: relative;
    z-index: 1;
    align-self: center;
    padding: 26px;
    background: rgba(255, 250, 240, 0.88);
    border: 1px solid rgba(23, 33, 43, 0.16);
    box-shadow: var(--shadow);
}

.hero-note span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.hero-note strong {
    display: block;
    margin: 10px 0 16px;
    color: var(--lake);
    font-size: clamp(42px, 7vw, 72px);
    line-height: 1;
}

.hero-note button,
.notice-band button,
.audit-form button,
.apply-form button,
.permit-button,
.modal-card button {
    color: var(--white);
    background: var(--ink);
    padding: 12px 16px;
}

.hero-note p {
    margin: 16px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.notice-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 clamp(18px, 5vw, 72px);
    padding: 22px;
    color: var(--white);
    background: var(--pine);
    border-left: 10px solid var(--brass);
}

.notice-band div {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notice-band p {
    margin: 0;
    line-height: 1.5;
}

.notice-band button {
    flex: 0 0 auto;
    background: var(--brass);
    color: var(--ink);
}

.stamp {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    color: var(--ink);
    background: var(--brass);
    font-weight: 900;
    text-transform: uppercase;
}

.content-section,
.split-section,
.application-section {
    padding: 92px clamp(18px, 5vw, 72px);
}

.section-heading {
    display: grid;
    grid-template-columns: minmax(260px, 470px) minmax(260px, 540px);
    gap: 34px;
    align-items: end;
    margin-bottom: 36px;
}

.section-heading p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.permit-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.permit-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 16px 44px rgba(23, 33, 43, 0.08);
    opacity: 0;
    transform: translateY(16px);
    animation: fadeUp 520ms ease forwards;
}

.permit-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-bottom: 7px solid var(--brass);
    filter: saturate(0.82) contrast(1.02);
}

.permit-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 22px;
}

.permit-card span,
.result-kicker {
    color: var(--lake);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.permit-card h3 {
    margin: 10px 0 5px;
    font-size: 24px;
    line-height: 1.08;
}

.permit-card h4 {
    margin: 0;
    color: var(--berry);
    font-size: 15px;
    line-height: 1.35;
}

.permit-card p {
    flex: 1;
    margin: 16px 0 22px;
    color: var(--muted);
    line-height: 1.6;
}

.permit-button {
    width: 100%;
    background: var(--lake);
}

.split-section {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.75fr);
    gap: 22px;
    background: linear-gradient(135deg, rgba(31, 111, 139, 0.12), rgba(182, 64, 69, 0.08));
}

.audit-panel,
.result-panel,
.apply-form {
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 16px 44px rgba(23, 33, 43, 0.08);
}

.audit-panel {
    padding: clamp(24px, 4vw, 42px);
}

.audit-form,
.apply-form {
    display: grid;
    gap: 18px;
}

.audit-form {
    margin-top: 28px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    color: var(--ink);
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 13px 14px;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--lake);
    box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.18);
}

input[type="range"] {
    accent-color: var(--berry);
    padding: 0;
}

.result-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 420px;
    padding: 32px;
    color: var(--white);
    background:
        linear-gradient(rgba(23, 33, 43, 0.24), rgba(23, 33, 43, 0.82)),
        url("https://images.unsplash.com/photo-1485217988980-11786ced9454?auto=format&fit=crop&q=80&w=1000") center / cover;
    border-color: rgba(23, 33, 43, 0.16);
}

.result-panel strong {
    display: block;
    margin: 13px 0;
    font-size: clamp(26px, 3vw, 40px);
    line-height: 1.08;
}

.result-panel p {
    margin: 0;
    color: rgba(255, 250, 240, 0.84);
    line-height: 1.6;
}

.application-section {
    display: grid;
    grid-template-columns: minmax(260px, 0.75fr) minmax(280px, 1fr);
    gap: 34px;
    align-items: start;
}

.application-copy p:last-child {
    color: var(--muted);
    font-size: 18px;
    line-height: 1.65;
}

.apply-form {
    padding: clamp(22px, 4vw, 38px);
}

.apply-form button,
.audit-form button {
    background: var(--berry);
}

.footer {
    display: grid;
    grid-template-columns: minmax(260px, 440px) minmax(260px, 1fr);
    gap: 28px;
    padding: 40px clamp(18px, 5vw, 72px);
    color: var(--white);
    background: var(--ink);
}

.footer p,
.footer li {
    color: rgba(255, 250, 240, 0.68);
    line-height: 1.6;
}

.footer ul {
    margin: 0;
    padding-left: 18px;
}

.modal {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(23, 33, 43, 0.72);
    backdrop-filter: blur(8px);
}

.modal-card {
    position: relative;
    width: min(100%, 520px);
    padding: clamp(24px, 5vw, 42px);
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(12px);
    transition: transform 180ms ease;
}

.modal.is-open .modal-card {
    transform: translateY(0);
}

.modal-card h2 {
    font-size: clamp(30px, 5vw, 48px);
}

.modal-card p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.65;
}

button:hover,
.primary-link:hover,
.secondary-link:hover {
    transform: translateY(-2px);
}

.lagom-mode {
    --paper: #eeece7;
    --ink: #303638;
    --muted: #737a79;
    --line: #d9d6cf;
    --lake: #6d7f86;
    --pine: #5f6b65;
    --berry: #8e807a;
    --brass: #c6bdab;
    --white: #f8f6f1;
}

.lagom-mode img {
    filter: grayscale(1) contrast(0.9);
}

.lagom-mode .hero-media::after {
    background: linear-gradient(90deg, rgba(238, 236, 231, 0.97), rgba(238, 236, 231, 0.66));
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@media (max-width: 980px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav {
        order: 3;
        justify-content: flex-start;
        width: 100%;
    }

    .hero,
    .section-heading,
    .split-section,
    .application-section,
    .footer {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
        padding-top: 170px;
    }

    .permit-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .notice-band,
    .notice-band div {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .topbar {
        gap: 12px;
        padding: 12px 14px;
    }

    .brand {
        min-width: 0;
    }

    .brand small {
        display: none;
    }

    .mode-button {
        width: 100%;
    }

    .nav {
        gap: 4px;
    }

    .nav a {
        padding: 8px 9px;
    }

    .hero {
        padding: 210px 16px 38px;
    }

    .hero-actions a,
    .notice-band button {
        width: 100%;
    }

    .permit-grid {
        grid-template-columns: 1fr;
    }

    .content-section,
    .split-section,
    .application-section {
        padding: 64px 16px;
    }

    .notice-band {
        margin: 0 16px;
    }
}
