:root {
    --ink: #16130f;
    --paper: #f6f1e8;
    --gold: #b8893a;
    --gold-deep: #8a6424;
    --line: rgba(22, 19, 15, 0.12);
    --muted: #6f675d;
    --danger: #9a3b32;
    --ok: #2f6b45;
    --shadow: 0 24px 60px rgba(22, 19, 15, 0.16);
    font-family: "Outfit", sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--paper);
}

a { color: inherit; }

button, input, textarea {
    font: inherit;
}

body.viewer-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--stage, #f3f0ea);
    color: var(--ink);
}

.topbar, .dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
}

.brand {
    font-family: "Fraunces", serif;
    font-size: 1.4rem;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.ghost-link {
    color: inherit;
    text-decoration: none;
    border: 1px solid rgba(247, 241, 231, 0.25);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.92rem;
}

model-viewer {
    display: block;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--stage, #f3f0ea);
    --poster-color: var(--stage, #f3f0ea);
}

.viewer-loading {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 22px;
    background: var(--stage, #f3f0ea);
    transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}

.viewer-loading.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.viewer-loading img,
.viewer-loading .brand {
    animation: heartbeat 1.3s ease-in-out infinite;
    transform-origin: center;
}

.viewer-loading.is-done img,
.viewer-loading.is-done .brand {
    animation-play-state: paused;
}

.viewer-loading img {
    width: min(220px, 60vw);
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

@keyframes heartbeat {
    0%, 40%, 100% { transform: scale(1); }
    12% { transform: scale(1.08); }
    24% { transform: scale(1.01); }
    32% { transform: scale(1.12); }
}

model-viewer {
    opacity: 0;
    transition: opacity 0.7s ease;
}

model-viewer.is-shown { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
    .viewer-loading img,
    .viewer-loading .brand { animation: none; }
}

.viewer-loading-track {
    width: 160px;
    height: 3px;
    border-radius: 999px;
    background: rgba(22, 19, 15, 0.12);
    overflow: hidden;
}

.viewer-loading-track span {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--gold-deep);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s ease;
}

.empty-stage {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    text-align: center;
    padding: 24px;
}

.empty-stage p { color: var(--muted); }

.dock {
    align-items: end;
}

.product-copy h1 {
    margin: 0 0 6px;
    font-family: "Fraunces", serif;
    font-weight: 500;
    font-size: 1.8rem;
}

.product-copy p {
    margin: 0;
    max-width: 460px;
    color: rgba(247, 241, 231, 0.72);
}

.hint {
    margin-top: 10px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gold);
}

.switcher {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chip {
    text-decoration: none;
    border-radius: 999px;
    padding: 8px 12px;
    border: 1px solid rgba(247, 241, 231, 0.2);
    color: rgba(247, 241, 231, 0.8);
}

.chip.is-active {
    background: var(--gold);
    color: #1a140c;
    border-color: var(--gold);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 14px;
    border: 0;
    cursor: pointer;
    background: var(--ink);
    color: #fff;
}

@media (max-width: 900px) {
    .dock, .topbar { align-items: start; flex-direction: column; }
    .switcher { justify-content: flex-start; }
    model-viewer { height: 100dvh; }
}


.viewer-page.is-dark { color: #f6f1e8; }
.viewer-page.is-dark .viewer-loading-track { background: rgba(246, 241, 232, 0.18); }
.viewer-page.is-dark .viewer-loading-track span { background: #d8b16a; }


/* Home */

body.home-page {
    min-height: 100vh;
    background: #f3f0ea;
    color: var(--ink);
}

body.is-locked { overflow: hidden; }

.home-head {
    display: flex;
    justify-content: center;
    padding: 56px 24px 40px;
}

.home-logo { display: inline-flex; text-decoration: none; }
.home-logo img { display: block; width: auto; max-width: min(240px, 60vw); max-height: 110px; object-fit: contain; }
.home-logo .brand { font-size: 2rem; letter-spacing: 0.2em; }

.home-main { width: min(1120px, 100%); margin: 0 auto; padding: 0 24px 80px; }

.home-empty { margin: 40px 0; text-align: center; color: var(--muted); }

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.product-card {
    display: grid;
    gap: 14px;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    text-align: center;
    cursor: pointer;
}

.product-media {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(22, 19, 15, 0.06), 0 10px 30px rgba(22, 19, 15, 0.06);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-letter {
    font-family: "Fraunces", serif;
    font-size: 4.5rem;
    color: #c9a15c;
}

.product-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(22, 19, 15, 0.82);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.product-name {
    font-family: "Fraunces", serif;
    font-size: 1.25rem;
    font-weight: 500;
}

.product-card:hover .product-media,
.product-card:focus-visible .product-media {
    transform: translateY(-4px);
    box-shadow: 0 2px 4px rgba(22, 19, 15, 0.06), 0 22px 44px rgba(22, 19, 15, 0.12);
}

.product-card:hover .product-media img { transform: scale(1.04); }
.product-card:focus-visible { outline: none; }
.product-card:focus-visible .product-media { outline: 3px solid var(--gold); outline-offset: 3px; }

.stage {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: #f3f0ea;
}

.stage[open] { display: flex; flex-direction: column; animation: stage-in 0.3s ease; }
.stage::backdrop { background: rgba(22, 19, 15, 0.6); }

@keyframes stage-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: none; }
}

.stage-head {
    position: absolute;
    inset: 0 0 auto;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    pointer-events: none;
}

.stage-head strong { font-family: "Fraunces", serif; font-size: 1.3rem; font-weight: 500; }

.stage-close {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 6px 20px rgba(22, 19, 15, 0.16);
    cursor: pointer;
    pointer-events: auto;
}

.stage-close svg { width: 20px; height: 20px; fill: currentColor; }
.stage-close:hover { background: var(--ink); color: #fff; }

.stage iframe { flex: 1; width: 100%; border: 0; }

@media (max-width: 900px) {
    .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}

@media (max-width: 540px) {
    .home-head { padding: 36px 20px 28px; }
    .home-main { padding: 0 14px 56px; }
    .product-grid { gap: 14px; }
    .product-card { gap: 10px; }
    .product-media { border-radius: 14px; }
    .product-letter { font-size: 3rem; }
    .product-badge { top: 8px; right: 8px; padding: 3px 8px; font-size: 0.68rem; }
    .product-name { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .product-media, .product-media img, .stage[open] { transition: none; animation: none; }
}
