@font-face {
    font-family: "Nunito Sans";
    src: url("/fonts/nunito-sans.woff2") format("woff2");
    font-weight: 200 1000;
    font-display: swap;
}

@font-face {
    font-family: "EB Garamond";
    src: url("/fonts/eb-garamond.woff2") format("woff2");
    font-weight: 400 800;
    font-display: swap;
}

:root {
    --text: #1a1a1a;
    --muted: #666;
    --bg: #fff;
    --subtle: #f5f5f5;
    --accent: #af8e68;
    --accent-hover: #8a7253;
    --footer-bg: #1c160f;
    --max: 1100px;
    --nav-height: 80px;
    --s1: 0.5rem;
    --s2: 1rem;
    --s3: 2rem;
    --s4: 4rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
* {
    margin: 0;
}

html {
    font-family: "Nunito Sans", system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text);
}

body {
    min-height: 100dvh;
}
img {
    display: block;
    max-width: 100%;
}

h1,
h2,
h3 {
    line-height: 1.2;
    text-wrap: balance;
}
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}
h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: var(--s2);
}
h3 {
    font-size: 1.25rem;
}

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

/* Logo */

.logo {
    position: relative;
    width: 88px;
    height: 52px;
    flex-shrink: 0;
}

.logo-mk {
    position: absolute;
    top: 3px;
    left: 25px;
    font-family: "EB Garamond", Georgia, serif;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.5px;
    z-index: 2;
    color: #000;
    transition: color 0.2s;
}

.logo-vert {
    position: absolute;
    left: 16px;
    top: 0;
    width: 8px;
    height: 100%;
    z-index: 0;
}

.logo-vert::before,
.logo-vert::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    background: #c6af94;
    border: 1px solid #000;
    box-sizing: border-box;
    transition:
        background-color 0.2s,
        border-color 0.2s;
}

.logo-vert::before {
    top: 0;
    height: 30px; /* stops at top of horiz beam */
    border-bottom: none;
}

.logo-vert::after {
    top: 44px; /* starts at bottom of horiz beam */
    bottom: 0;
    border-top: none;
}

.logo-horiz {
    position: absolute;
    left: 0;
    top: 30px;
    width: 100%;
    height: 14px;
    background: #c6af94;
    border: 1px solid #000;
    box-sizing: border-box;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.1px;
    line-height: 1;
    text-transform: uppercase;
    color: #000;
    transition:
        color 0.2s,
        background-color 0.2s,
        border-color 0.2s;
}

/* At-top (transparent nav): white/outline state */
body.at-top .logo-mk {
    color: #fff;
}
body.at-top .logo-vert::before,
body.at-top .logo-vert::after {
    background: transparent;
    border-color: #fff;
}
body.at-top .logo-horiz {
    background: transparent;
    border-color: #fff;
    color: #fff;
}

/* Nav */

nav {
    position: sticky;
    top: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: var(--s2);
    height: var(--nav-height);
    padding: 0 var(--s3);
    max-width: var(--max);
    margin: 0 auto;
    color: var(--text);
    transition: color 0.2s;
}

/* Full-width background via pseudo-element */
nav::before {
    content: "";
    position: absolute;
    inset: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: -1;
    transition:
        background-color 0.2s,
        box-shadow 0.2s;
}

/* Transparent state: at top of page */
body.at-top nav {
    color: white;
}

body.at-top nav::before {
    background: transparent;
    box-shadow: none;
}

nav > a:first-child {
    color: inherit;
    text-decoration: none;
}

nav ul {
    display: flex;
    align-items: center;
    gap: var(--s3);
    list-style: none;
    margin: 0;
    margin-left: auto;
    font-size: 1.05rem;
}

nav ul a {
    color: inherit;
    text-decoration: none;
}

nav ul a:hover {
    text-decoration: underline;
}
body.at-top nav ul a:hover {
    color: white;
}
nav button {
    display: none;
}

/* Hero */

/* Main padding for non-hero pages */
main {
    padding-top: var(--nav-height);
}

/* Hero pages: hero overlaps nav */
main:has(> .hero:first-child) {
    padding-top: 0;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 0;
    margin-top: calc(-1 * var(--nav-height));
}

.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    pointer-events: none;
}

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

.hero.tall {
    height: calc(min(600px, 70vh) + var(--nav-height));
}
.hero.short {
    height: calc(min(400px, 50vh) + var(--nav-height));
}

