/* The design system shared by every screen: owner console, contractor app, visualizer, platform page.
   One look everywhere: warm sand, soft moving light, glass surfaces, one strong action colour.

   Contents
   1. Tokens          colours, radius, shadows, motion
   2. Base            type, links, focus
   3. Backdrop        the moving light behind the glass
   4. Glass           the surface everything sits on
   5. Buttons
   6. Controls        fields, segmented control, switch, chips, swatches
   7. Pieces          badges, stat tiles, lists, tables, meters
   8. Layers          sheets, toasts
   9. Before / after  the comparison slider
   10. Motion         entrances, loading, reduced motion
*/

/* ---------- 1. TOKENS ---------- */
@font-face { font-family: 'Bricolage'; src: url('/ui/fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-stretch: 75% 100%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Onest'; src: url('/ui/fonts/onest.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --sand-0: #FDFBF7; --sand-1: #F6F0E6; --sand-2: #EFE6D8; --sand-3: #E4D8C5; --sand-4: #CDBDA4;
  --ink: #1E1A15; --ink-2: #5C5347; --ink-3: #746A5C; --ink-4: #B7AD9D;
  /* The action colour: a warm cognac, in the same family as the sand. A contractor's own colour replaces it inside their visualizer. */
  --accent: #A85F2A; --accent-hi: #D08A4A; --on-accent: #FFFFFF;
  --sun: #FFB65C; --coral: #F0694C; --leaf: #2C9A69; --amber: #D48A20; --rose: #D14B3D; --honey: #B98A2E; --berry: #B4487A; --grape: #7B5EA7;
  /* Headlines and big numbers: a grotesque with character. Text stays in Onest. */
  --display: 'Bricolage', 'Onest', -apple-system, 'Segoe UI', sans-serif;

  --glass-a: rgba(255, 254, 251, .58); --glass-b: rgba(255, 252, 246, .30);
  --glass-solid: rgba(255, 253, 249, .86);
  --rim: rgba(255, 255, 255, .85);
  --blur: 28px;

  --r-xs: 10px; --r-s: 14px; --r-m: 22px; --r-l: 30px; --r-xl: 38px; --r-pill: 999px;
  --shadow-s: 0 1px 1px rgba(84, 60, 24, .05), 0 6px 18px -8px rgba(84, 60, 24, .18);
  --shadow-m: 0 1px 2px rgba(84, 60, 24, .05), 0 18px 44px -18px rgba(84, 60, 24, .30);
  --shadow-l: 0 2px 4px rgba(84, 60, 24, .06), 0 40px 90px -30px rgba(84, 60, 24, .42);
  --ease: cubic-bezier(.22, .8, .24, 1); --spring: cubic-bezier(.34, 1.5, .5, 1);
  --pad: clamp(16px, 2.4vw, 28px);
  color-scheme: light;
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--sand-1); color: var(--ink);
  font: 450 16px/1.5 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'ss01', 'cv11'; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 680; letter-spacing: -.022em; line-height: 1.12; text-wrap: balance; }
h1, h2, .t-hero, .t-1, .t-2, .display { font-family: var(--display); font-optical-sizing: auto; }
.t-hero { font-size: clamp(38px, 6.2vw, 76px); font-weight: 800; font-stretch: 88%; letter-spacing: -.035em; line-height: .98; }
.t-1 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 780; font-stretch: 90%; letter-spacing: -.028em; }
.t-2 { font-size: 23px; font-weight: 720; font-stretch: 94%; letter-spacing: -.018em; }
.t-3 { font-size: 17px; letter-spacing: -.012em; }
.t-body { font-size: 16px; color: var(--ink-2); text-wrap: pretty; }
.t-small { font-size: 14px; color: var(--ink-2); }
.t-micro { font-size: 12.5px; font-weight: 560; color: var(--ink-3); letter-spacing: .005em; }
.t-num { font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.muted { color: var(--ink-3); }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid color-mix(in srgb, var(--accent) 80%, white); outline-offset: 3px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 3. BACKDROP ---------- */
/* Soft pools of light drifting behind everything. Glass needs something alive to blur. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(160deg, #F8F2E8 0%, #F1E8DA 48%, #EADFCF 100%); }
.backdrop i { position: absolute; width: 58vmax; height: 58vmax; border-radius: 50%; filter: blur(60px); opacity: .9; will-change: transform; translate: calc(var(--px, 0) * 1px) calc(var(--py, 0) * 1px); transition: translate 1.2s var(--ease); }
.backdrop i:nth-child(1) { left: -22vmax; top: -26vmax; background: radial-gradient(circle at 40% 40%, #FFC98F, transparent 62%); animation: drift-a 46s ease-in-out infinite alternate; }
.backdrop i:nth-child(2) { right: -24vmax; top: -8vmax; background: radial-gradient(circle at 50% 50%, #DDE6C4, transparent 60%); animation: drift-b 58s ease-in-out infinite alternate; }
.backdrop i:nth-child(3) { left: 12vmax; bottom: -34vmax; background: radial-gradient(circle at 50% 50%, #FFDF8C, transparent 60%); animation: drift-c 64s ease-in-out infinite alternate; }
.backdrop i:nth-child(4) { right: 4vmax; bottom: -30vmax; width: 46vmax; height: 46vmax; background: radial-gradient(circle at 50% 50%, #F5B5A2, transparent 60%); animation: drift-a 52s ease-in-out infinite alternate-reverse; }
/* A whisper of grain keeps the gradients from banding and gives the sand some tooth. */
.backdrop::after { content: ''; position: absolute; inset: 0; opacity: .32; mix-blend-mode: soft-light; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .38 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes drift-a { to { transform: translate(14vmax, 9vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(-12vmax, 14vmax) scale(.92); } }
@keyframes drift-c { to { transform: translate(10vmax, -12vmax) scale(1.08); } }

/* ---------- 4. GLASS ---------- */
/* Three layers: the frosted body, a rim of light on the edge, and a highlight that follows the pointer. */
.glass {
  position: relative; isolation: isolate; border-radius: var(--r-l);
  background: linear-gradient(180deg, var(--glass-a), var(--glass-b));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(175%); backdrop-filter: blur(var(--blur)) saturate(175%);
  box-shadow: inset 0 1px 0 var(--rim), inset 0 -1px 0 rgba(120, 92, 44, .07), var(--shadow-m);
}
.glass::before { /* rim light */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(140deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .25) 30%, rgba(255, 255, 255, .06) 62%, rgba(255, 255, 255, .7));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glass::after { /* pointer highlight, switched on by ui.js */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .75), transparent 62%);
  opacity: var(--lit, 0); transition: opacity .5s var(--ease);
}
.glass.thin { --blur: 18px; background: linear-gradient(180deg, rgba(255, 254, 251, .46), rgba(255, 252, 246, .22)); box-shadow: inset 0 1px 0 var(--rim), var(--shadow-s); }
.glass.solid { background: var(--glass-solid); }
.glass.flat { box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px rgba(255, 255, 255, .35); }
/* Glass floating over a photo: darker rim so it reads on any picture. */
.glass.on-photo { background: linear-gradient(180deg, rgba(255, 255, 255, .58), rgba(255, 255, 255, .34)); -webkit-backdrop-filter: blur(22px) saturate(190%) brightness(1.06); backdrop-filter: blur(22px) saturate(190%) brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 0 rgba(0, 0, 0, .05), 0 14px 40px -12px rgba(20, 14, 4, .45); }
.panel { padding: var(--pad); }
.panel > .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.inset { border-radius: var(--r-m); background: rgba(255, 255, 255, .5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), inset 0 1px 3px rgba(120, 92, 44, .08); }
.hairline { height: 1px; border: 0; margin: 0; background: linear-gradient(90deg, transparent, rgba(120, 92, 44, .16) 12%, rgba(120, 92, 44, .16) 88%, transparent); }

/* ---------- 5. BUTTONS ---------- */
.btn {
  --h: 48px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: var(--h); padding: 0 22px; border: 0; border-radius: var(--r-pill); background: none;
  font-weight: 620; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; text-decoration: none; user-select: none;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), background-color .2s, filter .2s; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.965); transition-duration: .08s; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn.sm { --h: 38px; padding: 0 16px; font-size: 14px; }
