:root {
  --dealer: #5c8b8f;        /* replaced at runtime with the dealer's primary color */
  --pdw: #5c8b8f;
  --ink: #f2f2f2;
  --muted: #9a9ea1;
  --line: #262829;
  --bg: #000000;
  --panel: #111213;
  --card: #0b0b0c;
  color-scheme: dark;
  --radius: 12px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  height: calc(64px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0;
  background: #000; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { justify-self: center; display: flex; align-items: center; height: 100%; }
.brand img { max-height: 40px; max-width: 200px; object-fit: contain; }
.back, .icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--ink);
}
.icon-btn { grid-column: 3; }
.back[hidden] { visibility: hidden; display: grid; }

main { padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); max-width: 860px; margin: 0 auto; outline: none; }

/* Bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #000; border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--dealer); }

/* Type */
/* Page title with dealer logo */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 14px; }
.title-text { min-width: 0; }
.title-row h1 { margin: 2px 0 0; }
.title-row .eyebrow a { color: inherit; text-decoration: none; }
.dealer-logo { height: 44px; width: auto; max-width: 42%; object-fit: contain; flex: none; }

h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 28px 0 10px; font-weight: 600; }
p { line-height: 1.5; margin: 0 0 12px; }
.lead { color: var(--muted); margin-bottom: 4px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }

/* Search */
.search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; height: 48px; background: var(--panel);
}
.search input { flex: 1; border: 0; background: none; font: inherit; font-size: 16px; outline: none; min-width: 0; color: var(--ink); }

/* Feature tile for colors */
.feature {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding: 18px; border-radius: var(--radius); text-decoration: none;
  background: var(--dealer); color: #fff;
}
.feature strong { display: block; font-size: 18px; }
.feature span { font-size: 14px; opacity: 0.9; }
.feature .dots { display: flex; }
.feature .dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--dealer); margin-left: -6px; }

/* Lists of cards */
.cards { display: grid; gap: 10px; }
@media (min-width: 640px) { .cards.two { grid-template-columns: 1fr 1fr; } }
.card {
  display: flex; align-items: center; gap: 14px; padding: 14px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.card:active { background: var(--panel); }
.card .thumb { width: 64px; height: 64px; border-radius: 8px; background: var(--panel); flex: none; object-fit: cover; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 600; font-size: 16px; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.card .chev { color: var(--muted); flex: none; }

/* Product */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px 12px; padding: 0 16px; }
.gallery img { height: 240px; width: auto; max-width: none; border-radius: var(--radius); scroll-snap-align: start; background: var(--panel); }
.specs { width: 100%; border-collapse: collapse; font-size: 15px; }
.specs th, .specs td { text-align: left; padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.specs th { color: var(--muted); font-weight: 500; width: 45%; padding-right: 12px; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.style { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.style img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel); }
.style .name { padding: 10px 12px; font-weight: 600; font-size: 14px; }
.style .note { padding: 0 12px 10px; font-size: 13px; color: var(--muted); }
.notes { background: var(--panel); border-radius: var(--radius); padding: 14px; font-size: 15px; white-space: pre-line; }
.downloads a {
  display: flex; align-items: center; gap: 12px; padding: 14px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; font-weight: 500;
}
.downloads a span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: auto; }

/* Colors */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 12px -16px 4px; padding-left: 16px; padding-right: 16px; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #000; }
.palette-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.palette-head .count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.palette-note { color: var(--muted); font-size: 14px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.swatch { text-decoration: none; display: block; }
.swatch .chipcolor {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.14);
  background-size: cover; background-position: center;
}
.swatch .n { font-size: 13px; font-weight: 600; margin-top: 6px; line-height: 1.25; }
.swatch .c { font-size: 12px; color: var(--muted); }
.disclaimer { font-size: 13px; color: var(--muted); margin-top: 20px; }

/* Full-screen swatch for showing an architect */
.viewer {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: #000; color: #fff;
}
.viewer .fill { flex: 1; background-size: cover; background-position: center; }
.viewer .bar {
  display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px;
  padding: 14px 12px calc(14px + var(--safe-b)); background: #000;
}
.viewer .meta { text-align: center; }
.viewer .meta strong { display: block; font-size: 20px; }
.viewer .meta span { font-size: 14px; opacity: 0.75; }
.viewer button {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25);
  background: none; color: #fff; font-size: 22px; cursor: pointer;
}
.viewer button:disabled { opacity: 0.25; }
.viewer .close {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px;
  width: 44px; height: 44px; background: rgba(0, 0, 0, 0.45); border: 0; font-size: 26px;
}
.viewer .hint { position: absolute; left: 12px; top: calc(16px + env(safe-area-inset-top, 0px)); font-size: 12px; background: rgba(0,0,0,0.45); padding: 6px 10px; border-radius: 999px; }

/* Contact */
.contact a {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px;
  border-radius: var(--radius); text-decoration: none; font-weight: 600; font-size: 16px; margin-bottom: 10px;
}
.contact .primary { background: var(--pdw); color: #fff; }
.contact .secondary { border: 1px solid var(--line); }

.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.result-group { margin-top: 8px; }

/* Home */
.card.big { padding: 20px 16px; }
.card.big .title { font-size: 19px; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feature-grid .feature { margin-top: 0; flex-direction: column; align-items: flex-start; min-height: 96px; }
.feature.alt { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.feature.alt span { color: var(--muted); opacity: 1; }

/* Product type dropdown */
.select { display: block; margin: 8px 0 4px; position: relative; }
.select select {
  width: 100%; height: 50px; padding: 0 44px 0 16px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  appearance: none; -webkit-appearance: none;
}
.select::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Sizes */
.table-wrap { overflow-x: auto; }
.sizes { width: 100%; border-collapse: collapse; font-size: 15px; }
.sizes th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.sizes td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }

/* Textures */
.textures { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.texture { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.texture img, .tex-placeholder { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.tex-placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: 12px; letter-spacing: 0.04em;
  background: repeating-linear-gradient(135deg, #151617 0 10px, #1c1d1f 10px 20px);
}
.texture figcaption { padding: 10px 12px 12px; }
.texture figcaption strong { display: block; font-size: 14px; }
.texture figcaption span { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.35; }

/* Colors waiting for a swatch photo */
.viewer .fill { display: grid; place-items: center; }
.pending-note { color: var(--muted); font-size: 15px; }

/* Product photos */
.gallery img { cursor: zoom-in; }
.viewer.photo .photo-stage { flex: 1; display: grid; place-items: center; overflow: hidden; background: #000; }
.viewer.photo .photo-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sizes td.files a { color: var(--dealer); text-decoration: none; font-weight: 600; margin-right: 12px; }

/* Product tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { display: block; text-decoration: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.tile:active { border-color: var(--muted); }
.tile-img { aspect-ratio: 7 / 5; background: #000; display: grid; place-items: center; padding: 8px; }
.tile-img img { width: 100%; height: 100%; object-fit: contain; }
.tile-body { padding: 10px 12px 12px; }
.tile .title { font-weight: 600; font-size: 15px; }
.tile .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.gallery img { object-fit: contain; background: #000; }

/* Keep the header row from overflowing on narrow phones */
.topbar { box-sizing: border-box; }
.brand img { max-height: 36px; }
.title-row { align-items: flex-end; }
.title-row h1 { font-size: 24px; }
.dealer-logo { height: 40px; max-width: 38%; }