.hero header {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--s2);
    color: white;
    text-align: center;
    padding: var(--s3);
    z-index: 1002;
}

.hero .cta-group {
    display: flex;
    gap: var(--s2);
    flex-wrap: wrap;
    justify-content: center;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero header p {
    max-width: 55ch;
    font-size: clamp(1rem, 2vw, 1.25rem);
    margin: var(--s1) 0;
}

.hero a {
    padding: 0.75em 1.5em;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.hero a.secondary {
    background: transparent;
    border: 2px solid white;
}

/* Sections */

main > section {
    padding: 3rem var(--s3);
}

main > section:not(.hero) {
    max-width: var(--max);
    margin: 0 auto;
}

/* Intro */

.intro {
    text-align: center;
}

.intro p {
    max-width: 60ch;
    margin: 0 auto;
}

/* Services */

.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--s3);
}

.services article {
    position: relative;
    background: var(--subtle);
    border-radius: 8px;
    overflow: hidden;
}

.services figure {
    margin: 0;
    aspect-ratio: 3 / 2;
}

.services figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.services .content {
    padding: var(--s3);
}

.services h2 {
    margin-bottom: var(--s1);
}
.services p + p {
    margin-top: var(--s2);
    color: var(--muted);
}

/* Process */

.process {
    background: var(--subtle);
    box-shadow: 0 0 0 100vmax var(--subtle);
    clip-path: inset(0 -100vmax);
}

.process h2 {
    text-align: center;
    margin-bottom: var(--s3);
}

.process ol {
    list-style: none;
    counter-reset: step;
}

.process li {
    counter-increment: step;
    padding-left: 3rem;
    position: relative;
    margin-bottom: var(--s3);
}

.process li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    width: 2rem;
    height: 2rem;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.process h3 {
    margin-bottom: var(--s1);
}

/* Testimonials */

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s3);
}

.testimonials h2 {
    text-align: center;
    margin-bottom: var(--s3);
}

.testimonials-intro {
    text-align: center;
    max-width: 65ch;
    margin: 0 auto var(--s3);
    font-size: 1.125rem;
    color: var(--muted);
}

.testimonials-more {
    display: block;
    text-align: center;
    margin-top: var(--s3);
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.testimonials-more:hover {
    text-decoration: underline;
}

.testimonials blockquote {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    padding: var(--s3);
    background: var(--subtle);
    border-radius: 8px;
}

.testimonials figure {
    margin: 0;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
}

.testimonials figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide figure if no image */
.testimonials figure:has(img:not([src])),
.testimonials figure:has(img[src=""]) {
    display: none;
}

.testimonials .quote-content {
    position: relative;
}

.testimonials .quote-content::before {
    content: '"';
    position: absolute;
    top: -0.5rem;
    left: -0.25rem;
    font-size: 3rem;
    line-height: 1;
    color: var(--accent);
    opacity: 0.3;
    font-family: Georgia, serif;
}

.testimonials .quote-content p {
    margin: 0;
    font-style: italic;
}

.testimonials cite {
    display: block;
    margin-top: var(--s2);
    font-style: normal;
    color: var(--muted);
}

/* Story */

.story {
    display: grid;
    grid-template-columns: 1fr 1fr 300px;
    grid-template-rows: auto 1fr;
    gap: var(--s2) var(--s3);
}

.story h2 {
    grid-column: 1 / 3;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.story > img {
    grid-column: 3;
    grid-row: 1 / 3;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 900px) {
    .story {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }
    .story h2 {
        grid-column: 1 / -1;
    }
    .story > img {
        grid-column: 1 / -1;
        grid-row: auto;
        height: 300px;
    }
}

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

/* Team */

.team-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s3);
}

.team-grid article {
    position: relative;
    text-align: center;
}

.team-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: var(--s2);
}

.team-grid h3 {
    margin: 0 0 var(--s1);
    font-size: 1.25rem;
}

.team-grid .team-title {
    margin: 0 0 var(--s1);
    color: var(--muted);
    font-size: 0.9rem;
}

.team-grid .team-title:empty,
.team-grid a:empty {
    display: none;
}

.team-grid a {
    color: inherit;
}

/* Contact Info */

.contact-info {
    background: var(--subtle);
    box-shadow: 0 0 0 100vmax var(--subtle);
    clip-path: inset(0 -100vmax);
}

.contact-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s4);
}

