@font-face { font-family: "General Sans"; src: url("assets/fonts/GeneralSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "General Sans"; src: url("assets/fonts/GeneralSans-Semibold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("assets/fonts/inter-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* Brand Guidelines v1.0 */
:root {
  --charcoal: #1B1D1F;
  --cream: #F9F9F0;
  --terracotta: #C6572C;
  --terracotta-dark: #A9461F;
  --stone: #535F70;
  --cedar: #C6916B;
  --gray-200: #333331;
  --gray-300: #4E4E4C;
  --gray-400: #6B6B68;
  --gray-700: #CACAC1;
  --gray-800: #E2E2D9;
  --gray-900: #F1F1E8;
  --display: "General Sans", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--cream); color: var(--charcoal); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }
[hidden] { display: none !important; }

.overline { font: 700 12px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--terracotta-dark); margin: 0 0 10px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gutter) 12px;
  background: var(--charcoal);
}
.brand img { height: 28px; width: auto; }
.cart-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: transparent; border: 1.5px solid var(--gray-300); border-radius: 999px;
  color: var(--cream); padding: 8px 10px 8px 16px; font: 700 13px var(--body); letter-spacing: .06em; text-transform: uppercase;
}
.cart-btn:hover { border-color: var(--cream); }
.cart-count {
  min-width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center;
  background: var(--terracotta-dark); color: var(--cream); font-size: 12px; letter-spacing: 0;
}
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.3); } }

/* product layout */
.product { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); min-height: calc(100dvh - 60px); }
.stage {
  position: relative; display: flex; flex-direction: column;
  background: radial-gradient(120% 80% at 50% 35%, #3a3632 0%, var(--charcoal) 70%);
  color: var(--cream); min-height: 520px;
  position: sticky; top: 60px; align-self: start; height: calc(100dvh - 60px);
}
.media { position: relative; flex: 1; min-height: 0; display: flex; }
.three { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.photo { flex: 1; min-height: 0; width: 100%; object-fit: contain; padding: 16px var(--gutter) 0; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px var(--gutter) 16px; }
.thumb {
  flex: 0 0 auto; width: 64px; height: 64px; padding: 0; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; background: rgba(249, 249, 240, .08); color: var(--cream);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-pressed="true"] { border-color: var(--cream); }
.thumb.is-3d { display: grid; place-items: center; font: 700 14px var(--body); letter-spacing: .06em; }
.thumb { position: relative; }
.thumb .tag {
  position: absolute; left: 3px; right: 3px; bottom: 3px; padding: 2px 0; border-radius: 6px;
  background: rgba(27, 29, 31, .78); color: var(--cream); font: 700 9px/1.2 var(--body); letter-spacing: .04em; text-transform: uppercase;
}
.photo { touch-action: pan-y; user-select: none; }
.viewer { position: relative; flex: 1; min-height: 0; touch-action: none; }
.viewer canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
.viewer canvas:active { cursor: grabbing; }
.loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--gray-700); font-size: 14px; }
.loading span { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gray-300); border-top-color: var(--terracotta); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px var(--gutter) 20px; }
.hint { margin: 0; font-size: 13px; color: var(--gray-700); }
.views { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(249, 249, 240, .08); }
.views button { border: 0; background: transparent; color: var(--gray-700); padding: 7px 16px; border-radius: 999px; font: 600 13px var(--body); }
.views button[aria-pressed="true"] { background: var(--cream); color: var(--charcoal); }

.info { padding: clamp(28px, 5vw, 56px) var(--gutter) 48px; max-width: 560px; }
.info h1 { font: 600 clamp(36px, 5vw, 56px)/1 var(--display); letter-spacing: -.01em; text-transform: uppercase; margin: 0 0 14px; }
.price { font: 500 20px var(--display); margin: 0 0 6px; }
.tagline { color: var(--gray-400); margin: 0 0 28px; }

.opt { border: 0; padding: 0; margin: 0 0 24px; }
.opt legend { display: flex; width: 100%; align-items: baseline; gap: 8px; padding: 0; margin-bottom: 12px; font: 700 12px var(--body); letter-spacing: .06em; text-transform: uppercase; }
.opt legend span { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--gray-400); font-size: 14px; }
.link { margin-left: auto; border: 0; background: none; padding: 0; font: 600 14px var(--body); letter-spacing: 0; text-transform: none; color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 0;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(27, 29, 31, .18);
  outline-offset: 3px; transition: transform .15s ease;
}
.swatch:hover { transform: scale(1.06); }
.swatch[aria-pressed="true"] { outline: 2px solid var(--charcoal); }

.sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 8px; }
.size {
  height: 46px; border-radius: 10px; border: 1.5px solid var(--gray-700); background: transparent;
  font: 600 15px var(--body);
}
.size:hover { border-color: var(--charcoal); }
.size[aria-pressed="true"] { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }
.opt.need .size { border-color: var(--terracotta); }

