@font-face {
    font-family: 'Gambarino';
    src: url('/xshop/gambarino.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --ground: #0d120f;
    --surface: #151c17;
    --surface-hover: #1b241d;
    --edge: rgba(180, 199, 159, 0.16);
    --ink: #e6ebe1;
    --muted: #8f9a8e;
    --sage: #b4c79f;
    --sage-dim: rgba(180, 199, 159, 0.34);
    --clay: #d9a58a;
    --gutter: 24px;
    --display: 'Gambarino', 'Songti SC', 'Noto Serif CJK SC', Georgia, serif;
    --sans: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--ground); }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

:focus-visible { outline: 2px solid var(--sage); outline-offset: 3px; }

a { color: inherit; }

.page {
    width: 100%;
    max-width: 880px;
    min-height: 100vh;
    min-height: 100dvh;
    margin-inline: auto;
    padding-block: 0 max(28px, env(safe-area-inset-bottom));
    padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    gap: 28px;
}
.page.wide { max-width: 1080px; }
.page > main { flex: 1; }

/* notice */
.notice {
    margin: 0;
    padding: max(10px, env(safe-area-inset-top)) var(--gutter) 10px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    font-size: 0.85rem;
}

/* masthead */
.masthead {
    position: sticky;
    top: 0;
    z-index: 5;
    padding-block: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--ground);
}
body:not([data-page='shop']):not([data-page='catalog']) .masthead { padding-top: max(14px, env(safe-area-inset-top)); }
.wordmark {
    font-family: var(--display);
    font-size: 1.75rem;
    line-height: 1;
    text-decoration: none;
    letter-spacing: 0.01em;
}
.wordmark.small { font-size: 1.35rem; }
.masthead-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.nav-link:hover { color: var(--ink); }
.cart-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 6px 0 10px;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}
.cart-open:hover { color: var(--sage); }
.cart-count { min-width: 1ch; color: var(--sage); font-variant-numeric: tabular-nums; }

/* type */
.headline {
    margin: 0 0 28px;
    max-width: 16ch;
    font-family: var(--display);
    font-weight: 400;
    font-size: clamp(2.5rem, 9vw, 4.25rem);
    line-height: 1.04;
    text-wrap: balance;
}
.headline.small { max-width: none; margin-bottom: 12px; font-size: clamp(1.9rem, 6vw, 2.5rem); line-height: 1.12; }
.note { margin: 0; color: var(--muted); max-width: 46ch; }
.note.noscript, .error { color: var(--clay); }
.note.done { margin-top: 20px; color: var(--sage); }
.fine { margin: 0; color: var(--muted); font-size: 0.85rem; }
.error { margin: 0; font-size: 0.95rem; }
.was { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.save { margin: -8px 0 0; color: var(--sage); font-size: 0.95rem; }
.price, .totals dd, .tracking strong { font-variant-numeric: tabular-nums; }

/* catalog */
.shelf + .shelf { margin-top: 40px; }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    grid-template-areas: 'stage title' 'stage tag' 'stage price';
    grid-template-rows: auto 1fr auto;
    gap: 4px 16px;
    padding: 12px;
    color: inherit;
    text-decoration: none;
    background: var(--surface);
    border-radius: 20px;
    transition: background-color 0.2s ease;
}
.card:hover { background: var(--surface-hover); }
.card .stage { grid-area: stage; aspect-ratio: 1; background: none; border-radius: 12px; }
.card .stage .disc { width: 100%; }
.card-title { grid-area: title; margin: 0; align-self: end; font-family: var(--display); font-weight: 400; font-size: 1.35rem; line-height: 1.15; text-wrap: balance; }
.card .tagline { grid-area: tag; margin: 0; font-size: 0.9rem; }
.card .blurb { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; line-height: 1.5; }
.card .price-row { grid-area: price; flex-wrap: wrap; gap: 2px 10px; }
.card .price-row .price { font-size: 1.15rem; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 4px; color: var(--muted); text-decoration: none; transition: color 0.2s ease; }
.back:hover { color: var(--ink); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin-bottom: 4px; color: var(--muted); }
.crumbs .back { margin-bottom: 0; }
.crumb-sep { opacity: 0.5; }

