:root {
  color-scheme: light;
  --ink: #1e1d1b;
  --muted: #6d6962;
  --line: #dedbd4;
  --panel: #ffffff;
  --page: #f1f0ec;
  --accent: #b14c2d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

button, input, select { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { max-width: 1380px; margin: 0 auto; padding: 36px 28px 56px; }
.intro { margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(36px, 5vw, 58px); font-weight: 500; letter-spacing: -.035em; }
.intro > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 17px; }
.intro-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.admin-link { display: inline-flex; align-items: center; gap: 9px; padding: 11px 15px; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; font-size: 13px; font-weight: 750; white-space: nowrap; }
.admin-link:hover { border-color: var(--accent); color: var(--accent); }

.visualiser { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; align-items: start; }
.preview-panel, .controls { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.preview-panel { overflow: hidden; position: sticky; top: 18px; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; min-height: 55px; padding: 0 18px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.link-button { border: 0; padding: 6px; color: var(--accent); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; text-transform: none; letter-spacing: 0; }

.stage { min-height: 650px; padding: 62px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 50% 30%, #f7f6f2, #dedbd3 78%); }
.frame { position: relative; width: min(78%, 660px); padding: clamp(13px, 2.4vw, 31px); box-shadow: 0 28px 60px rgba(30, 24, 15, .22), inset 0 0 0 1px rgba(255,255,255,.35), inset 0 0 12px rgba(0,0,0,.28); }
.frame.is-portrait { width: min(55%, 470px); }
.frame.is-square { width: min(68%, 560px); }
.frame.frame-overlay { padding: 0; background: transparent !important; box-shadow: none; }
.frame.frame-overlay .mount { position: absolute; z-index: 1; margin: 0; box-shadow: inset 0 0 4px rgba(0,0,0,.22); }
.frame.frame-overlay .aperture { width: 100%; height: 100%; aspect-ratio: auto; }
.frame-overlay-image { position: absolute; z-index: 2; left: 0; top: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.mount { padding: 8%; box-shadow: inset 0 0 4px rgba(0,0,0,.22); transition: padding .18s ease, background .18s ease; }
.aperture { position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #d2d0ca; box-shadow: inset 0 0 8px rgba(0,0,0,.5); touch-action: none; }
#artwork { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--zoom, 1)); transform-origin: center; cursor: grab; user-select: none; -webkit-user-drag: none; }
#artwork.dragging { cursor: grabbing; }
.glass { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.glass.clear { opacity: .16; background: linear-gradient(120deg, rgba(255,255,255,.72), transparent 25%, transparent 72%, rgba(255,255,255,.2)); }
.glass.low-reflection { opacity: .09; background: linear-gradient(135deg, rgba(205,229,228,.5), transparent 42%, rgba(255,255,255,.25)); }
.drag-hint { margin: 0; padding: 14px 18px 16px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; text-align: center; }

.frame-oak { background: repeating-linear-gradient(94deg, transparent 0 7px, rgba(72,42,16,.12) 8px, transparent 10px), linear-gradient(135deg, #b8793c, #e0b16e 40%, #99602c 72%, #c98d4d); }
.frame-walnut { background: repeating-linear-gradient(91deg, transparent 0 9px, rgba(0,0,0,.16) 10px, transparent 13px), linear-gradient(135deg, #3c2417, #765039 43%, #26170f 72%, #5d3b29); }
.frame-black { background: linear-gradient(135deg, #060606, #333 38%, #070707 70%, #242424); }
.frame-white { background: linear-gradient(135deg, #e7e4dc, #fff 40%, #c7c4bc 74%, #f7f5ef); }
.frame-gold { background: repeating-linear-gradient(112deg, transparent 0 9px, rgba(70,40,0,.16) 10px, transparent 12px), linear-gradient(135deg, #76602a, #d5ba62 42%, #8f7431 72%, #c7aa53); }
.frame-silver { background: linear-gradient(135deg, #62666a, #e9e9e7 40%, #85888b 70%, #cfd0cf); }
.mount-white { background: #f7f3e9; }
.mount-cream { background: #e9ddc3; }
.mount-grey { background: #b8b8b3; }
.mount-charcoal { background: #3d3e3f; }
.mount-none { background: repeating-linear-gradient(135deg, #fff 0 5px, #eee 5px 10px); }

.controls { padding: 0 22px; }
.control-group { padding: 22px 0; border-bottom: 1px solid var(--line); }
.control-group:last-child { border-bottom: 0; }
.step-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.step-heading span { display: grid; place-items: center; width: 23px; height: 23px; color: #fff; background: var(--ink); border-radius: 50%; font-size: 12px; font-weight: 800; }
.step-heading h2, .summary h2 { margin: 0; font-size: 15px; }
.frame-heading small { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 600; }
.upload { display: block; padding: 17px; border: 1.5px dashed #aaa49a; border-radius: 10px; background: #faf9f6; cursor: pointer; text-align: center; }
.upload:hover { border-color: var(--accent); background: #fbf5f2; }
.upload strong, .upload small { display: block; }
.upload small { margin-top: 4px; color: var(--muted); font-size: 12px; }
#imageUpload { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.file-status, .action-status { min-height: 17px; margin: 8px 0 0; color: var(--muted); font-size: 11px; }

.library-tools { display: grid; grid-template-columns: minmax(0,1fr) 128px; gap: 8px; margin-bottom: 12px; }
.search-box input, .library-tools select { width: 100%; height: 39px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 11px; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.frame-library { max-height: 340px; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.choice { padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; overflow: hidden; }
.choice:hover, .choice.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice .swatch { display: block; height: 38px; border-radius: 5px; }
.choice b { display: block; padding: 7px 2px 4px; font-size: 10px; font-weight: 650; }
.choice small { display: block; padding: 0 2px 5px; color: var(--muted); font-size: 8px; letter-spacing: .04em; }
.show-more { width: 100%; margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; color: var(--accent); font-size: 11px; font-weight: 750; }
.empty-state { margin: 14px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.mount-options { display: flex; gap: 9px; margin-bottom: 18px; }
.mount-choice { width: 42px; height: 42px; padding: 0; border: 2px solid #fff; outline: 1px solid var(--line); border-radius: 50%; cursor: pointer; font-size: 8px; font-weight: 700; }
.mount-choice:hover, .mount-choice.active { outline: 2px solid var(--accent); }
.range-label { display: flex; justify-content: space-between; margin: 0 0 7px; color: var(--muted); font-size: 12px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.select-label { display: block; margin: 17px 0 7px; color: var(--muted); font-size: 12px; }
select { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

.summary { margin: 22px 0; padding: 17px; border-radius: 11px; background: #f6f4ef; }
.summary dl { margin: 13px 0 17px; font-size: 12px; }
.summary dl div { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; text-align: right; font-weight: 650; }
.actions { display: grid; gap: 8px; }
.actions button { padding: 11px; border-radius: 8px; cursor: pointer; font-weight: 700; }
.primary { border: 1px solid var(--ink); color: #fff; background: var(--ink); }
.primary:hover { background: #3b3935; }
.secondary { border: 1px solid var(--line); background: #fff; }
.secondary:hover { border-color: #aaa49a; }

/* Owner frame-library demo */
.admin-body { background: #eeeae3; }
.admin-shell { max-width: 1180px; margin: 0 auto; padding: 42px 24px 70px; }
.admin-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 22px; }
.admin-header h1 { font-size: clamp(38px,5vw,54px); }
.admin-header p:last-child { margin: 8px 0 0; color: var(--muted); }
.demo-notice { display: flex; gap: 16px; padding: 14px 17px; margin-bottom: 18px; border: 1px solid #decbaa; border-radius: 10px; background: #fff7e8; color: #6f5630; font-size: 12px; line-height: 1.5; }
.demo-notice strong { white-space: nowrap; }
.admin-grid { display: grid; grid-template-columns: 390px minmax(0,1fr); gap: 18px; align-items: start; }
.admin-card { padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.card-heading .eyebrow { margin-bottom: 4px; }
.card-heading h2 { margin: 0; font-family: Georgia,serif; font-size: 25px; font-weight: 500; }
.status-pill, .visibility-badge { padding: 5px 8px; border-radius: 999px; background: #eeeae3; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.add-frame-form > label:not(.checkbox-label):not(.texture-upload), .form-row label { display: grid; gap: 6px; margin-bottom: 13px; color: var(--muted); font-size: 11px; font-weight: 700; }
.add-frame-form input:not([type="checkbox"]), .add-frame-form select { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.texture-upload { display: grid; gap: 3px; padding: 14px; border: 1.5px dashed #aaa49a; border-radius: 9px; background: #faf9f6; cursor: pointer; text-align: center; }
.texture-upload strong { font-size: 12px; }
.texture-upload span { color: var(--muted); font-size: 10px; }
.texture-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.texture-preview { height: 72px; margin: 10px 0 13px; display: grid; place-items: center; border-radius: 8px; background: repeating-linear-gradient(135deg,#f6f4ef 0 8px,#eeebe5 8px 16px); color: var(--muted); font-size: 10px; background-position: center; background-size: cover; }
.texture-preview.has-image { box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 12px; }
.checkbox-label input { accent-color: var(--accent); }
.admin-submit { width: 100%; padding: 12px; border-radius: 8px; cursor: pointer; }
.danger-text { color: #a33d31; }
.admin-tools { grid-template-columns: minmax(0,1fr) 155px; }
.admin-list { display: grid; gap: 8px; }
.admin-frame-row { display: grid; grid-template-columns: 62px minmax(0,1fr) auto auto; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.admin-swatch { display: block; width: 62px; height: 46px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.13); }
.admin-frame-info { display: grid; gap: 3px; min-width: 0; }
.admin-frame-info strong { font-size: 12px; }
.admin-frame-info span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.visibility-badge.live { background: #e6f1e7; color: #37673e; }
.visibility-badge.hidden { background: #eeeae3; color: #746e65; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 9px; font-weight: 700; }
.empty-admin { padding: 35px 10px; color: var(--muted); text-align: center; }

@media (max-width: 880px) {
  .app-shell { padding: 24px 14px 40px; }
  .visualiser { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .stage { min-height: 430px; padding: 36px 26px; }
  .frame { width: min(88%, 590px); }
  .frame.is-portrait { width: min(65%, 390px); }
  .frame.is-square { width: min(76%, 480px); }
  .admin-grid { grid-template-columns: 1fr; }
  .add-frame-form { order: 2; }
  .library-card { order: 1; }
}

@media (max-width: 460px) {
  .intro { margin-bottom: 20px; }
  .stage { min-height: 350px; padding: 28px 18px; }
  .frame { width: 94%; padding: 14px; }
  .frame.is-portrait { width: 76%; }
  .frame.is-square { width: 86%; }
  .controls { padding: 0 16px; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
  .intro-row, .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-shell { padding: 25px 13px 50px; }
  .admin-card { padding: 16px; }
  .demo-notice { display: grid; gap: 4px; }
  .admin-frame-row { grid-template-columns: 54px minmax(0,1fr) auto; }
  .admin-swatch { width: 54px; }
  .row-actions { grid-column: 2 / -1; }
  .admin-tools { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

.product-nav,.product-footer {max-width:1380px;margin:auto;padding:22px 28px;display:flex;align-items:center;gap:24px;flex-wrap:wrap}
.product-nav {border-bottom:1px solid var(--line)}.product-brand{font-weight:800;margin-right:auto}.product-brand span{margin-left:12px}
.product-nav a,.product-footer a,.integration a{color:var(--ink)}.product-nav a,.product-footer a{font-size:14px;text-underline-offset:4px}
.intro h1{font-family:Georgia,serif;font-size:clamp(30px,4vw,50px);font-weight:500;max-width:22ch;line-height:1.12}
.intro p{max-width:66ch;line-height:1.65}.intro-row{align-items:center}.product-cta{display:inline-block;padding:13px 18px;background:var(--ink);border:1px solid var(--ink);border-radius:7px;color:#fff!important;text-decoration:none;font-weight:700;line-height:1.4}
.demo-disclosure{max-width:100ch;font-size:14px;line-height:1.6;margin:0 0 24px;color:var(--muted)}
.integration{padding:36px 0;margin-top:40px;border-top:1px solid var(--line);scroll-margin-top:24px}.integration h2{font-size:30px}.integration p{max-width:82ch;line-height:1.7}.integration-price{font-weight:700;font-size:19px}
.product-footer{border-top:1px solid var(--line);justify-content:space-between}.product-footer nav{display:flex;gap:18px;flex-wrap:wrap}
.skip-link{position:absolute;left:-10000px}.skip-link:focus{left:12px;top:12px;z-index:10;padding:12px;background:#fff;color:#111}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:3px solid #164f82;outline-offset:4px}
.upload:focus-visible{outline:3px solid #164f82}.choice{min-height:70px}.mount-choice{min-width:44px;min-height:44px}.primary,.secondary{min-height:44px}
#visualiser{scroll-margin-top:24px}.stage{min-height:560px}.controls{min-width:0}
@media(max-width:600px){.product-nav,.product-footer{padding:18px 14px;gap:16px}.product-brand{flex-basis:100%}.intro-row{align-items:flex-start}.stage{min-height:350px}.integration{margin-top:20px}.product-cta{max-width:100%;white-space:normal}.product-footer nav{gap:14px}}
