:root {
  color-scheme: light;
  --paper: #f8f6f0;
  --card: #fffdf8;
  --ink: #272723;
  --muted: #625d52;
  --rule: #dad4c9;
  --accent: #775941;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", monospace;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p, figure { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #815b32; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .64; }
html:has(dialog[open]) { overflow: hidden; }

.shell { width: min(1480px, calc(100% - 32px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--rule); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand strong { display: block; font-family: var(--serif); font-size: 1.32rem; font-weight: 500; line-height: 1; letter-spacing: .13em; }
.brand-line { display: block; margin-top: 5px; color: var(--muted); font-size: .62rem; font-weight: 750; letter-spacing: .1em; white-space: nowrap; }
.brand-mark { width: 33px; height: 33px; display: grid; align-content: center; gap: 4px; padding-left: 7px; background: var(--ink); }
.brand-mark span { width: 19px; height: 2px; background: #efe6d4; transform: skewY(-10deg); }
.brand-mark span:nth-child(2) { width: 13px; }
.header-inner nav { display: flex; align-items: center; gap: clamp(15px, 3vw, 42px); }
.header-home, .header-reviews { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font-size: .92rem; font-weight: 650; }
.header-home:hover, .header-reviews:hover { text-decoration: underline; text-underline-offset: 5px; }
@media (max-width: 380px) {
  .header-inner nav { gap: 8px; }
  .header-home, .header-reviews { font-size: .84rem; }
}
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  gap: 8px; padding: 9px 14px; border: 1px solid transparent; border-radius: 4px;
  font-size: .875rem; font-weight: 680; line-height: 1.25; text-align: center; text-decoration: none;
  transition: color 170ms, background-color 170ms, border-color 170ms;
}
.button-dark { background: var(--ink); color: #fffdf8; border-color: var(--ink); }
.button-dark:hover { background: #434035; border-color: #434035; }
.button-outline { background: transparent; color: var(--ink); border-color: #a49a88; }
.button-outline:hover { background: #f0e8da; border-color: #84735b; }
.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 3; background: var(--ink); color: white; padding: 14px; transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.quick-actions {
  position: fixed; z-index: 2;
  right: max(12px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100% - 24px);
  display: flex; align-items: stretch; gap: 6px; padding: 6px;
  border: 1px solid var(--rule); border-radius: 7px;
  background: var(--card); box-shadow: 0 7px 24px #30231624;
}
.quick-actions .button { padding-inline: clamp(8px, 2.5vw, 14px); }
.quick-actions .button-dark { white-space: nowrap; }
body:has(dialog[open]) :is(.quick-actions, .cabinet-tab) { visibility: hidden; }

.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--accent); font-size: .75rem; font-weight: 750; letter-spacing: .105em; line-height: 1.25; }
.eyebrow > span { width: 15px; height: 1px; flex: 0 0 15px; background: currentColor; }

.collection { padding-block: clamp(28px, 4vw, 60px) 52px; scroll-margin-top: 15px; }
.collection-heading { display: grid; align-items: end; gap: 9px 24px; margin-bottom: 23px; }
.collection-heading h1 { margin-top: 8px; font-family: var(--serif); font-size: clamp(2.2rem, 5vw, 4.2rem); font-weight: 400; letter-spacing: -.052em; line-height: 1.07; }
.collection-heading > p { color: var(--muted); font-size: 1rem; line-height: 1.55; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.filters button {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 44px;
  padding: 8px 12px; border: 1px solid #c6bdad; border-radius: 4px;
  color: #443d34; background: transparent; font-size: .875rem; font-weight: 690;
}
.filters button span { font: .72rem var(--mono); opacity: .88; }
.filters button:hover { background: #ece5d9; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fffdf5; }
.collection-layout, .product-page { display: grid; gap: 24px; align-items: start; }
.slab-results { min-width: 0; }
.catalog-count { color: var(--muted); margin-block: 15px 13px; font-size: .875rem; font-weight: 560; }
.slab-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 15px; }
.slab-card { min-width: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.photo-button { position: relative; display: block; width: 100%; aspect-ratio: 1.48; padding: 0; border: 0; background: #e0d9cc; overflow: hidden; }
.photo-button:focus-visible { outline-offset: -3px; z-index: 1; }
.photo-button img { width: 100%; height: 100%; object-fit: cover; }
.slab-card-info { display: grid; gap: 7px; flex: 1; padding: 14px; }
.slab-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: .82rem; line-height: 1.3; }
.slab-code { font-family: var(--mono); font-size: .78rem; white-space: nowrap; }
.slab-card h3 { font-family: var(--serif); font-weight: 500; line-height: 1.17; font-size: 1.45rem; }
.slab-card h3 a { text-decoration-thickness: 1px; text-underline-offset: .17em; text-decoration-color: transparent; }
.slab-card h3 a:hover { text-decoration-color: currentColor; }
.slab-price { color: var(--muted); line-height: 1.45; font-size: .91rem; }
.slab-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; align-self: end; }
.slab-actions .button { padding-inline: 7px; }

.cabinet-tab {
  --cabinet-size: 56px;
  position: fixed; z-index: 2;
  top: clamp(
    calc(var(--cabinet-viewport-top, 0px) + max(6px, env(safe-area-inset-top, 0px))),
    var(--cabinet-y, calc(46% - 28px)),
    calc(min(var(--cabinet-viewport-bottom, 100%) - max(6px, env(safe-area-inset-bottom, 0px)), var(--cabinet-rail-top, calc(100% - 76px)) - 8px) - var(--cabinet-size))
  );
  left: clamp(
    calc(var(--cabinet-viewport-left, 0px) + max(6px, env(safe-area-inset-left, 0px))),
    var(--cabinet-x, 100%),
    calc(var(--cabinet-viewport-right, 100%) - max(6px, env(safe-area-inset-right, 0px)) - var(--cabinet-size))
  );
  display: grid; align-content: center; justify-items: center; gap: 4px;
  width: var(--cabinet-size); min-height: var(--cabinet-size); padding: 5px 3px;
  border: 1px solid #ae9a80; border-radius: 14px;
  background: #eae1d3; color: #463725; box-shadow: 0 3px 12px #30231626;
  font-size: .72rem; font-weight: 720; line-height: 1.14; text-align: center; text-decoration: none;
  touch-action: none; user-select: none; -webkit-touch-callout: none; cursor: grab;
}
.cabinet-tab:hover { background: #e1d3bf; }
.cabinet-tab.is-dragging { cursor: grabbing; box-shadow: 0 4px 16px #30231642; }
.cabinet-tab .cabinet-icon { width: 25px; height: 23px; margin: 0; }
.cabinet-card { display: none; align-items: start; background: #eae1d3; border: 1px solid #d7cbb9; border-radius: 6px; }
.cabinet-icon { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 32px; height: 30px; margin-top: 3px; padding: 3px; border: 1px solid #876e54; border-radius: 3px; }
.cabinet-icon span { position: relative; display: block; border: 1px solid #a68d72; border-radius: 1px; }
.cabinet-icon span::after { position: absolute; top: 7px; right: 2px; content: ""; width: 1px; height: 4px; background: #725942; }
.cabinet-icon span + span::after { left: 2px; }
.cabinet-card h2 { font: 400 1.5rem/1.06 var(--serif); letter-spacing: -.028em; }
.cabinet-card p { margin-block: 10px 12px; color: #5d4d3d; line-height: 1.5; font-size: .93rem; }
.cabinet-card a { justify-content: flex-start; text-align: left; }

.product-page { padding-block: 25px 55px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 13px; color: var(--accent); text-underline-offset: 4px; font-weight: 650; font-size: .94rem; }
.product-layout { display: grid; gap: 22px; align-items: start; }
.product-image { border-radius: 6px; background: #e9e2d7; }
.product-image img { object-fit: contain; }
.product-detail { padding-block: 7px; }
.product-detail h1 { font: 400 clamp(2.5rem, 6vw, 5rem)/1.01 var(--serif); letter-spacing: -.046em; margin: 8px 0 12px; overflow-wrap: anywhere; }
.product-detail .slab-price { font-size: 1rem; }
.product-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.product-feedback { min-height: 1.25rem; margin-block: 10px; }
.share-field { width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--rule); border-radius: 4px; }
.site-footer { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--rule); color: var(--muted); }
.footer-inner { min-height: 70px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-block: 10px; font-size: .89rem; }

.quote-dialog { width: min(650px, 100% - 18px); max-height: min(94dvh, 960px); padding: 0; border: 1px solid #c8bcab; border-radius: 8px; color: var(--ink); background: var(--card); box-shadow: 0 20px 90px #15100c50; }
.quote-dialog::backdrop { background: rgb(34 29 23 / 66%); }
.quote-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 17px 17px 14px; background: var(--card); border-bottom: 1px solid var(--rule); }
.quote-head h2 { margin-top: 6px; font: 400 clamp(2.05rem, 5.5vw, 2.95rem)/1.08 var(--serif); letter-spacing: -.045em; }
.close-button { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border: 1px solid #bdb2a0; border-radius: 4px; background: transparent; color: var(--ink); font-size: 1.7rem; line-height: 1; }
.close-button:hover { background: #ece5d8; }
.quote-dialog form { padding: 16px 17px 22px; }
.selected-slab { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 12px; padding: 10px 12px; margin-bottom: 14px; border: 1px solid var(--rule); border-radius: 4px; background: #f2ede3; font-size: .9rem; }
.selected-slab a { text-underline-offset: 3px; }
.quote-fields { display: grid; gap: 13px; }
.quote-dialog label, #photos-label { color: var(--ink); font-size: .94rem; line-height: 1.4; font-weight: 670; }
.quote-dialog label > span, #photos-label span { font-weight: 430; color: var(--muted); }
.quote-dialog input:not([type="file"]), .quote-dialog select, .quote-dialog textarea { display: block; margin-top: 5px; padding: 9px 10px; width: 100%; min-height: 44px; background: white; color: var(--ink); border: 1px solid #a99e8d; border-radius: 4px; font-size: 1rem; font-weight: 430; }
.quote-dialog select {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-repeat: no-repeat; background-size: 5px 5px;
}
.quote-dialog textarea { resize: vertical; }
.file-field { margin-block: 17px; padding-block: 13px; border-block: 1px solid var(--rule); }
#photos-help, .quote-chat-help { color: var(--muted); font-size: .875rem; line-height: 1.45; margin-block: 4px 10px; }
.file-picker { position: relative; isolation: isolate; cursor: pointer; }
.file-picker:focus-within { outline: 2px solid #815b32; outline-offset: 3px; }
.file-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.photo-previews { padding: 0; margin: 10px 0 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 105px), 1fr)); gap: 8px; }
.photo-previews:empty { display: none; }
.photo-preview { min-width: 0; border: 1px solid var(--rule); background: #f1ece1; border-radius: 4px; overflow: hidden; }
.photo-preview img, .preview-placeholder { width: 100%; aspect-ratio: 1.52; object-fit: cover; }
.preview-placeholder { display: grid; place-items: center; padding: 3px; text-align: center; font-size: .78rem; color: var(--muted); }
.photo-preview p { padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .81rem; }
.photo-preview button { width: 100%; min-height: 44px; font-size: .85rem; color: #5e4333; border: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.photo-preview button:hover { background: #e8ddcc; }
.quote-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.quote-chat-help { margin-top: 10px; }
.form-status { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.form-status:not(:empty) { margin-top: 7px; }
.form-status[data-tone="error"] { color: #983c28; }
.form-status[data-tone="success"] { color: #365c3b; }
.copy-box { margin-top: 12px; padding: 12px; border: 1px solid var(--rule); background: #f4efe5; border-radius: 4px; }

@media (min-width: 540px) {
  .collection-heading { grid-template-columns: 1fr minmax(180px, 29ch); }
  .collection-heading > p { padding-bottom: 2px; }
  .quote-fields { grid-template-columns: 1fr 1fr; }
  .quote-fields .full-width { grid-column: 1 / -1; }
  .quote-head, .quote-dialog form { padding-inline: 25px; }
}

@media (min-width: 700px) {
  .shell { width: min(1480px, calc(100% - clamp(50px, 8vw, 144px))); }
  .product-layout { grid-template-columns: minmax(0, 1.53fr) minmax(0, 1fr); gap: clamp(24px, 4.1vw, 72px); }
  .product-detail { padding-block: 22px; }
}

@media (min-width: 1000px) {
  .quick-actions { right: max(22px, env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .collection-layout, .product-page { grid-template-columns: minmax(0, 1fr) 218px; gap: 24px; }
  .cabinet-tab { display: none; }
  .cabinet-card {
    position: sticky; top: 20px; align-self: start; display: grid;
    gap: 12px; margin-top: 44px; padding: 19px;
  }
  .product-page .cabinet-card { margin-top: 57px; }
}

@media (min-width: 1330px) {
  .collection-layout, .product-page { grid-template-columns: minmax(0, 1fr) 225px; gap: 26px; }
  .slab-grid { gap: 17px; }
  .slab-card-info { padding: 17px; }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cabinet-card { transition: transform 180ms, box-shadow 180ms; }
  .cabinet-card:hover { transform: translateY(-3px); box-shadow: 0 8px 19px #66482d1f; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
