/* Tilesbox Showroom — one stylesheet for all three pages.
   Mobile first: every rule here is the phone layout, and the media queries
   only add to it. Design tokens match tilesbox.com so the two read as one site. */

:root {
  --bg: #fbf9f7;
  --surface: #ffffff;
  --surface-2: #f4f0ec;
  --border: #e3dcd4;
  --text: #22201e;
  --text-dim: #6b625a;
  --accent: #b4541f;
  --accent-soft: #fdf1e9;
  --accent-text: #8f4218;
  --good: #2c7a4b;
  --warn: #a8611a;
  --danger: #b3382f;
  --radius: 10px;
  --maxw: 1080px;
  --shadow: 0 1px 2px rgba(34, 32, 30, .06), 0 6px 20px rgba(34, 32, 30, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171513;
    --surface: #201d1a;
    --surface-2: #292522;
    --border: #383330;
    --text: #f0ebe6;
    --text-dim: #a89e95;
    --accent: #e8814a;
    --accent-soft: #2c211a;
    --accent-text: #f0a071;
    --good: #5cbb85;
    --warn: #d9a05f;
    --danger: #e2796f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent-text); }
a:hover { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 20px; } }

h1 { font-size: clamp(24px, 6vw, 34px); line-height: 1.15; letter-spacing: -.025em; margin: 0 0 8px; }
h2 { font-size: clamp(19px, 4vw, 24px); line-height: 1.25; letter-spacing: -.015em; margin: 0 0 10px; }
h3 { font-size: 16px; line-height: 1.3; margin: 0 0 10px; }

.lede { color: var(--text-dim); margin: 0; max-width: 62ch; }
.hint { color: var(--text-dim); font-size: 14px; margin: 6px 0 0; }
.page-head { padding: 22px 0 16px; }

/* ---------- header ---------- */

.site-head {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 58px; }

.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.02em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: auto;
}
.logo .mark {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent) 0 50%, transparent 50%), var(--accent-soft);
  border: 1.5px solid var(--accent);
  flex: none;
}
.logo { white-space: nowrap; }
.logo small { font-weight: 500; color: var(--text-dim); font-size: 13px; letter-spacing: 0; margin-left: 2px; }

.site-nav { display: flex; gap: 18px; }
.site-nav a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- footer ---------- */

.site-foot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 40px;
  padding: 20px 0;
  font-size: 14px;
  color: var(--text-dim);
}
.site-foot .wrap { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.site-foot a { color: var(--text-dim); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }
.site-foot .spacer { margin-left: auto; }

/* ---------- controls ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;                 /* a comfortable thumb target */
  padding: 10px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.block { width: 100%; }

label, .field-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
input, select, textarea {
  font: inherit;
  font-size: 16px;                  /* under 16px iOS zooms the page on focus */
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
input[type="color"] { padding: 3px; }
input[type="checkbox"] { min-height: 0; width: auto; }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.tag.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.tag.ok { color: var(--good); }
.tag.low { color: var(--warn); }
.tag.out { color: var(--danger); }

.notice { border-radius: 9px; padding: 10px 13px; font-size: 15px; border: 1px solid var(--border); background: var(--surface-2); }
.notice.bad { color: var(--danger); border-color: currentColor; background: transparent; }

.empty { padding: 48px 16px; text-align: center; color: var(--text-dim); }

/* ---------- shop bar ---------- */

.shopbar { margin-bottom: 16px; }
.shopbar .search { margin-bottom: 10px; }

/* Filter chips scroll sideways on a phone instead of wrapping into a wall. */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}
.chips button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

details.more { margin-top: 10px; }
details.more > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  color: var(--accent-text);
  padding: 8px 0;
  list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ' ▾'; }
details.more[open] > summary::after { content: ' ▴'; }
details.more .panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 0 4px;
}
details.more .field { margin: 0; }
.count { color: var(--text-dim); font-size: 14px; margin: 0 0 12px; }

/* ---------- product grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 24px;
}
@media (min-width: 620px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.tile-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile-card .shot { aspect-ratio: 1 / 1; background: var(--surface-2); position: relative; }
.tile-card .shot canvas { width: 100%; height: 100%; display: block; }
.tile-card .shot .tag {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(255, 255, 255, .92); border-color: transparent;
  backdrop-filter: blur(3px);
}
.tile-card .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tile-card .name { font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.tile-card .meta { color: var(--text-dim); font-size: 13px; line-height: 1.4; }
.tile-card .row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 17px; }
.price span { font-weight: 500; color: var(--text-dim); font-size: 12.5px; }

/* ---------- product page ---------- */

.detail { display: grid; gap: 16px; padding-bottom: 24px; }
@media (min-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; }
}

.viewer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.viewer-tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.viewer-tabs button {
  flex: 1;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  min-height: 46px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.viewer-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); border-bottom-color: var(--accent); }

.pane { display: none; }
.pane.on { display: block; }
#flat { width: 100%; height: 300px; display: block; background: var(--surface-2); }
#swatch { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--surface-2); }
@media (min-width: 700px) {
  #flat { height: 420px; }
  #swatch { aspect-ratio: 16 / 11; }
}

.strip { display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: var(--surface-2); }
.strip button {
  flex: 0 0 auto;
  width: 58px; height: 58px; padding: 0;
  border: 2px solid transparent;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
}
.strip button[aria-current="true"] { border-color: var(--accent); }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

