/* Shared plumbing for designs 2 to 5: reset plus the commodity parts (gallery tiles, form, viewer, call bar).
   Each design sets the variables below and styles everything distinctive in its own dN.css. */

:root {
  --ink: #111;
  --bg: #fff;
  --surface: #fff;
  --muted: #5a5a5a;
  --accent: #b9480f;
  --accent-ink: #fff;
  --rule: #111;
  --radius: 10px;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: var(--font-body);
  --ph-bg: #fff3c9;
  --ph-line: #b9480f;
  --tile-bg: #eee;
  --wrap: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding-bottom: 60px;
  font-family: var(--font-body); font-size: 17px; line-height: 1.55;
  color: var(--ink); background: var(--bg);
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.1; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
section[id] { scroll-margin-top: 16px; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }

/* placeholders (demo only) */
.ph {
  background: var(--ph-bg); color: #111;
  outline: 2px dashed var(--ph-line); outline-offset: 1px;
  border-radius: 3px; padding: 0 4px;
}
.ph-inv { background: transparent; color: inherit; outline-color: currentColor; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px;
  font: 700 1.05rem/1.2 var(--font-body); text-decoration: none; text-align: center;
  color: var(--accent-ink); background: var(--accent);
  border: 2px solid transparent; border-radius: var(--radius); cursor: pointer;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; grid-auto-flow: dense; gap: 10px; }
.tile-wide { grid-column: span 2; }
.tile-tall { grid-row: span 2; }
.tile button {
  position: relative; display: block; width: 100%; height: 100%; padding: 0;
  border: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--tile-bg); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-ph {
  display: grid; place-items: center; width: 100%; height: 100%;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(128, 128, 128, .14) 10px 12px), var(--tile-bg);
}
.tile-ph-label {
  font: 700 .72rem/1.4 var(--font-body); text-transform: uppercase; letter-spacing: .1em;
  color: #111; background: var(--ph-bg); border: 2px dashed var(--ph-line); border-radius: 4px;
  padding: 2px 8px; margin-bottom: 40px;
}
.tile-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 10px 8px; line-height: 1.2; background: rgba(0, 0, 0, .78); color: #fff; }
.tile-tag { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--tag, #ffd7a8); }
.tile-title { display: block; font-size: .92rem; font-weight: 600; }

.chips { display: flex; gap: 8px; margin: 18px -16px 14px; padding: 4px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 4px 16px;
  font: 600 .95rem/1 var(--font-body); color: inherit; background: transparent;
  border: 2px solid currentColor; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* form */
[data-quote-form] { display: grid; gap: 12px; }
[data-quote-form] label { display: grid; gap: 4px; font-weight: 700; font-size: .92rem; }
[data-quote-form] .optional { font-weight: 400; color: var(--muted); }
[data-quote-form] input, [data-quote-form] select, [data-quote-form] textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: 400 1rem/1.4 var(--font-body); color: #111; background: #fff;
  border: 2px solid var(--rule); border-radius: 8px;
}
[data-quote-form] textarea { resize: vertical; }
[data-quote-form] .btn { width: 100%; margin-top: 4px; }
.form-status:empty { display: none; }
.form-status { padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; color: #111; border: 2px dashed var(--ph-line); background: var(--ph-bg); }
.form-status[data-state="error"] { border-style: solid; background: #fde7df; }

/* facts list */
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.facts dt { font-weight: 700; }
.facts dd { text-align: right; }

.towns { display: flex; flex-wrap: wrap; gap: 8px; }
.towns li { border: 2px solid currentColor; border-radius: 999px; padding: 3px 14px; font-weight: 600; }
.towns li.ph { border: 0; }

/* phone call bar */
.callbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  background: var(--ink); padding-bottom: env(safe-area-inset-bottom);
}
.callbar a { display: grid; place-items: center; min-height: 56px; font-weight: 800; font-size: 1.05rem; color: #fff; text-decoration: none; border-left: 1px solid rgba(255, 255, 255, .25); }
.callbar a:first-child { background: var(--accent); color: var(--accent-ink); border-left: 0; }

/* photo viewer */
.viewer { width: min(94vw, 900px); padding: 0; border: 2px solid #fff; border-radius: 10px; background: #111; color: #fff; overflow: hidden; }
.viewer::backdrop { background: rgba(0, 0, 0, .82); }
.viewer-stage { height: min(62vh, 560px); }
.viewer-stage img { width: 100%; height: 100%; object-fit: contain; }
.viewer-stage .tile-ph-label { font-size: 1rem; margin: 0; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 8px; }
.viewer-bar p { flex: 1; text-align: center; font-weight: 600; font-size: .95rem; line-height: 1.25; }
.viewer button { width: 48px; height: 48px; flex: none; font: 400 1.4rem/1 system-ui, sans-serif; color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; }
.viewer-close { position: absolute; top: 8px; right: 8px; z-index: 1; background: #111 !important; color: #fff !important; border: 2px solid #fff !important; }

@media (min-width: 760px) {
  body { font-size: 18px; padding-bottom: 0; }
  .callbar { display: none; }
  .gallery { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 200px; gap: 14px; }
  .chips { margin-inline: 0; padding-inline: 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