.btn.lg { --h: 58px; padding: 0 30px; font-size: 17px; }
.btn.block { display: flex; width: 100%; }
.btn.icon { width: var(--h); padding: 0; }
/* The one that must be seen: saturated, glossy, lifted by its own coloured glow. */
.btn-primary {
  color: var(--on-accent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 78%, white) 0%, var(--accent) 56%, color-mix(in oklab, var(--accent) 88%, black) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -3px 8px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .12), 0 12px 26px -8px color-mix(in srgb, var(--accent) 72%, transparent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.btn-primary::before { content: ''; position: absolute; inset: 1.5px 1.5px 50%; border-radius: var(--r-pill) var(--r-pill) 60% 60% / var(--r-pill) var(--r-pill) 22% 22%; background: linear-gradient(180deg, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0)); pointer-events: none; }
.btn-primary:hover { transform: translateY(-1.5px); filter: saturate(1.08) brightness(1.04); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -3px 8px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .12), 0 18px 34px -10px color-mix(in srgb, var(--accent) 78%, transparent); }
.btn-ink { color: #FFFDF8; background: linear-gradient(180deg, #3A342C, #1E1A15); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 24px -10px rgba(30, 26, 21, .7); }
.btn-ink:hover { transform: translateY(-1.5px); }
.btn-glass { color: var(--ink); background: linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, .46)); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(255, 255, 255, .55), var(--shadow-s); }
.btn-glass:hover { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62)); transform: translateY(-1px); }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover { background: rgba(120, 92, 44, .08); color: var(--ink); }
.btn-danger { color: var(--rose); background: color-mix(in srgb, var(--rose) 10%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--rose) 16%, transparent); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }

/* ---------- 6. CONTROLS ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.field .err { font-size: 13px; color: var(--rose); font-weight: 560; }
.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 16px; border: 0; border-radius: var(--r-s); outline: 0;
  background: rgba(255, 255, 255, .62); box-shadow: inset 0 0 0 1px rgba(120, 92, 44, .14), inset 0 2px 4px rgba(120, 92, 44, .07);
  transition: box-shadow .2s, background-color .2s;
}
.textarea { height: auto; min-height: 96px; padding: 13px 16px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:hover, .select:hover, .textarea:hover { background: rgba(255, 255, 255, .8); }
.input:focus, .select:focus, .textarea:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.input.bad { box-shadow: inset 0 0 0 1.5px var(--rose), 0 0 0 4px color-mix(in srgb, var(--rose) 12%, transparent); }
.select { appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235C5347' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 5 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; letter-spacing: -.01em; }

/* Segmented control: a glass thumb slides under the chosen option. */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: var(--r-pill); background: rgba(120, 92, 44, .09); box-shadow: inset 0 1px 2px rgba(120, 92, 44, .1); }
.seg button { position: relative; z-index: 1; height: 38px; padding: 0 18px; border: 0; border-radius: var(--r-pill); background: none; font-weight: 600; font-size: 14.5px; color: var(--ink-2); transition: color .25s; white-space: nowrap; }
.seg button[aria-pressed='true'] { color: var(--ink); }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: var(--r-pill); background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .82)); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(84, 60, 24, .12), 0 6px 14px -6px rgba(84, 60, 24, .3); transition: transform .45s var(--spring), width .45s var(--spring); }

/* Switch */
.switch { position: relative; width: 52px; height: 32px; flex: none; border: 0; border-radius: var(--r-pill); background: rgba(120, 92, 44, .2); box-shadow: inset 0 1px 3px rgba(84, 60, 24, .18); transition: background-color .3s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, #fff, #F3EEE6); box-shadow: 0 2px 6px rgba(84, 60, 24, .3), inset 0 1px 0 #fff; transition: transform .4s var(--spring), width .2s; }
.switch:active::after { width: 31px; }
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(20px); }
.switch[aria-checked='true']:active::after { transform: translateX(15px); }

/* Chips: small glass choices */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), inset 0 1px 0 #fff, 0 1px 2px rgba(84, 60, 24, .06); font-weight: 580; font-size: 14.5px; color: var(--ink-2); transition: transform .3s var(--spring), background-color .2s, color .2s, box-shadow .2s; }
.chip:hover { background: rgba(255, 255, 255, .85); color: var(--ink); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed='true'] { color: var(--on-accent); background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 82%, white), var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.chip .ico { width: 17px; height: 17px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), inset 0 2px 3px rgba(255, 255, 255, .5); background-size: cover; }

