/* Altivon Digital sample-site engine: base styles.

   Everything sits under .smp-stage (the frame the engine mounts) and .smp-root (one sample site).
   Each sample is a size container named smp, so layouts answer to the sample's own width: a 360px
   phone screen gets the phone site and the full-width viewer gets the desktop site. Phone below
   720px, wide from 720px, large from 1080px (samples.js uses the same 720).

   Types restyle through the --smp-* tokens (set from def.palette) and their own rules, written under
   [data-ui][data-type="<id>"]. The data-ui attribute marks a sample as an interface fragment, so the
   taste linter leaves its borders and shadows alone. */

/* ---- Stage ----------------------------------------------------------------------------------- */

.smp-stage { position: relative; }
/* Box mode (homepage phone): the host element must have a height; the sample scrolls inside it. */
.smp-stage[data-mode="box"] { width: 100%; height: 100%; overflow: hidden; contain: strict; }
.smp-stage[data-mode="box"] > .smp-root {
  position: absolute; inset: 0;
  overflow-x: hidden; overflow-y: auto;
  scrollbar-width: none; /* phones overlay their scrollbars; a desktop gutter would look wrong here */
}
.smp-stage[data-mode="box"] > .smp-root::-webkit-scrollbar { display: none; }
/* Page mode (viewer): the sample is the page and the window scrolls. */
.smp-stage[data-mode="page"] > .smp-root { overflow-x: clip; }

/* ---- Root: tokens and a reset against host-page styles ---------------------------------------- */

.smp-root {
  --smp-bg: #ffffff;
  --smp-surface: #f1f1ef;     /* one tone step from bg: alternate sections, cards, image placeholder */
  --smp-ink: #161616;
  --smp-muted: #595959;       /* 7:1 on white */
  --smp-accent: #161616;      /* buttons and links */
  --smp-on-accent: #ffffff;
  --smp-radius: 8px;
  --smp-text: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --smp-display: var(--smp-text);
  --smp-gutter: 20px;
  container: smp / inline-size;
  position: relative;
  display: block;
  isolation: isolate;
  background: var(--smp-bg);
  color: var(--smp-ink);
  font: 400 16px/1.55 var(--smp-text);
  font-style: normal;
  letter-spacing: normal;
  word-spacing: normal;
  text-align: start;
  text-indent: 0;
  text-transform: none;
  white-space: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  color-scheme: light;
}
.smp-root:focus-visible { outline: 3px solid var(--smp-accent); outline-offset: -3px; }

.smp-root *, .smp-root *::before, .smp-root *::after { box-sizing: border-box; }
.smp-root :where(h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl, dd, address) { margin: 0; }
.smp-root :where(ul, ol) { padding: 0; list-style: none; }
.smp-root :where(h2, h3, h4, h5, h6) {
  font-family: var(--smp-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: inherit;
}
.smp-root :where(h2) { font-size: clamp(28px, 7.5cqi, 52px); }
.smp-root :where(h3) { font-size: clamp(19px, 4.8cqi, 25px); }
.smp-root :where(p, li, dd) { text-wrap: pretty; }
.smp-root :where(a) { color: inherit; text-decoration: none; }
.smp-root :where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: inherit; }
.smp-root :where(button) { margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.smp-root :where(img, svg, video, picture) { display: block; max-width: 100%; }
.smp-root :where(address) { font-style: normal; }
.smp-root :where(strong, b) { font-weight: 700; }
.smp-root :where(a, button, summary) { touch-action: manipulation; }
.smp-root :where(a, button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--smp-accent);
  outline-offset: 3px;
}
.smp-root [hidden] { display: none !important; }
/* A long typed name wraps instead of running out of the sample. */
.smp-root [data-smp] { overflow-wrap: anywhere; }

/* ---- Layout ------------------------------------------------------------------------------------ */

.smp-root .smp-wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--smp-gutter); }
.smp-root .smp-sec { padding-block: 56px; }
.smp-root .smp-sec.is-alt { background: var(--smp-surface); }
/* Columns: style="--smp-cols: 2; --smp-cols-wide: 4" (defaults 1 and 3). */
.smp-root .smp-grid {
  display: grid;
  gap: var(--smp-gap, 16px);
  grid-template-columns: repeat(var(--smp-cols, 1), minmax(0, 1fr));
}
/* Picture and text side by side on wide samples, stacked on phones. */
.smp-root .smp-split { display: grid; gap: 28px; align-items: center; }

@container smp (width >= 720px) {
  .smp-root > * { --smp-gutter: 40px; }
  .smp-root .smp-sec { padding-block: 96px; }
  .smp-root .smp-grid { --smp-gap: 24px; grid-template-columns: repeat(var(--smp-cols-wide, 3), minmax(0, 1fr)); }
  .smp-root .smp-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; }
  .smp-root .smp-phone-only { display: none !important; }
}
@container smp (width >= 1080px) {
  .smp-root > * { --smp-gutter: 56px; }
  .smp-root .smp-sec { padding-block: 120px; }
}
@container smp (width < 720px) {
  .smp-root .smp-wide-only { display: none !important; }
}