.contact-info-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--s2);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-info-card p {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: var(--s2);
}

.contact-info-card dl {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}

.contact-info-card dl > div {
    display: flex;
    gap: var(--s2);
}

.contact-info-card dt {
    font-size: 0.875rem;
    color: var(--muted);
    min-width: 7rem;
    flex-shrink: 0;
}

.contact-info-card dd {
    font-size: 0.9375rem;
}

.contact-info-card dd a {
    color: inherit;
}

/* Privacy */

.privacy {
    max-width: 800px;
}

.privacy-intro {
    font-style: italic;
    color: var(--muted);
    margin-bottom: var(--s4);
}

.privacy h2 {
    margin-top: var(--s4);
}

.privacy h2:first-of-type {
    margin-top: 0;
}

.privacy ul {
    padding-left: 1.5em;
}

.privacy li {
    margin-bottom: var(--s1);
}

.privacy li strong {
    color: var(--text);
}

.privacy-updated {
    margin-top: var(--s4);
    color: var(--muted);
    font-size: 0.875rem;
}

/* Gallery */

.gallery {
    text-align: center;
}

.gallery h2 {
    margin-bottom: var(--s3);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s2);
}

.gallery-grid figure {
    margin: 0;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
}

.gallery-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-grid img:hover {
    transform: scale(1.03);
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Lightbox overlay (public image viewer) */

#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.2s,
        visibility 0.2s;
    cursor: pointer;
}

#lightbox.open {
    opacity: 1;
    visibility: visible;
}

#lightbox img {
    max-width: 90vw;
    max-height: 90dvh;
    object-fit: contain;
    opacity: 1;
}

#lightbox .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    display: flex;
    transition: background 0.15s;
}

#lightbox .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#lightbox .close-btn svg {
    width: 24px;
    height: 24px;
}

/* Instagram */

.instagram {
    text-align: center;
    background: var(--subtle);
    box-shadow: 0 0 0 100vmax var(--subtle);
    clip-path: inset(0 -100vmax);
}

.instagram-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s2);
    max-width: 900px;
    margin: var(--s3) auto;
}

.instagram-grid a {
    display: block;
    aspect-ratio: 1;
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
}

.instagram-grid a img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s ease-out;
}

.instagram-grid a:hover img,
.instagram-grid a:focus img {
    transform: scale(1.05);
}

.instagram-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--s2);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    text-align: left;
}

.instagram-time {
    font-size: 0.75rem;
    opacity: 0.8;
}

.instagram-caption {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.instagram-more {
    display: block;
    text-align: center;
    margin-top: var(--s3);
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.instagram-more:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .calculator__materials {
        grid-template-columns: 1fr;
    }
    .materials {
        grid-template-columns: 1fr;
    }
}

/* Calculator */

.calculator__inputs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s2);
    align-items: end;
    margin-bottom: var(--s3);
}

.calculator__inputs label {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    flex: 1;
    min-width: 180px;
}

.calculator__inputs input {
    padding: 0.75rem;
    font: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.calculator__inputs button {
    padding: 0.75rem 1.5rem;
    font: inherit;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.calculator__main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--s3);
    align-items: start;
}

.calculator__materials {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s2);
}

.material-card {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    padding: var(--s2);
    background: var(--subtle);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.material-card:hover {
    border-color: var(--muted);
}

.material-card:has(input:checked) {
    border-color: var(--accent);
    background: white;
}

.material-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.material-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
    background: white;
}

.material-card strong {
    font-size: 0.9rem;
}

.material-card span {
    color: var(--muted);
}

.material-card small {
    font-size: 0.75rem;
    color: var(--muted);
}

#results {
    padding: var(--s3);
    background: var(--subtle);
    border-radius: 8px;
}

.calculator__total {
    font-size: 1.25rem;
    text-align: right;
    margin-bottom: var(--s2);
}

.calculator__total strong {
    font-size: 1.75rem;
}

#results dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--s1) var(--s2);
}

#results .btn {
    display: block;
    margin-top: var(--s3);
    padding: 0.75rem;
    background: var(--accent);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
}

/* Materials */

.materials {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s2);
}

.materials h2,
.materials > p:first-of-type {
    grid-column: 1 / -1;
}

.materials > p:first-of-type {
    max-width: 65ch;
    margin-bottom: var(--s2);
}

.materials article {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--s3);
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
}

.materials article img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    margin-bottom: var(--s2);
}