.buy { display: flex; gap: 12px; margin-top: 8px; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--gray-700); border-radius: 999px; }
.qty button { width: 44px; height: 52px; border: 0; background: none; font-size: 20px; }
.qty output { min-width: 20px; text-align: center; font-weight: 600; }
.btn {
  flex: 1; height: 54px; border: 0; border-radius: 999px; background: var(--terracotta); color: var(--cream);
  /* 19px bold = WCAG large text, so cream on brand terracotta (4.1:1) passes; brand guide specifies 20pt buttons */
  font: 700 19px var(--body); letter-spacing: .06em; text-transform: uppercase; transition: background .15s ease;
}
.btn:hover { background: var(--terracotta-dark); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { padding: 0 32px; background: transparent; color: var(--charcoal); border: 1.5px solid var(--charcoal); }
.note { font-size: 14px; color: var(--gray-400); margin: 10px 0 0; min-height: 1.5em; }
.note.err { color: var(--terracotta-dark); }

.desc { margin: 28px 0 12px; }
.details { margin: 0 0 32px; padding: 0; list-style: none; border-top: 1px solid var(--gray-800); }
.details li { padding: 12px 0; border-bottom: 1px solid var(--gray-800); font-size: 15px; }
.howto { background: var(--gray-900); border-radius: 16px; padding: 22px 22px 18px; }
.howto ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; }

.foot {
  display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center;
  padding: 24px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: var(--charcoal); color: var(--gray-700); font-size: 14px;
}
.foot a { color: var(--cream); }
.foot small { flex-basis: 100%; color: var(--gray-700); font-size: 12px; }

/* dialogs */
dialog { border: 0; padding: 0; color: var(--charcoal); background: var(--cream); }
dialog::backdrop { background: rgba(27, 29, 31, .55); }
.sheet { overflow-x: hidden; margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(440px, 100vw); max-width: 100vw; display: none; flex-direction: column; }
.sheet[open] { display: flex; animation: slide .25s ease; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.modal { width: min(560px, calc(100vw - 32px)); border-radius: 18px; padding-bottom: 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 18px) 22px 14px; border-bottom: 1px solid var(--gray-800); }
.sheet-head h2 { margin: 0; font: 600 22px var(--display); text-transform: uppercase; }
.x { border: 0; background: none; font-size: 28px; line-height: 1; width: 44px; height: 44px; margin-right: -10px; }

#cartBody { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.lines { flex: 1; overflow: auto; margin: 0; padding: 8px 22px; list-style: none; }
.line { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--gray-800); }
.line .dot { width: 40px; height: 40px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(27, 29, 31, .18); }
.line strong { display: block; font-weight: 600; }
.line span { color: var(--gray-400); font-size: 14px; }
.line .qty button { width: 36px; height: 40px; font-size: 18px; }
.line .remove { grid-column: 2; justify-self: start; border: 0; background: none; padding: 0; font-size: 13px; color: var(--gray-400); text-decoration: underline; }
.cart-foot { padding: 18px 22px calc(env(safe-area-inset-bottom, 0px) + 22px); border-top: 1px solid var(--gray-800); display: grid; gap: 12px; }
.cart-foot p { margin: 0; font-size: 14px; color: var(--gray-400); }
.field { display: grid; gap: 6px; font: 600 13px var(--body); }
.field { min-width: 0; }
.field input { width: 100%; min-width: 0; height: 48px; border-radius: 10px; border: 1.5px solid var(--gray-700); background: #fff; padding: 0 14px; font: 400 16px var(--body); }
.field input:focus { outline: none; border-color: var(--charcoal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.empty, .done { padding: 40px 22px; text-align: center; }
.done h3 { font: 600 26px var(--display); text-transform: uppercase; margin: 12px 0 8px; }
.done img { width: 56px; margin: 0 auto; }

.table-wrap { overflow-x: auto; padding: 10px 22px 0; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--gray-800); white-space: nowrap; }
th { font: 700 11px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--gray-400); }
td:first-child { font-weight: 700; }
.modal .note { padding: 0 22px; }

@media (max-width: 860px) {
  .product { grid-template-columns: 1fr; min-height: 0; }
  .stage { position: relative; top: 0; min-height: 0; height: min(68dvh, 620px); }
  .info { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ?tune design mode */
.tune {
  position: fixed; z-index: 20; top: 72px; right: 12px; bottom: 12px; width: min(340px, calc(100vw - 24px));
  overflow: auto; padding: 16px; border-radius: 16px; background: var(--cream); color: var(--charcoal);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35); font-size: 14px;
}
.tune-head { display: grid; gap: 2px; margin-bottom: 10px; }
.tune-head span { color: var(--gray-300); font-size: 13px; }
.tune details { border-top: 1px solid var(--gray-800); padding: 10px 0; }
.tune summary { font-weight: 700; cursor: pointer; }
.tune .sl { display: grid; gap: 2px; margin-top: 10px; }
.tune .sl span { display: flex; justify-content: space-between; font-size: 13px; }
.tune .sl output { font-variant-numeric: tabular-nums; color: var(--gray-300); }
.tune input[type=range] { width: 100%; accent-color: var(--terracotta); }
.tune .chk { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.tune-actions { display: flex; gap: 8px; margin: 12px 0 8px; }
.tune-actions .btn { height: 44px; font-size: 13px; letter-spacing: .03em; white-space: nowrap; }
.tune textarea { width: 100%; font: 12px ui-monospace, monospace; border: 1px solid var(--gray-700); border-radius: 8px; padding: 8px; background: #fff; }

/* design picker */
.designs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.design {
  border: 1.5px solid var(--gray-700); background: transparent; border-radius: 999px;
  padding: 8px 16px; font: 600 14px var(--body);
}
.design:hover { border-color: var(--charcoal); }
.design[aria-pressed="true"] { background: var(--charcoal); border-color: var(--charcoal); color: var(--cream); }

/* 3D preview disclaimer */
.disclaimer {
  margin: 0; padding: 12px var(--gutter) 0; text-align: center;
  font-size: 13px; line-height: 1.4; color: var(--gray-700);
}
.desc + .color-note { margin: -4px 0 12px; font-size: 14px; color: var(--gray-300); }