/* ---------- 7. PIECES ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 640; background: rgba(120, 92, 44, .1); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.good { color: #1C7B52; background: color-mix(in srgb, var(--leaf) 15%, transparent); }
.badge.info { color: #7A5A1C; background: color-mix(in srgb, var(--honey) 20%, transparent); }
.badge.warn { color: #A6492E; background: color-mix(in srgb, var(--coral) 16%, transparent); }
.badge.bad { color: #A8382C; background: color-mix(in srgb, var(--rose) 14%, transparent); }
.badge.live::before { animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

.avatar { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 13px; font-weight: 700; font-size: 15px; color: #fff; background: var(--c, var(--accent)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -6px 10px rgba(0, 0, 0, .12), 0 4px 10px -4px var(--c, var(--accent)); text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.avatar.round { border-radius: 50%; }
.avatar.lg { width: 56px; height: 56px; border-radius: 18px; font-size: 21px; }

.stat { padding: 20px 22px; border-radius: var(--r-m); }
.stat .k { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.stat .v { margin-top: 10px; font-family: var(--display); font-size: clamp(32px, 3.2vw, 44px); font-weight: 780; font-stretch: 90%; letter-spacing: -.03em; line-height: 1; }
.stat .d { margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.stat .d b { font-weight: 640; color: var(--leaf); }

.list { display: flex; flex-direction: column; }
.list > .item { display: flex; align-items: center; gap: 14px; padding: 14px 6px; border: 0; background: none; width: 100%; text-align: left; border-radius: var(--r-s); transition: background-color .2s; }
.list > .item + .item { box-shadow: 0 -1px 0 rgba(120, 92, 44, .1); }
.list > button.item:hover, .list > a.item:hover { background: rgba(255, 255, 255, .55); box-shadow: none; }
.list > button.item:hover + .item, .list > a.item:hover + .item { box-shadow: none; }

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { padding: 0 12px 10px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.table td { padding: 13px 12px; vertical-align: middle; box-shadow: 0 -1px 0 rgba(120, 92, 44, .1); }
.table tbody tr { transition: background-color .15s; cursor: pointer; }
.table tbody tr:hover { background: rgba(255, 255, 255, .5); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.meter { height: 8px; border-radius: var(--r-pill); background: rgba(120, 92, 44, .12); overflow: hidden; min-width: 60px; }
.meter > i { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-hi), var(--accent)); transition: width .9s var(--ease); }
.meter.hot > i { background: linear-gradient(90deg, var(--sun), var(--coral)); }

.code { display: block; padding: 14px 16px; border-radius: var(--r-s); background: #211D18; color: #F3E9D9; font: 500 13px/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), var(--shadow-s); }
.code b { color: #F0C27A; font-weight: 500; } .code i { color: #FFC98A; font-style: normal; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty .ico { width: 30px; height: 30px; color: var(--ink-4); }

/* ---------- 8. LAYERS ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(46, 34, 16, .26); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s var(--ease); }
.scrim.open { opacity: 1; }
.sheet { width: min(560px, 100%); max-height: 92dvh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 26px var(--pad) calc(var(--pad) + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(255, 254, 251, .9), rgba(250, 245, 236, .82)); -webkit-backdrop-filter: blur(36px) saturate(180%); backdrop-filter: blur(36px) saturate(180%); box-shadow: inset 0 1px 0 #fff, var(--shadow-l); transform: translateY(40px) scale(.98); transition: transform .5s var(--spring); }
.sheet.wide { width: min(760px, 100%); }
.scrim.open .sheet { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(120, 92, 44, .22); margin: -12px auto 16px; }
@media (min-width: 720px) { .scrim { place-items: center; padding: 24px; } .sheet { border-radius: var(--r-xl); } .sheet .grab { display: none; } }

.toasts { position: fixed; z-index: 80; left: 16px; right: 16px; bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 12px 18px 12px 14px; border-radius: 22px; line-height: 1.35; text-wrap: balance; color: #FFFDF8; font-weight: 580; font-size: 14.5px; background: rgba(34, 29, 23, .86); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--shadow-m); animation: toast-in .5s var(--spring) both; }
.toast.out { animation: toast-out .3s var(--ease) both; }
.toast .ico { color: #F0C27A; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.92); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ---------- 9. BEFORE / AFTER ---------- */
.ba { position: relative; overflow: hidden; border-radius: var(--r-l); user-select: none; touch-action: pan-y; background: var(--sand-3); --p: 50%; }
.ba img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba .after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--p)); }
.ba .bar { position: absolute; top: 0; bottom: 0; left: var(--p); width: 2px; margin-left: -1px; background: rgba(255, 255, 255, .95); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 0 18px rgba(0, 0, 0, .35); }
.ba .knob { position: absolute; top: 50%; left: var(--p); width: 52px; height: 52px; margin: -26px 0 0 -26px; display: grid; place-items: center; border-radius: 50%; cursor: ew-resize; color: var(--ink); }
.ba .tag { position: absolute; top: 14px; height: 30px; padding: 0 13px; display: grid; place-items: center; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 640; }
.ba .tag.l { left: 14px; } .ba .tag.r { right: 14px; }
.ba input[type='range'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }

/* ---------- 10. MOTION ---------- */
.rise { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(6px); } }
.pop { animation: pop .5s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
.shimmer { position: relative; overflow: hidden; background: rgba(120, 92, 44, .1); border-radius: var(--r-s); }
.shimmer::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* People who ask for less motion or less transparency get a calm, solid version of the same design. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .backdrop i { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .btn-glass, .sheet { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--sand-0); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .btn-glass { background: rgba(255, 253, 249, .94); }
}

/* ---------- TINTS: a cheerful colour per subject (icons, guides, tiles) ---------- */
.tint { --t: var(--accent); }
/* One warm family, neighbours on the colour wheel: amber, terracotta, cognac, honey, bronze. Green stays for "done" only. */
.tint.sun { --t: #E09A1A; } .tint.leaf { --t: #C08A2B; } .tint.coral { --t: #D9643A; } .tint.berry { --t: #B5561F; } .tint.grape { --t: #8F6B43; }
.tico { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; color: var(--t, var(--accent)); background: linear-gradient(160deg, #fff, color-mix(in srgb, var(--t, var(--accent)) 16%, #fff)); box-shadow: inset 0 1px 0 #fff, 0 6px 16px -8px color-mix(in srgb, var(--t, var(--accent)) 70%, transparent); }
.tico.sm { width: 34px; height: 34px; border-radius: 11px; } .tico.sm .ico { width: 18px; height: 18px; }
.tico.fill { color: #fff; background: linear-gradient(150deg, color-mix(in srgb, var(--t, var(--accent)) 72%, #fff), var(--t, var(--accent))); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 10px 20px -10px var(--t, var(--accent)); }

/* ---------- GUIDE: says what a page is for, the first time someone lands on it ---------- */
.guide { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 18px 20px; margin-bottom: 18px; border-radius: var(--r-l); background: linear-gradient(115deg, color-mix(in srgb, var(--t, var(--accent)) 15%, rgba(255,255,255,.7)), rgba(255,255,255,.4) 70%); box-shadow: inset 0 1px 0 var(--rim), inset 0 0 0 1px color-mix(in srgb, var(--t, var(--accent)) 16%, transparent), var(--shadow-s); }
.guide h2 { font-size: 19px; } .guide p { margin-top: 4px; font-size: 15px; color: var(--ink-2); max-width: 62em; }
.guide ul { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.guide li { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 9px; border-radius: var(--r-pill); font-size: 13.5px; font-weight: 580; color: var(--ink); background: rgba(255,255,255,.72); box-shadow: inset 0 1px 0 #fff, var(--shadow-s); }
.guide li .ico { width: 15px; height: 15px; color: var(--t, var(--accent)); }
@media (max-width: 640px) { .guide { grid-template-columns: minmax(0, 1fr) auto; } .guide > .tico { display: none; } }

/* ---------- LIVELY DETAILS: coloured words, hover lifts, zooms, floating chips, reveals ---------- */
/* A coloured phrase inside a headline: a warm gradient that drifts slowly. Keep it to two or three words. */
.hl { display: inline-block; color: transparent; background: linear-gradient(100deg, #A84E1C, #D9643A 30%, #EFA22E 55%, #D9643A 80%, #A84E1C) 0 0 / 220% 100%; -webkit-background-clip: text; background-clip: text; animation: hl-drift 9s ease-in-out infinite alternate; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@keyframes hl-drift { to { background-position: 100% 0; } }
/* A framed stage for a whole section: volume, a rim of light and a glow of its own colour in one corner. */
.band { position: relative; isolation: isolate; padding: clamp(22px, 4vw, 52px); border-radius: var(--r-xl); background: linear-gradient(165deg, rgba(255, 255, 255, .72), rgba(255, 253, 248, .38)); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(255, 255, 255, .55), 0 2px 4px rgba(84, 60, 24, .05), 0 34px 80px -34px rgba(84, 60, 24, .38); overflow: hidden; }
.band::before { content: ''; position: absolute; z-index: -1; width: 520px; height: 520px; right: -160px; top: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(239, 162, 46, .30), transparent 66%); pointer-events: none; }
.band.left::before { right: auto; left: -180px; }
.band .glass { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 253, 249, .74)); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(84, 60, 24, .06), 0 14px 30px -18px rgba(84, 60, 24, .34); }
/* Cards that answer the pointer. */
.lift { transition: transform .4s var(--spring), box-shadow .3s; will-change: transform; }
.lift:hover { transform: translateY(-5px) scale(1.012); box-shadow: inset 0 1px 0 var(--rim), var(--shadow-m); }
.lift:hover .tico { transform: scale(1.1) rotate(-6deg); } .tico { transition: transform .4s var(--spring); }
.zoom { overflow: hidden; } .zoom img, .zoom .pic { transition: transform .9s var(--ease); } .zoom:hover img, .zoom:hover .pic { transform: scale(1.08); }
/* Small glass notes that float beside a picture. */
.chipf { position: absolute; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 18px; font-size: 13.5px; font-weight: 600; line-height: 1.25; white-space: nowrap; animation: floaty 6s ease-in-out var(--d, 0s) infinite; }
.chipf small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -9px; } }
/* Sections that arrive as they scroll into view (see reveal() in ui.js). */
.reveal { opacity: 0; translate: 0 22px; transition: opacity .8s var(--ease), translate .8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); } .reveal.in { opacity: 1; translate: 0 0; }
/* A row of pictures that glides by and stops under the pointer. */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
.marquee .track { display: flex; gap: 16px; width: max-content; padding: 10px 0 26px; animation: marquee 60s linear infinite; } .marquee:hover .track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 8px)); } }
/* A faint dotted field over the backdrop, strongest near the top. */
.backdrop::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(120, 92, 44, .16) 1px, transparent 1.3px); background-size: 26px 26px; -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 18%, #000, transparent 78%); mask-image: radial-gradient(ellipse 80% 60% at 50% 18%, #000, transparent 78%); }
.tilt { transition: transform .5s var(--ease); transform-style: preserve-3d; will-change: transform; }
@media (prefers-reduced-motion: reduce) { .chipf, .marquee .track, .hl { animation: none; } .reveal { opacity: 1; translate: none; transition: none; } .lift:hover, .zoom:hover img { transform: none; } }