.materials h3 {
    margin-bottom: var(--s1);
}
.materials article p {
    color: var(--muted);
}
.materials article p + p {
    margin-top: var(--s2);
}
.materials article p strong {
    color: var(--text);
}

/* Quote form */

.quote {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.quote-intro {
    max-width: 550px;
    margin-bottom: var(--s3);
    color: var(--muted);
}

.quote form {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
    width: 100%;
    max-width: 500px;
    text-align: left;
}

.quote label {
    display: flex;
    flex-direction: column;
    gap: var(--s1);
}

.quote div {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--s2);
}

.quote div:last-of-type {
    grid-template-columns: 1fr 1fr;
}

.quote input,
.quote textarea {
    padding: 0.75rem;
    font: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.quote button {
    padding: 0.75rem;
    font: inherit;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Footer */

footer {
    display: flex;
    gap: var(--s3);
    max-width: var(--max);
    margin: 0 auto;
    padding: 3rem var(--s3);
    background: var(--footer-bg);
    color: #fff;
    /* Full-bleed background */
    box-shadow: 0 0 0 100vmax var(--footer-bg);
    clip-path: inset(0 -100vmax);
}

footer > section {
    flex: 1;
}

footer section h2 {
    font-size: 1rem;
    margin-bottom: var(--s2);
}

footer section p {
    color: rgba(255, 255, 255, 0.7);
}
footer section p + p {
    margin-top: var(--s1);
}
footer ul {
    list-style: none;
}
footer li + li {
    margin-top: var(--s1);
}
footer a {
    color: inherit;
    text-decoration: none;
}
footer a:hover {
    text-decoration: underline;
}

footer > p:last-child {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding-top: var(--s3);
    border-top: 1px solid #ddd;
}

/* Image fade-in (progressive enhancement) */

.js img {
    opacity: 0;
}

/* Editing (only active in edit mode) */

.edit-mode [data-edit] {
    outline: 2px dashed transparent;
    outline-offset: 2px;
    transition: outline-color 0.15s;
}

.edit-mode [data-edit]:focus {
    outline-color: var(--accent);
}

.edit-mode [data-dirty] {
    outline-color: var(--accent);
}

#edit-save {
    position: fixed;
    bottom: var(--s3);
    left: var(--s3);
    padding: 0.75rem 1.5rem;
    font: inherit;
    font-weight: 600;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#edit-save:hover {
    background: var(--accent-hover);
}

/* List editing */

.delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--muted);
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s,
        color 0.15s,
        border-color 0.15s;
}

[data-item]:hover .delete-btn,
.delete-btn:focus {
    opacity: 1;
}

.delete-btn:hover {
    color: #c0392b;
    border-color: #c0392b;
}

[data-deleted] {
    opacity: 0.4;
    text-decoration: line-through;
}

[data-deleted] .delete-btn {
    opacity: 1;
    color: var(--accent);
    border-color: var(--accent);
}

[data-new] {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

.add-btn {
    display: block;
    margin: var(--s3) auto 0;
    padding: 0.5rem 1rem;
    font: inherit;
    background: transparent;
    color: var(--accent);
    border: 1px dashed var(--accent);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.add-btn:hover {
    background: rgba(37, 99, 71, 0.1);
}

/* Hide editing UI when not in edit mode */
.add-btn,
.delete-btn {
    display: none;
}

.edit-mode .add-btn,
.edit-mode .delete-btn {
    display: block;
}

/* Admin Overlay */

#admin-overlay {
    position: fixed;
    bottom: var(--s3);
    right: var(--s3);
    z-index: 9999;
}

#admin-overlay .admin-toggle {
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

#admin-overlay .admin-toggle:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    color: var(--accent);
    transform: scale(1.05);
}

#admin-overlay.open .admin-toggle {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

#admin-overlay .admin-panel {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    right: 0;
    width: 16rem;
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
    transition: all 0.2s ease;
    overflow: hidden;
}

#admin-overlay.open .admin-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#admin-overlay .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#admin-overlay .admin-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #333;
}

#admin-overlay .admin-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0.25rem;
    margin: -0.25rem;
    border-radius: 6px;
    display: flex;
    transition: all 0.15s;
}

#admin-overlay .admin-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

#admin-overlay .admin-content {
    padding: 0.5rem;
}

#admin-overlay .admin-section {
    padding: 0.25rem 0;
}

#admin-overlay .admin-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #999;
    padding: 0.5rem 0.75rem 0.375rem;
}