.buy-price { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.buy-price span { font-size: 14px; font-weight: 500; color: var(--text-dim); }

.specs { list-style: none; margin: 0; padding: 0; }
.specs li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.specs li:last-child { border-bottom: 0; }
.specs .k { color: var(--text-dim); }
.specs .v { font-weight: 600; text-align: right; }

/* Anything a shopper does not need on first glance folds away. */
details.fold { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
details.fold > summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 15px;
  padding: 14px 16px;
  list-style: none;
  display: flex;
  align-items: center;
  min-height: 48px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '▾'; margin-left: auto; color: var(--text-dim); }
details.fold[open] > summary::after { content: '▴'; }
details.fold .fold-body { padding: 0 16px 16px; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.controls .field { margin: 0; }
@media (min-width: 700px) { .controls { grid-template-columns: repeat(3, 1fr); } }

.est-out { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.est-out div { background: var(--surface-2); border-radius: 9px; padding: 10px 12px; }
.est-out b { display: block; font-size: 18px; letter-spacing: -.01em; }
.est-out span { color: var(--text-dim); font-size: 12.5px; }

/* Phone: the way to actually ask about a tile follows you down the page. */
.buybar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 14px rgba(34, 32, 30, .10);
}
.buybar .buy-price { font-size: 19px; }
.buybar .btn { flex: 1; max-width: 220px; margin-left: auto; }
body.has-buybar { padding-bottom: 78px; }
@media (min-width: 900px) { .buybar { display: none; } body.has-buybar { padding-bottom: 0; } }

/* ---------- 3D room ---------- */

.room3d {
  position: relative;
  height: 300px;
  background: linear-gradient(180deg, #2a2724, #171614);
  perspective: 900px;
  perspective-origin: 50% 44%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.room3d.dragging { cursor: grabbing; }
@media (min-width: 700px) { .room3d { height: 420px; } }

.r3-scene {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transition: transform .1s linear;
}
.r3-face {
  position: absolute;
  left: 0;
  top: 0;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.r3-face canvas { width: 100%; height: 100%; display: block; }
.r3-face::after { content: ''; position: absolute; inset: 0; pointer-events: none; }

.r3-back  { transform: translateZ(calc(var(--room-d) / -2)); }
.r3-left  { transform: rotateY(90deg) translateZ(calc(var(--room-w) / -2)); }
.r3-right { transform: rotateY(-90deg) translateZ(calc(var(--room-w) / -2)); }
.r3-floor { transform: rotateX(90deg) translateZ(calc(var(--room-h) / -2)); }
.r3-ceil  { transform: rotateX(-90deg) translateZ(calc(var(--room-h) / -2)); }

/* Light comes from the left, so the surfaces are shaded accordingly. */
.r3-back::after  { background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0) 40%, rgba(0,0,0,.16)); }
.r3-left::after  { background: linear-gradient(90deg, rgba(255,255,255,.10), rgba(0,0,0,.20)); }
.r3-right::after { background: linear-gradient(90deg, rgba(0,0,0,.26), rgba(0,0,0,.08)); }
.r3-floor::after { background: radial-gradient(130% 100% at 40% 15%, rgba(255,255,255,.22), rgba(0,0,0,.30) 88%); }
.r3-ceil::after  { background: linear-gradient(rgba(0,0,0,.06), rgba(0,0,0,.26)); }

/* Skirting, but only where the wall is painted rather than tiled. */
.r3-face.painted::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 10px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .10);
}
.r3-floor.painted::before, .r3-ceil.painted::before { content: none; }

.room3d.has-window .r3-left::after {
  background:
    linear-gradient(90deg, rgba(255,255,255,.10), rgba(0,0,0,.20)),
    radial-gradient(60% 45% at 62% 34%, rgba(255,252,240,.55), rgba(255,252,240,0) 70%);
}

/* Gloss and polish get a specular sweep the matt finishes do not. */
.room3d[data-finish="glossy"] .r3-floor::after,
.room3d[data-finish="polished"] .r3-floor::after {
  background:
    linear-gradient(112deg, rgba(255,255,255,0) 26%, rgba(255,255,255,.30) 40%, rgba(255,255,255,0) 56%),
    radial-gradient(130% 100% at 40% 15%, rgba(255,255,255,.26), rgba(0,0,0,.28) 88%);
}
.room3d[data-finish="glossy"] .r3-back::after {
  background:
    linear-gradient(122deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.22) 44%, rgba(255,255,255,0) 58%),
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0) 40%, rgba(0,0,0,.16));
}

.r3-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, .65);
  background: rgba(0, 0, 0, .35);
  padding: 4px 9px;
  border-radius: 999px;
  pointer-events: none;
}

/* ---------- admin ---------- */

.admin-grid { display: grid; gap: 18px; padding-bottom: 30px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); align-items: start; } }

.drop {
  border: 1.5px dashed var(--border);
  border-radius: 9px;
  padding: 20px 14px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14.5px;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs figure { position: relative; margin: 0; width: 74px; height: 74px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.thumbs figure.main { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbs button {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; min-height: 0; line-height: 20px; padding: 0;
  border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .62); color: #fff; font-size: 13px;
}
.thumbs figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 10.5px; font-weight: 700; text-align: center;
  padding: 3px 0; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer;
}
.thumbs figure.main figcaption { background: var(--accent); cursor: default; }

.stock-list { display: flex; flex-direction: column; gap: 9px; }
.stock-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 11px;
}
@media (min-width: 560px) { .stock-row { grid-template-columns: 54px minmax(0, 1fr) auto; } }
.stock-row.is-hidden { opacity: .58; }
.stock-row img { width: 54px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--surface-2); }
.stock-row .meta { color: var(--text-dim); font-size: 13.5px; }
.stock-row .acts { display: flex; gap: 6px; grid-column: 1 / -1; }
@media (min-width: 560px) { .stock-row .acts { grid-column: auto; } }

.login-wrap { max-width: 380px; margin: 48px auto; }
