:root {
    --paper: #f5f1eb;
    --paper-soft: #ebe5dd;
    --page-edge: #e2dbd1;
    --page-max: 1640px;
    --ink: #171615;
    --muted: #6d6861;
    --line: #d7cfc4;
    --accent: #a77c48;
    --dark: #0f1010;
    --white: #fffdfa;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--page-edge);
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

main,
.site-header,
.site-footer {
    width: min(100%, var(--page-max));
    margin-inline: auto;
}

main {
    background: var(--paper);
}

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

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 24px clamp(22px, 5vw, 72px);
    background: rgba(245, 241, 235, .88);
    border-bottom: 1px solid rgba(215, 207, 196, .7);
    backdrop-filter: blur(18px);
}

.brand img {
    width: 164px;
    height: auto;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 22px;
    color: var(--muted);
    font-size: 14px;
}

.main-nav a:hover,
.main-nav a:focus {
    color: var(--accent);
}

.hero {
    min-height: calc(100vh - 92px);
    display: grid;
    grid-template-columns: minmax(280px, 42%) minmax(0, 1fr);
    align-items: stretch;
    background: var(--paper-soft);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(48px, 9vw, 128px) clamp(26px, 7vw, 92px);
}

.home-hero h1 {
    margin-bottom: clamp(28px, 3vw, 46px);
}

.home-hero .button {
    margin-top: clamp(26px, 3vw, 42px);
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .18em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 600;
    line-height: 1.08;
    margin: 0;
}

h1 {
    font-size: clamp(46px, 7vw, 92px);
    max-width: 760px;
}

.gallery-hero h1 {
    font-size: clamp(34px, 4vw, 56px);
    overflow-wrap: anywhere;
}

h2 {
    font-size: clamp(30px, 4vw, 52px);
}

h3 {
    font-size: 24px;
}

.lead {
    max-width: 620px;
    color: var(--muted);
    font-size: 19px;
}

.claim {
    margin: 20px 0 0;
    color: var(--accent);
    font-size: 20px;
}

.rich-copy p {
    margin: 0 0 12px;
}

.rich-copy p:last-child {
    margin-bottom: 0;
}

.rich-copy h2 {
    margin: 0 0 12px;
    font-size: 28px;
}

.rich-copy a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hero-image {
    min-height: 520px;
    background:
        linear-gradient(90deg, rgba(235, 229, 221, .9), rgba(235, 229, 221, .08)),
        url("/media/hero-placeholder.svg") center / cover no-repeat;
}

.section {
    padding: clamp(54px, 8vw, 110px) clamp(22px, 5vw, 72px);
}

.section.dark {
    background: var(--dark);
    color: var(--white);
}

.content-page {
    min-height: 62vh;
}

.content-page h1 {
    margin-bottom: 28px;
}

.content-page .rich-copy {
    max-width: 860px;
}

.about-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: clamp(32px, 6vw, 86px);
    align-items: start;
}

.about-portrait {
    margin: 0;
}

.about-portrait img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.section-head {
    max-width: 760px;
    margin-bottom: 36px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.portfolio-card {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #23211f;
}

.portfolio-card:nth-child(2),
.portfolio-card:nth-child(4) {
    margin-top: 0;
}

.portfolio-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .86;
}

.portfolio-card span {
    position: absolute;
    left: 22px;
    bottom: 20px;
    color: var(--white);
    font-family: "Playfair Display", Georgia, serif;
    font-size: 30px;
    text-shadow: 0 2px 22px rgba(0, 0, 0, .45);
}

.area-gallery-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
    background: var(--white);
    border: 1px solid var(--line);
    text-decoration: none;
}

.area-gallery-card img {
    display: block;
    aspect-ratio: 1 / 1;
    height: auto;
    opacity: 1;
}

.area-gallery-card span {
    position: static;
    min-height: 58px;
    padding: 16px 18px 18px;
    color: var(--muted);
    font-family: Inter, Arial, sans-serif;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.35;
    text-shadow: none;
}

.area-gallery-card:nth-child(2),
.area-gallery-card:nth-child(4) {
    margin-top: 0;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 44px;
    padding: 12px 24px;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.button.solid {
    background: var(--accent);
    color: var(--white);
}

.button.danger {
    border-color: #8e2f24;
    color: #8e2f24;
}

.icon-sprite {
    display: none;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    line-height: 1;
}

.icon-button svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.icon-button.danger {
    border-color: #8e2f24;
    color: #8e2f24;
}

.gallery-grid {
    display: grid;
    grid-auto-flow: dense;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-auto-rows: 170px;
    gap: 14px;
}

.gallery-item {
    min-height: 0;
    background: #252321;
    overflow: hidden;
}

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

.gallery-item:nth-child(6n + 1) {
    grid-column: span 2;
    grid-row: span 2;
}

.gallery-item:nth-child(6n + 3) {
    grid-row: span 2;
}

.gallery-item:nth-child(6n + 5) {
    grid-column: span 2;
}

.portfolio-gallery-grid {
    display: block;
    column-count: 4;
    column-gap: 14px;
}

.portfolio-gallery-grid .gallery-item,
.portfolio-gallery-grid .gallery-item:nth-child(6n + 1),
.portfolio-gallery-grid .gallery-item:nth-child(6n + 3),
.portfolio-gallery-grid .gallery-item:nth-child(6n + 5) {
    display: block;
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: auto;
    break-inside: avoid;
    margin: 0 0 14px;
}

.portfolio-gallery-grid .gallery-item img {
    width: 100%;
    height: auto;
}

.custom-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    grid-auto-rows: auto;
    gap: 10px;
}

