:root {
    --ink: #ece6d6;
    --muted: #9a927f;
    --paper: #14110d;
    --panel: #1d1913;
    --line: #3a3328;
    --accent: #c47a2c;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.site-header,
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--site-chrome-block-inset) var(--site-chrome-inline-inset);
    border-bottom: 1px solid var(--line);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--paper);
}

body.has-intro-hero .site-header {
    background: var(--site-header-overlay);
}

body.has-intro-hero.has-intro-stage .intro-stage,
body.has-intro-hero:not(.has-intro-stage) .intro-hero {
    margin-top: calc(-1 * var(--site-header-height, 0px));
}

body.has-intro-hero.has-intro-stage .intro-stage-chrome {
    padding-top: calc(var(--intro-featured-top-headers) * var(--site-header-height, 0px));
}

body.is-news.has-intro-hero.has-intro-stage .intro-stage-chrome {
    padding-top: calc(var(--news-feed-top-headers) * var(--site-header-height, 0px));
}

body.is-gallery.has-intro-hero.has-intro-stage .intro-stage-chrome {
    padding-top: calc(var(--gallery-top-headers) * var(--site-header-height, 0px));
}

.intro-hero {
    width: 100%;
}

.intro-hero img {
    display: block;
    width: 100%;
    height: auto;
}

.intro-stage {
    position: relative;
    width: 100%;
    min-height: var(--intro-hero-height);
    height: var(--intro-hero-height);
    overflow: hidden;
}

.intro-stage .intro-hero {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--intro-hero-height);
    overflow: hidden;
}

.intro-stage .intro-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.intro-stage-chrome {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: var(--intro-hero-height);
}

.intro-stage-body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: visible;
}

body.is-news .intro-stage-body,
body.is-gallery .intro-stage-body {
    width: 100%;
    justify-content: center;
}

body.is-home .featured-showcase,
.news-feed,
.gallery-feed {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    gap: var(--catalog-grid-gap);
    padding: var(--catalog-grid-gap);
}

body.is-home .featured-showcase {
    width: max-content;
    background: var(--featured-panel-overlay);
}

body.is-news .news-feed {
    width: min(100%, var(--news-feed-max-width));
    margin-inline: auto;
    background: var(--news-feed-panel-overlay);
}

body.is-gallery .gallery-feed {
    width: min(100%, var(--gallery-feed-max-width));
    margin-inline: auto;
    background: var(--gallery-panel-overlay);
}

.feed-pagination,
.feed-pagination ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--catalog-grid-gap);
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.feed-pagination a,
.feed-pagination [aria-current="page"] {
    color: var(--ink);
    text-decoration: none;
}

.feed-pagination [aria-current="page"] {
    color: var(--accent);
}

.feed-pagination a:hover,
.feed-pagination a:focus-visible {
    color: var(--accent);
}

.news-feed .page-head,
.news-feed .post,
.news-feed .copy,
.gallery-feed .page-head {
    max-width: none;
}

.news-feed .post-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

body.is-home .gallery-grid {
    width: max-content;
    max-width: 100%;
    justify-content: center;
    grid-template-columns: repeat(var(--featured-limit), minmax(0, var(--featured-card-max-width)));
}

body.is-home .gallery-grid .card {
    width: 100%;
    max-width: var(--featured-card-max-width);
}

.intro-stage-body .featured-showcase .gallery-grid,
.intro-stage-body .gallery-feed .gallery-grid {
    margin-top: 0;
}

body.has-intro-stage.has-intro-hero main:not(:has(*)) {
    padding: 0;
}

body.is-news.has-intro-hero .intro-stage,
body.is-gallery.has-intro-hero .intro-stage {
    height: auto;
    overflow: visible;
}