/* product */
main { min-width: 0; }
.product { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
.gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; min-width: 0; }
.stage {
    display: grid;
    place-items: center;
    aspect-ratio: 6 / 5;
    background: var(--surface);
    border-radius: 20px;
}
.stage .disc { width: 56%; }
.stage .photo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* Scrolls sideways when the thumbs outgrow the screen; padding keeps the pressed outline clear of the scroll clip. */
.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px; margin: -4px; scrollbar-width: none; }
.thumb { flex: 0 0 auto; width: 76px; padding: 0; border: 0; border-radius: 12px; background: var(--surface); overflow: hidden; cursor: pointer; opacity: 0.6; transition: opacity 0.2s ease; }
.thumb:hover { opacity: 0.85; }
.thumb[aria-pressed='true'] { opacity: 1; outline: 2px solid var(--sage); outline-offset: 2px; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.video-thumb { position: relative; }
.video-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 16px;
    transform: translateX(2px);
    background: var(--ink);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}
.stage:has(.video) { position: relative; }
.stage .video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: inherit; }
.stage .video.vertical { inset: 0 auto; left: 50%; width: auto; aspect-ratio: 9 / 16; transform: translateX(-50%); border-radius: 12px; }
.video-note { font-size: 0.75rem; }
.specs { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.specs div { padding: 12px 14px; background: var(--surface); border-radius: 12px; }
.specs dt { color: var(--muted); font-size: 0.8rem; }
.specs dd { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; }
.info { display: grid; gap: 18px; align-content: start; min-width: 0; }
.product-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 8vw, 2.75rem); line-height: 1.1; text-wrap: balance; }
.tagline { margin: -8px 0 0; color: var(--muted); max-width: 44ch; }
.price-row { margin: 0; display: flex; align-items: baseline; gap: 16px; }
.price-row .price { font-size: 1.75rem; font-weight: 600; }
.stock { font-size: 0.95rem; white-space: nowrap; }
.stock.ok { color: var(--sage); }
.stock.low, .stock.out { color: var(--clay); }
.desc { display: grid; gap: 12px; max-width: 54ch; line-height: 1.6; }
.desc p { margin: 0; }

.buy { display: none; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--edge); border-radius: 12px; }
.qty button {
    width: 48px;
    height: 48px;
    font: inherit;
    font-size: 1.25rem;
    color: var(--ink);
    background: none;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.qty button:hover:not(:disabled) { background: var(--surface-hover); }
.qty button:disabled { color: var(--muted); cursor: default; }
.qty output { min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }

.ship { display: grid; gap: 6px; }
.ship > span { color: var(--muted); font-size: 0.9rem; }
.ship output { color: var(--muted); font-size: 0.9rem; }

.details { display: grid; gap: 8px; }
.details details { background: var(--surface); border-radius: 14px; }
.details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 52px;
    padding: 0 16px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: '+'; color: var(--sage); font-size: 1.25rem; font-weight: 400; }
.details details[open] summary::after { content: '\2212'; }
.details details > :not(summary) { margin: 0; padding: 0 16px 16px; color: var(--muted); line-height: 1.6; }
.details details > ol { padding-left: 36px; }