.custom-gallery-grid .gallery-item,
.custom-gallery-grid .gallery-item:nth-child(6n + 1),
.custom-gallery-grid .gallery-item:nth-child(6n + 3),
.custom-gallery-grid .gallery-item:nth-child(6n + 5) {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 1 / 1;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: clamp(18px, 4vw, 56px);
    background: rgba(10, 10, 10, .94);
}

.photo-lightbox.is-open {
    display: flex;
}

.photo-lightbox figure {
    margin: 0;
    max-width: min(1180px, 82vw);
    max-height: 88vh;
}

.photo-lightbox img {
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
}

.photo-lightbox figcaption {
    min-height: 28px;
    margin-top: 12px;
    color: rgba(255, 253, 250, .78);
    text-align: center;
    font-size: 14px;
}

.photo-lightbox figcaption strong,
.photo-lightbox figcaption span {
    display: block;
}

.photo-lightbox figcaption strong {
    color: var(--white);
    font-size: 16px;
}

.photo-lightbox figcaption span {
    max-width: 760px;
    margin: 6px auto 0;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: 1px solid rgba(255, 253, 250, .35);
    background: rgba(15, 16, 16, .65);
    color: var(--white);
    cursor: pointer;
}

.lightbox-close {
    top: 22px;
    right: 22px;
    width: 46px;
    height: 46px;
    font-size: 32px;
    line-height: 1;
}

.lightbox-nav {
    top: 50%;
    width: 54px;
    height: 72px;
    transform: translateY(-50%);
    font-size: 48px;
    line-height: 1;
}

.lightbox-prev {
    left: 22px;
}

.lightbox-next {
    right: 22px;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: calc(100vh - 92px);
}

.admin-sidebar {
    padding: 32px;
    background: #171615;
    color: var(--white);
}

.admin-sidebar h3 {
    margin-bottom: 28px;
}

.admin-nav {
    display: grid;
    gap: 4px;
}

.admin-sidebar a,
.admin-nav-title {
    display: block;
    padding: 9px 0;
    color: #d9d2c9;
}

.admin-nav-title {
    margin-top: 18px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.admin-nav-child {
    padding-left: 18px !important;
    border-left: 1px solid rgba(255, 255, 255, .18);
}

.admin-nav-logout {
    margin-top: 22px;
    color: #ffffff !important;
}

.admin-sidebar a:hover {
    color: #ffffff;
}

.admin-content {
    padding: clamp(28px, 5vw, 64px);
}

.panel {
    max-width: 960px;
    padding: 28px;
    background: var(--white);
    border: 1px solid var(--line);
}

.unread-row {
    font-weight: 700;
}

.message-detail dl {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px 20px;
    margin: 0 0 28px;
}

.message-detail dt {
    color: var(--muted);
    font-weight: 700;
}

.message-detail dd {
    margin: 0;
}

.message-body {
    white-space: pre-wrap;
}

.admin-list-panel {
    margin-top: 26px;
}

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

.contact-honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.field label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 0;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

input[type="checkbox"] {
    width: auto;
    min-height: 0;
    margin-right: 8px;
}

textarea {
    min-height: 140px;
}

.rich-editor {
    min-height: 220px;
    padding: 14px;
    border: 1px solid var(--line);
    background: #fff;
    outline: none;
}

.rich-editor:focus {
    border-color: var(--accent);
}

.rich-editor h2 {
    font-size: 28px;
    margin: 0 0 14px;
}

.rich-editor p {
    margin: 0 0 12px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.editor-toolbar button {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.editor-toolbar button:hover,
.editor-toolbar button:focus {
    border-color: var(--accent);
    color: var(--accent);
}

.table-list {
    width: 100%;
    border-collapse: collapse;
}

.table-list th,
.table-list td {
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.admin-list-panel .table-list {
    font-size: 15px;
}

.admin-list-panel .table-list th,
.admin-list-panel .table-list td {
    white-space: nowrap;
}

.table-list .numeric-cell {
    text-align: right;
}

.table-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 5px;
    color: var(--accent);
}

.table-actions form {
    margin: 0;
}

.admin-filter-form {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 320px) auto auto;
    align-items: end;
    margin-bottom: 28px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 24px;
    color: var(--muted);
}

.page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font-size: 14px;
}

.page-button.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--white);
}