.site-header-end {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.language-switcher {
    display: flex;
    align-items: center;
}

.language-switcher-label,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.language-switcher select {
    margin: 0;
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.site-footer {
    border-bottom: 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    margin-top: 4rem;
}

.studio-edit {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.studio-edit:hover,
.studio-edit:focus-visible {
    color: var(--ink);
}

.edit-icon {
    display: block;
    width: var(--studio-edit-icon-size);
    height: var(--studio-edit-icon-size);
}

/* The trigger lives in shadow DOM; ::part reaches the floating bird. */
wagtail-userbar::part(userbar) {
    bottom: var(--wagtail-userbar-bottom);
    inset-inline-end: var(--site-chrome-inline-inset);
}

.product-nav {
    /* Direct child of body: main's container-type would otherwise trap position:fixed. */
    position: fixed;
    top: 50%;
    z-index: 15;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--product-nav-size);
    height: var(--product-nav-size);
    transform: translateY(-50%);
    border-radius: 50%;
    background: rgb(0 0 0 / var(--product-nav-circle-opacity));
    color: rgb(255 255 255 / var(--product-nav-chevron-opacity));
    text-decoration: none;
}

.product-nav--prev {
    inset-inline-start: var(--product-nav-inline-inset);
}

.product-nav--next {
    inset-inline-end: var(--product-nav-inline-inset);
}

.product-nav:hover,
.product-nav:focus-visible {
    background: rgb(0 0 0 / var(--product-nav-circle-hover-opacity));
    color: rgb(255 255 255 / var(--product-nav-chevron-hover-opacity));
}

.product-nav__chevron {
    display: block;
    width: var(--product-nav-chevron-size);
    height: var(--product-nav-chevron-size);
}

.product-nav--next .product-nav__chevron {
    transform: scaleX(-1);
}

.mark {
    font-variant: small-caps;
    letter-spacing: 0.16em;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 1.25rem;
}

main {
    width: min(var(--layout-content-max), calc(100% - 3rem));
    margin: 0 auto;
    padding: 2.5rem 0 4rem;
    container-type: inline-size;
    container-name: site-main;
}

main:has(.product) {
    width: min(var(--product-layout-max), calc(100% - 3rem));
}

.page-head,
.hero,
.intro,
.teaser,
.copy,
.post {
    max-width: 38rem;
}

.hero h1,
.page-head h1,
.post h1,
.news-digest-featured h2 {
    font-size: clamp(2.4rem, 6vw, 4.4rem);
    line-height: 0.95;
    font-weight: 500;
    margin: 0 0 1rem;
}

.product > .page-head {
    max-width: none;
    text-align: left;
    margin-bottom: 1.5rem;
}

.product-summary {
    margin: 0;
    order: 5;
}

.product-summary p,
.product-summary ul,
.product-summary ol {
    margin: 0 0 0.75rem;
}

.product-summary ul,
.product-summary ol {
    padding-left: 1.25rem;
}

.eyebrow,
.meta,
.date {
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.72rem;
    font-family: "Segoe UI", sans-serif;
}

.cta,
.buy .providers button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}

.buy .providers button {
    margin-top: 0;
}

.cta.featured-all-models {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0;
    padding: 0.85em 1.25em;
    font-size: var(--featured-cta-font-size);
    text-align: center;
    text-decoration: none;
    border: none;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--catalog-grid-min), 1fr));
    gap: var(--catalog-grid-gap);
    margin-top: 2.5rem;
}

.product-card {
    margin-top: 2.5rem;
    max-width: var(--preview-width);
}

body.is-news .product-card,
body.is-news .product-card .card,
body.is-news .product-card .preview-frame,
body.is-news .product-card .card-placeholder {
    max-width: var(--news-card-max-width);
}

.card {
    max-width: var(--preview-width);
    background: var(--panel);
    border: 1px solid var(--line);
}

.card a {
    display: block;
    text-decoration: none;
}

.card-placeholder,
.preview-frame {
    width: 100%;
    max-width: var(--preview-width);
    aspect-ratio: var(--preview-width) / var(--preview-height);
    display: block;
    background: var(--preview-background);
}

.model-viewer-frame {
    position: relative;
    display: block;
    width: var(--model-viewer-width);
    height: var(--model-viewer-height);
    max-width: 100%;
    background: var(--preview-background);
}

.model-viewer-frame > model-viewer {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: var(--preview-background);
    --progress-bar-height: 0;
}

.model-viewer-loader {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    pointer-events: none;
    background: var(--preview-background);
}

.model-viewer-loader[hidden] {
    display: none;
}

.model-viewer-loader-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 42%;
    min-width: 8rem;
}

.model-viewer-spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 0.15rem solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: model-viewer-spin 0.8s linear infinite;
}

.model-viewer-progress {
    display: block;
    width: 100%;
    height: 0.35rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}

.model-viewer-progress-fill {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.2s ease-out;
}

.model-viewer-loader-label {
    margin: 0;
    color: var(--ink);
    font-size: 0.85rem;
}

.model-viewer-switcher {
    position: absolute;
    top: var(--model-viewer-chrome-inset);
    right: var(--model-viewer-chrome-inset);
    z-index: 2;
    max-width: 70%;
    margin: 0;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    pointer-events: auto;
}

.model-viewer-bg-controls {
    position: absolute;
    top: var(--model-viewer-chrome-inset);
    left: var(--model-viewer-chrome-inset);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: var(--model-viewer-bg-controls-gap);
    pointer-events: auto;
}

.model-viewer-bg-picker {
    display: block;
    width: var(--model-viewer-bg-picker-size);
    height: var(--model-viewer-bg-picker-size);
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
}

.model-viewer-bg-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.model-viewer-bg-picker::-webkit-color-swatch {
    border: none;
}