/* ---- Sticky header with the business name ------------------------------------------------------ */

.smp-root .smp-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px 20px;
  min-height: 60px;
  padding: 10px var(--smp-gutter);
  background: var(--smp-head-bg, var(--smp-bg));
  color: var(--smp-head-ink, var(--smp-ink));
}
.smp-root .smp-brand {
  flex: 1 1 auto;
  min-width: 0;
  font: 700 clamp(17px, 4.6cqi, 22px)/1.15 var(--smp-display);
  letter-spacing: -0.01em;
}
.smp-root .smp-nav { display: none; gap: 28px; font-size: 15px; font-weight: 500; }
.smp-root .smp-nav a { padding-block: 10px; }
.smp-root .smp-nav a:hover { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.smp-root .smp-head .smp-btn { flex: none; min-height: 40px; padding: 8px 16px; font-size: 14px; }

@container smp (width >= 720px) {
  .smp-root .smp-head { min-height: 72px; }
  .smp-root .smp-nav { display: flex; }
}

/* ---- Type helpers ------------------------------------------------------------------------------ */

.smp-root .smp-display {
  font-family: var(--smp-display);
  font-size: clamp(38px, 11cqi, 96px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.smp-root .smp-lede { max-width: 34em; font-size: clamp(17px, 2.3cqi, 21px); line-height: 1.5; color: var(--smp-muted); }
.smp-root .smp-price { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ---- Buttons ----------------------------------------------------------------------------------- */

.smp-root .smp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: var(--smp-radius);
  background: var(--smp-accent);
  color: var(--smp-on-accent);
  font: 600 15px/1.2 var(--smp-text);
  text-align: center;
  transition: background-color 0.16s ease-out, color 0.16s ease-out, transform 0.16s ease-out;
}
.smp-root .smp-btn:hover { background: color-mix(in srgb, var(--smp-accent) 86%, #000); }
.smp-root .smp-btn:active { transform: translateY(1px); }
[data-ui].smp-root .smp-btn.is-line { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.smp-root .smp-btn.is-line:hover { background: var(--smp-surface); }
/* The WhatsApp button can carry its own colours: palette { 'wa-bg': ..., 'wa-ink': ... }. */
.smp-root .smp-wa { background: var(--smp-wa-bg, var(--smp-accent)); color: var(--smp-wa-ink, var(--smp-on-accent)); }
.smp-root .smp-wa:hover { background: color-mix(in srgb, var(--smp-wa-bg, var(--smp-accent)) 86%, #000); }

/* ---- Notes ------------------------------------------------------------------------------------- */

/* ctx.note(): small honest print such as "Sample prices". */
.smp-root .smp-note { font-size: 13px; line-height: 1.45; color: var(--smp-muted); }
/* What a WhatsApp button shows instead of opening WhatsApp. Tap it to close. */
.smp-root .smp-wa-note {
  display: block;
  flex: 1 1 100%;
  max-width: 30em;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--smp-radius);
  background: var(--smp-ink);
  color: var(--smp-bg);
  font-size: 14px;
  cursor: pointer;
  animation: smp-note-in 0.2s ease-out;
}
.smp-root .smp-head .smp-wa-note {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-width: none;
  margin: 0;
  border-radius: 0;
  padding: 12px var(--smp-gutter);
}
@keyframes smp-note-in { from { opacity: 0; } }

/* ---- Pictures ---------------------------------------------------------------------------------- */

/* Give the picture a shape (aspect-ratio or a height) and the photo covers it around its focal point;
   without one it keeps the photo's own proportions. */
.smp-root .smp-pic { display: block; overflow: hidden; background-color: var(--smp-surface); }
.smp-root .smp-pic > img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Facts: hours, delivery, payment ----------------------------------------------------------- */

/* <dl class="smp-facts"><div><dt>Open</dt><dd>Mon to Sat, 8am to 8pm</dd></div>...</dl> */
.smp-root .smp-facts { display: grid; gap: 18px; }
.smp-root .smp-facts dt { font-size: 14px; color: var(--smp-muted); }
.smp-root .smp-facts dd { font-size: 17px; font-weight: 600; }
@container smp (width >= 720px) {
  .smp-root .smp-facts { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px 32px; }
}

/* ---- Colophon: the engine's last line in every sample ------------------------------------------ */

.smp-root .smp-colophon {
  padding: 22px var(--smp-gutter) 30px;
  background: var(--smp-bg);
  color: var(--smp-muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* ---- Reduced motion ---------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .smp-root *, .smp-root *::before, .smp-root *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