#admin-overlay .admin-section-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

#admin-overlay .admin-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    font: inherit;
    font-size: 0.875rem;
    background: transparent;
    color: #444;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

#admin-overlay .admin-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

#admin-overlay .admin-item.active {
    background: rgba(175, 142, 104, 0.1);
    color: var(--accent);
}

#admin-overlay .admin-item-icon {
    display: flex;
    color: #888;
    flex-shrink: 0;
}

#admin-overlay .admin-item.active .admin-item-icon {
    color: var(--accent);
}

#admin-overlay .admin-item-label {
    flex: 1;
}

#admin-overlay .admin-item-status {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

#admin-overlay .admin-item-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    min-width: 1.25rem;
    text-align: center;
}

#admin-overlay .admin-item-muted {
    color: #888;
}

#admin-overlay .admin-item-muted .admin-item-icon {
    color: #aaa;
}

/* Shared Modal Styles */

.modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 420px;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-wide .modal-content {
    max-width: 560px;
}

.modal-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.modal-title {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    color: #222;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 0.375rem;
    margin: -0.375rem;
    border-radius: 8px;
    display: flex;
    transition: all 0.15s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-loading,
.modal-error {
    text-align: center;
    color: #888;
    padding: 2rem;
}

.modal-error {
    color: #c00;
}

.modal-btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.modal-btn-primary:hover {
    opacity: 0.9;
}

.modal-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Login Modal */

#login-modal .modal-content {
    max-width: 360px;
}

#login-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0;
}

#login-modal .modal-body {
    padding-top: 0.5rem;
}

.login-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: #444;
}

.login-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font: inherit;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(175, 142, 104, 0.15);
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    margin-top: 1rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 500;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.login-btn:hover {
    background: #8a7253;
}

.login-status {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.login-success {
    text-align: center;
    padding: 1rem 0;
}

.login-success-icon {
    color: var(--accent);
    margin-bottom: 1rem;
}

.login-success h3 {
    margin: 0 0 0.5rem;
    color: #222;
}

.login-success p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

.login-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.login-error p {
    margin: 0;
}

/* Analytics Modal Content */

#analytics-modal .analytics-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

#analytics-modal .analytics-stat {
    background: rgba(0, 0, 0, 0.03);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}

#analytics-modal .analytics-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #222;
    line-height: 1.2;
}

#analytics-modal .analytics-stat-label {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.25rem;
}

#analytics-modal .analytics-section {
    margin-top: 1.25rem;
}

#analytics-modal .analytics-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 0.75rem;
}

#analytics-modal .analytics-table {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 10px;
    overflow: hidden;
}

#analytics-modal .analytics-row {
    display: flex;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

#analytics-modal .analytics-row:last-child {
    border-bottom: none;
}

#analytics-modal .analytics-row-path {
    color: #444;
    font-size: 0.875rem;
}

#analytics-modal .analytics-row-value {
    font-weight: 600;
    color: #222;
    font-size: 0.875rem;
}

/* Image Grid (used in images modal) */

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.image-card {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: var(--subtle);
    transition: outline 0.15s;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.image-card:hover {
    outline-color: var(--muted);
}

.image-card.selected {
    outline-color: var(--accent);
}

.image-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    opacity: 1; /* Override .js img { opacity: 0 } */
}

.image-card .image-key {
    display: block;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-card.image-changed {
    outline: 3px solid var(--accent);
    animation: image-highlight 1.5s ease-out forwards;
}

.image-delete {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s,
        background 0.15s;
}

.image-delete svg {
    width: 14px;
    height: 14px;
}

.image-card:hover .image-delete {
    opacity: 1;
}

.image-delete:hover {
    background: #c00;
}

/* Full image overlay (browse mode) */

#image-full-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.2s,
        visibility 0.2s;
}

#image-full-overlay.open {
    opacity: 1;
    visibility: visible;
}

#image-full-overlay img {
    max-width: 90vw;
    max-height: 90dvh;
    object-fit: contain;
    opacity: 1; /* Override .js img { opacity: 0 } */
}

#image-full-overlay .close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    padding: 0.75rem;
    display: flex;
    transition: background 0.15s;
}

#image-full-overlay .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#image-full-overlay .close-btn svg {
    width: 24px;
    height: 24px;
}

/* Image highlight animation after selection */