.model-viewer-bg-reset {
    margin: 0;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

@keyframes model-viewer-spin {
    to {
        transform: rotate(360deg);
    }
}

.card-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
}

[data-lightbox] {
    cursor: zoom-in;
}

.preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.card h2 {
    margin: 0;
    padding: 0.7rem 0.85rem 0.9rem;
    font-size: var(--card-title-font-size);
    font-weight: 500;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.product-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.product-col {
    display: contents;
}

.product-hero {
    margin: 0;
    max-width: var(--preview-width);
    order: 1;
}

.product-purchase {
    order: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--offering-button-gap);
    width: 100%;
}

.product-viewer {
    order: 3;
    max-width: 100%;
}

.embed-copy-row {
    position: relative;
    margin-top: 0.6rem;
    max-width: var(--model-viewer-width);
}

.embed-copy {
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
}

html:has(body.embed-page),
body.embed-page {
    height: 100%;
    overflow: hidden;
}

.embed-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.embed-page .model-viewer-frame {
    width: 100%;
    height: auto;
    max-width: none;
    flex: 1 1 auto;
    min-height: 0;
}

.embed-title {
    flex: 0 0 auto;
    min-height: var(--model-viewer-embed-title-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    padding: 0 var(--model-viewer-embed-title-pad-x);
    border-top: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font-size: 1rem;
    line-height: var(--model-viewer-embed-title-line-height);
    text-decoration: none;
    overflow-wrap: break-word;
}

.embed-title:hover,
.embed-title:focus-visible {
    color: var(--accent);
}

.product-hero figcaption,
.product-gallery figcaption {
    color: var(--muted);
    margin: 0.45rem 0 0;
    font-size: 0.95rem;
}

.product-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-min), var(--gallery-thumb-width)));
    gap: 0.9rem 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
    order: 4;
}

.product-gallery figure {
    margin: 0;
}

.preview-frame--thumb {
    max-width: var(--gallery-thumb-width);
}

.post-list {
    list-style: none;
    padding: 0;
}

.post-list li {
    border-top: 1px solid var(--line);
    padding: 1.5rem 0;
}

.post-list .news-article h2 {
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 500;
    margin: 0 0 0.75rem;
}

.news-read-all {
    margin-top: 0.75rem;
}

.news-read-all > summary {
    cursor: pointer;
    width: fit-content;
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    list-style: none;
}

.news-read-all > summary::-webkit-details-marker,
.news-read-all > summary::marker {
    display: none;
    content: "";
}

.news-read-all[open] > summary {
    display: none;
}

.news-digest {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--catalog-grid-gap);
    margin-top: 2.5rem;
}

.news-digest-featured h2 a {
    color: inherit;
    text-decoration: none;
}

.news-digest-all {
    align-self: flex-start;
}

.news-digest-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--catalog-grid-min), 1fr));
    gap: var(--catalog-grid-gap);
    list-style: none;
    margin: 0;
    padding: 0;
}

.news-digest-cards a {
    display: block;
    height: 100%;
    padding: 0.85rem;
    border: 1px solid var(--line);
    text-decoration: none;
}

.news-digest-cards .date {
    display: block;
    color: var(--muted);
}

.news-digest-cards strong {
    display: block;
    margin-top: 0.35rem;
}

.news-digest-cards p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.buy {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--offering-button-gap);
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
}

.offering-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--offering-button-gap);
    width: 100%;
    margin: 0;
    padding: var(--offering-button-padding);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

a.offering-btn {
    text-decoration: none;
}

.offering-btn__title {
    min-width: 0;
}

.offering-btn__price {
    flex: 0 0 auto;
    white-space: nowrap;
}

.buy label,
.buy input {
    display: block;
    width: min(24rem, 100%);
}

.buy input {
    margin: 0.35rem 0 1rem;
    padding: 0.55rem 0.6rem;
    background: var(--panel);
    border: 1px solid var(--line);
    color: var(--ink);
}

.providers {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.messages {
    list-style: none;
    margin: 0;
    padding: 0.8rem 1.5rem;
    background: #2a1d10;
}

.beat img {
    width: 100%;
    height: auto;
}

.beat figcaption {
    color: var(--muted);
    margin-top: 0.5rem;
}

.lightbox {
    position: fixed;
    inset: 0;
    max-width: min(var(--layout-content-max), calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    margin: auto;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
}

.lightbox::backdrop {
    background: var(--lightbox-backdrop);
}

.lightbox figure {
    margin: 0;
}

.lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    object-fit: contain;
    background: var(--preview-background);
}

.lightbox figcaption {
    color: var(--muted);
    margin: 0;
    padding: 0.7rem 0.85rem 0.9rem;
    font-size: 0.95rem;
}

.lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