.page-gap {
    color: var(--muted);
}

.qr-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 16, 16, .72);
}

.qr-modal.is-open {
    display: flex;
}

.qr-dialog {
    position: relative;
    width: min(420px, 100%);
    padding: 34px;
    background: var(--paper);
    text-align: center;
}

.qr-dialog img {
    width: 280px;
    height: 280px;
    margin: 22px auto;
    background: var(--white);
}

.qr-dialog a {
    color: var(--accent);
    overflow-wrap: anywhere;
}

.admin-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.admin-photo-card {
    display: grid;
    gap: 10px;
}

.admin-photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #242220;
}

.admin-photo-card strong,
.admin-photo-card span {
    display: block;
}

.admin-photo-card span {
    color: var(--muted);
    font-size: 13px;
}

.admin-photo-card.is-selected img {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.admin-hero-preview {
    width: 180px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 1px solid var(--line);
    margin-bottom: 12px;
}

.photo-select-button {
    display: grid;
    gap: 10px;
    width: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.photo-select-button span {
    color: var(--ink);
}

.status-panel {
    margin-bottom: 22px;
    border-color: var(--accent);
    color: var(--accent);
}

.sortable-photo-list {
    display: grid;
    gap: 14px;
}

.sortable-photo-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #fff;
}

.sortable-photo-row[draggable="true"] {
    cursor: grab;
}

.sortable-photo-row.is-dragging {
    cursor: grabbing;
    opacity: .55;
}

.sortable-photo-row.drag-over {
    border-color: var(--accent);
    background: #faf7f2;
}

.sortable-photo-row.is-hero {
    border-color: var(--accent);
}

.sortable-photo-row img {
    width: 132px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #242220;
}

.photo-row-copy strong,
.photo-row-copy span {
    display: block;
}

.photo-row-copy span {
    color: var(--muted);
    font-size: 13px;
}

.hero-badge {
    width: fit-content;
    margin-top: 7px;
    padding: 3px 8px;
    border: 1px solid var(--accent);
    color: var(--accent) !important;
    font-size: 12px !important;
}

.photo-row-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.photo-edit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 24px;
    align-items: start;
}

.photo-meta-panel img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    margin-bottom: 22px;
    background: #242220;
}

.photo-meta-panel dl {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 8px 14px;
    margin: 18px 0 0;
}

.photo-meta-panel dt {
    color: var(--muted);
    font-size: 13px;
}

.photo-meta-panel dd {
    margin: 0;
}

.site-footer {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr);
    gap: 28px;
    padding: 36px clamp(22px, 5vw, 72px);
    background: var(--white);
    color: var(--muted);
    font-size: 14px;
}

.site-footer img {
    width: 150px;
}

.footer-heading {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-weight: 600;
}

.footer-links,
.social-links {
    display: grid;
    gap: 8px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.social-link svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex: 0 0 auto;
}

address {
    margin: 0;
    font-style: normal;
}

@media (max-width: 860px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-nav {
        justify-content: flex-start;
    }

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

    .about-layout {
        grid-template-columns: 1fr;
    }

    .about-portrait {
        max-width: 420px;
    }

    .hero-image {
        min-height: 380px;
        order: -1;
    }

    .portfolio-grid,
    .gallery-grid,
    .site-footer,
    .admin-shell,
    .sortable-photo-row {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-auto-rows: auto;
        gap: 10px;
    }

    .gallery-item,
    .gallery-item:nth-child(6n + 1),
    .gallery-item:nth-child(6n + 3),
    .gallery-item:nth-child(6n + 5) {
        grid-column: auto;
        grid-row: auto;
        aspect-ratio: 4 / 3;
    }

    .portfolio-gallery-grid {
        column-count: 2;
    }

    .portfolio-gallery-grid .gallery-item,
    .portfolio-gallery-grid .gallery-item:nth-child(6n + 1),
    .portfolio-gallery-grid .gallery-item:nth-child(6n + 3),
    .portfolio-gallery-grid .gallery-item:nth-child(6n + 5) {
        aspect-ratio: auto;
    }

    .photo-lightbox figure {
        max-width: 100%;
    }

    .lightbox-nav {
        width: 44px;
        height: 58px;
        font-size: 38px;
    }

    .photo-row-actions {
        justify-content: flex-start;
    }

    .photo-edit-layout {
        grid-template-columns: 1fr;
    }

    .portfolio-card,
    .portfolio-card:nth-child(2),
    .portfolio-card:nth-child(4) {
        min-height: 280px;
        margin-top: 0;
    }

    .area-gallery-card,
    .area-gallery-card:nth-child(2),
    .area-gallery-card:nth-child(4) {
        min-height: 0;
    }
}

@media (max-width: 520px) {
    .portfolio-gallery-grid {
        column-count: 1;
    }
}