.buybar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px max(var(--gutter), env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
    background: var(--surface);
}
.buybar .price { font-size: 1.35rem; font-weight: 600; }
.buybar-price { display: flex; align-items: baseline; gap: 8px; }
.buybar .btn { flex: 1; max-width: 260px; }
body[data-page='shop'] .page { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

/* buttons */
.btn {
    min-height: 48px;
    padding: 0 24px;
    font: inherit;
    font-weight: 600;
    color: var(--ground);
    background: var(--sage);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.btn:hover:not(:disabled) { background: #c8d8b6; }
.btn:disabled { cursor: default; color: var(--muted); background: var(--surface-hover); }
.btn.wide { width: 100%; }
.text-btn, .text-link {
    padding: 8px 0;
    font: inherit;
    color: var(--muted);
    background: none;
    border: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}
.text-btn:hover, .text-link:hover { color: var(--ink); }
.text-link { color: var(--sage); }

/* forms */
.field { display: grid; gap: 6px; text-align: left; }
.field span { color: var(--muted); font-size: 0.9rem; }
input, select {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    font: inherit;
    color: var(--ink);
    background: var(--ground);
    border: 1px solid var(--edge);
    border-radius: 10px;
}
input:focus, select:focus { border-color: var(--sage-dim); }

.coupon { display: grid; gap: 6px; }
.coupon label { color: var(--muted); font-size: 0.9rem; }
.coupon-row { display: flex; gap: 10px; }
.coupon-row .btn { flex: none; }
.coupon input[readonly] { color: var(--muted); }

/* mini CD */
.disc {
    position: relative;
    width: 148px;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background: #1a231c;
    isolation: isolate;
    --tilt: 0deg;
}
.disc-sm { width: 84px; }
.disc-xl { width: 100%; }
.disc-drift, .disc-sheen, .disc-grooves, .disc-label { position: absolute; inset: 0; }
.disc-sheen {
    border-radius: 50%;
    background: conic-gradient(
        #26312a 0deg, #7f9170 34deg, #1a231c 70deg, #d3dfc4 104deg, #1a231c 140deg,
        #2a362d 180deg, #7f9170 214deg, #1a231c 250deg, #c3d1b2 284deg, #1a231c 320deg, #26312a 360deg
    );
    transform: rotate(var(--tilt));
    transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.disc-grooves {
    border-radius: 50%;
    background: repeating-radial-gradient(circle at center, rgba(13, 18, 15, 0.28) 0 1px, transparent 1px 3px);
    -webkit-mask: radial-gradient(circle closest-side, transparent 0 56%, #000 57%);
    mask: radial-gradient(circle closest-side, transparent 0 56%, #000 57%);
}
.disc-label { width: 100%; height: 100%; }
.label-fill { fill: var(--clay); }
.label-waves { stroke: var(--ground); }
.hub-ring { fill: rgba(230, 235, 225, 0.3); }
.hub-hole { fill: var(--ground); }
.disc::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(230, 235, 225, 0.22);
    pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
    .disc-drift { animation: disc-drift 36s linear infinite; }
    [data-status='pending'] .disc-drift { animation-duration: 3.2s; }
}
@keyframes disc-drift { to { transform: rotate(360deg); } }

/* cart */
.cart {
    width: min(440px, 100%);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0 0 0 auto;
    padding: max(20px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) var(--gutter);
    color: var(--ink);
    background: var(--ground);
    border: 0;
    border-left: 1px solid var(--edge);
    overflow-y: auto;
}
.cart::backdrop { background: rgba(5, 8, 6, 0.72); }
.cart { flex-direction: column; gap: 20px; }
.cart[open] { display: flex; }
@media (prefers-reduced-motion: no-preference) {
    .cart, .cart::backdrop { transition: transform 0.22s ease-in, opacity 0.22s ease-in, overlay 0.22s allow-discrete, display 0.22s allow-discrete; }
    .cart { transform: translateX(100%); }
    .cart::backdrop { opacity: 0; }
    .cart[open], .cart[open]::backdrop { transition-duration: 0.34s; transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
    .cart[open] { transform: none; }
    .cart[open]::backdrop { opacity: 1; }
    @starting-style {
        .cart[open] { transform: translateX(100%); }
        .cart[open]::backdrop { opacity: 0; }
    }
}
.cart-head { display: flex; align-items: center; justify-content: space-between; }
.cart-head h2:focus { outline: none; }
.cart-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.75rem; }
.cart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cart-line {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas: 'thumb name price' 'thumb controls controls';
    align-items: center;
    gap: 6px 14px;
    padding: 14px 16px;
    background: var(--surface);
    border-radius: 14px;
}
.cart-line .disc { grid-area: thumb; width: 56px; }
.cart-line .name { grid-area: name; font-family: var(--display); font-size: 1.15rem; }
.cart-line .price { grid-area: price; text-align: right; }
.cart-line .controls { grid-area: controls; display: flex; align-items: center; justify-content: space-between; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button {
    width: 44px;
    height: 44px;
    font: inherit;
    font-size: 1.25rem;
    color: var(--ink);
    background: var(--surface-hover);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.stepper button:hover:not(:disabled) { background: #243028; }
.stepper button:disabled { color: var(--muted); cursor: default; }
.stepper output { min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }
.cart-summary { display: grid; gap: 16px; margin-top: auto; }

/* totals */
.totals { margin: 0; display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; gap: 16px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { padding-top: 8px; font-size: 1.15rem; }
.totals .grand dt { color: var(--ink); }

/* order */
.order { display: grid; gap: 24px; align-content: start; max-width: 560px; }
.order-head { display: flex; align-items: center; gap: 22px; }
.order-head .headline { margin-bottom: 6px; }
.order-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.order-lines li { display: flex; justify-content: space-between; gap: 16px; }
.tracking { margin: 0; display: grid; gap: 2px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--edge); border-radius: 14px; }
.tracking span { color: var(--muted); font-size: 0.9rem; }
.tracking strong { font-size: 1.15rem; font-weight: 600; word-break: break-all; }
.ship-to { display: grid; font-style: normal; color: var(--muted); }

/* lookup + admin */
.lookup { max-width: 460px; }
.lookup-form { margin-top: 24px; display: grid; gap: 16px; justify-items: start; }
.lookup-form .field { width: 100%; }
.admin-bar { margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
.admin-bar .field { flex: 1 1 240px; max-width: 360px; }
.admin-orders { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.admin-order {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px 28px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--edge);
    border-radius: 16px;
}
.admin-order h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 600; }
.admin-order p { margin: 0; color: var(--muted); }
.admin-order .flag { color: var(--clay); }
.admin-order .serials { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; color: var(--ink); word-break: break-all; }
.admin-order form { display: grid; gap: 10px; align-content: start; }
.admin-order .state { color: var(--sage); }

.footer { padding-top: 8px; display: grid; gap: 4px; justify-items: start; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer-links a { color: var(--muted); font-size: 0.9rem; text-decoration: none; transition: color 0.2s ease; }
.footer-links a:hover { color: var(--ink); }

@media (min-width: 641px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
    .card { display: flex; flex-direction: column; gap: 10px; padding: 0; background: none; }
    .card:hover { background: none; }
    .card .stage { aspect-ratio: 4 / 3; background: var(--surface); border-radius: 20px; transition: background-color 0.2s ease; }
    .card:hover .stage { background: var(--surface-hover); }
    .card .stage .disc { width: 50%; }
    .card-title { align-self: auto; margin-top: 6px; font-size: 1.6rem; }
    .card .tagline { flex: 1; font-size: 1rem; }
    .card .price-row .price { font-size: 1.25rem; }
    .page { gap: 32px; }
    .buybar { justify-content: center; gap: 24px; }
    .buybar .btn { flex: 0 1 260px; }
    .stage { aspect-ratio: 4 / 3; }
    .stage .disc { width: 44%; }
    .admin-order { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.1fr); }
}

@media (min-width: 900px) {
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
    .gallery { position: sticky; top: 84px; }
    .stage { aspect-ratio: 1; }
    .stage .disc { width: 62%; }
    .buy { display: flex; align-items: center; gap: 12px; }
    .buy .btn { flex: 1; max-width: 320px; }
    .buybar { display: none; }
    body[data-page='shop'] .page { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}