@keyframes image-highlight {
    0% {
        outline-color: var(--accent);
        outline-width: 3px;
    }
    100% {
        outline-color: transparent;
        outline-width: 2px;
    }
}

.edit-mode [data-image].image-changed {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    animation: image-highlight 1.5s ease-out forwards;
}

/* Clickable images in edit mode */

.edit-mode [data-image] {
    cursor: pointer;
    outline: 2px dashed transparent;
    outline-offset: 2px;
    transition: outline-color 0.15s;
}

.edit-mode [data-image]:hover {
    outline-color: var(--accent);
}

/* Image dirty state */

.edit-mode [data-image][data-dirty] {
    outline: 2px solid var(--accent);
}

/* Mobile */

@media (max-width: 768px) {
    /* On mobile, pseudo-element clips dropdown, use direct background */
    nav::before {
        display: none;
    }

    nav {
        background: var(--bg);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        transition:
            background-color 0.2s,
            box-shadow 0.2s;
    }

    body.at-top nav {
        background: transparent;
        box-shadow: none;
    }

    /* Nav menu toggle button */
    nav button {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 2.5rem;
        height: 2.5rem;
        margin-left: auto;
        padding: 0.5rem;
        background: none;
        border: none;
        cursor: pointer;
        color: inherit;
    }

    nav button::before,
    nav button::after,
    nav button span {
        content: "";
        display: block;
        width: 100%;
        height: 1.5px;
        background: currentColor;
        border-radius: 1px;
        transition:
            transform 0.2s,
            opacity 0.2s,
            background-color 0.2s;
    }

    /* Hamburger to X animation */
    nav.menu-open button::before {
        transform: translateY(7px) rotate(45deg);
    }
    nav.menu-open button::after {
        transform: translateY(-7px) rotate(-45deg);
    }
    nav.menu-open button span {
        opacity: 0;
    }

    /* Nav content stays above dropdown */
    nav > a,
    nav > button {
        position: relative;
        z-index: 1;
    }

    /* When menu open at top: restore scrolled (dark) appearance */
    body.at-top nav.menu-open > a,
    body.at-top nav.menu-open > button {
        color: var(--text);
    }

    body.at-top nav.menu-open .logo-mk {
        color: #000;
    }
    body.at-top nav.menu-open .logo-vert::before,
    body.at-top nav.menu-open .logo-vert::after {
        background: #c6af94;
        border-color: #000;
    }
    body.at-top nav.menu-open .logo-horiz {
        background: #c6af94;
        border-color: #000;
        color: #000;
    }

    /* Mobile menu dropdown - extends under nav to provide background */
    nav ul {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: var(--nav-height) var(--s3) var(--s2);
        background: var(--bg);
        box-shadow: 0 8px 12px -4px rgba(0, 0, 0, 0.1);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-0.5rem);
        transition:
            opacity 0.2s,
            visibility 0.2s,
            transform 0.2s;
    }

    nav.menu-open ul {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    nav ul li + li {
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }

    nav ul a {
        display: block;
        padding: 0.875rem 0;
        color: var(--text);
    }

    .calculator__main {
        grid-template-columns: 1fr;
    }
    .calculator__materials {
        grid-template-columns: repeat(2, 1fr);
    }
    .quote div {
        grid-template-columns: 1fr;
    }
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--s2);
    }
    .team-grid img {
        width: 100%;
        height: auto;
    }
    .contact-info-grid {
        grid-template-columns: 1fr;
        gap: var(--s3);
    }
    .contact-info-card + .contact-info-card {
        padding-top: var(--s3);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    footer {
        flex-direction: column;
    }

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

    .testimonials blockquote {
        padding: 0;
        background: none;
    }

    .testimonials .quote-content {
        padding: 0 var(--s2) var(--s2);
    }

    .testimonials .quote-content::before {
        display: none;
    }

    /* Modal mobile */
    .modal-content {
        width: 95%;
        max-height: 80dvh;
        border-radius: 12px;
    }

    .modal-wide .modal-content {
        max-width: none;
    }

    /* Analytics stats mobile */
    #analytics-modal .analytics-stats {
        gap: 0.75rem;
    }

    #analytics-modal .analytics-stat {
        padding: 0.75rem;
    }

    #analytics-modal .analytics-stat-value {
        font-size: 1.5rem;
    }

    /* Image grid mobile */
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Admin panel mobile */
    #admin-overlay .admin-panel {
        width: 15rem;
    }
}