/* A dark closing block, for contrast with the light sections. */
.band.dark { background: linear-gradient(160deg, #33271D, #1F1812); color: #FBF4E8; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 40px 80px -36px rgba(40, 26, 10, .7); }
.band.dark::before { background: radial-gradient(circle, rgba(239, 162, 46, .42), transparent 66%); } .band.dark .t-body { color: rgba(251, 244, 232, .78); }
.open { padding: 0 clamp(6px, 2.4vw, 30px); }

/* App style icon: a glossy rounded square in the section colour, white glyph. */
.appico { position: relative; width: 72px; height: 72px; flex: none; border-radius: 23px; display: grid; place-items: center; color: #fff; --t: #D9643A; background: linear-gradient(150deg, color-mix(in srgb, var(--t) 58%, #FFE2B0) 0%, var(--t) 55%, color-mix(in srgb, var(--t) 78%, #3A1C08) 100%); box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .6), inset 0 -10px 16px -10px rgba(60, 25, 5, .4), 0 20px 30px -16px var(--t), 0 2px 5px rgba(84, 60, 24, .16); transition: transform .45s var(--spring); }
.appico::after { content: ''; position: absolute; inset: 3px 3px 52% 3px; border-radius: 20px 20px 60% 60% / 20px 20px 40% 40%; background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0)); pointer-events: none; }
.appico .ico { position: relative; z-index: 1; width: 34px; height: 34px; stroke-width: 2.1; filter: drop-shadow(0 1.5px 1.5px rgba(60, 25, 5, .35)); }
.appico.amber { --t: #E59A1C; } .appico.cognac { --t: #B5561F; } .appico.terra { --t: #D9643A; } .appico.bronze { --t: #96703F; }
.lift:hover .appico { transform: translateY(-3px) rotate(-5deg) scale(1.06); }

/* The smallest phones (320 px wide): a two or three way switch takes the full width and its answers may wrap. */
@media (max-width: 350px) { .seg { display: grid; width: 100%; } .seg button { padding: 4px 8px; font-size: 13.5px; white-space: normal; line-height: 1.15; height: auto; min-height: 38px; } }
