/* Senco Roof Designer
   Brand is Senco's own: near-black + gold, Oswald for display, Inter for text.
   The stage is dark on purpose — a neutral dark surround is how you judge a roof
   colour honestly. On a white page every shingle reads lighter than it will look
   on the house. */

:root{
  --ink:#131313;
  --ink-2:#1a1a1a;
  --ink-3:#232323;
  --paper:#ffffff;
  --line:#2e2e2e;
  --gold:#cda345;
  --gold-hi:#dcb356;
  --t-dark:#eceae3;
  --t-mut:#a5a099;
  --oswald:'Oswald','Arial Narrow',Impact,sans-serif;
  --inter:'Inter',-apple-system,'Helvetica Neue',Arial,sans-serif;
  --rail-h:190px;
}

*{box-sizing:border-box}
/* Author display rules (.rd-slider{display:flex} etc.) tie on specificity with the
   UA sheet's [hidden] and win on order, which quietly leaves hidden panels visible. */
[hidden]{display:none !important}
html,body{margin:0;padding:0;height:100%}
body{
  background:var(--ink);color:var(--t-dark);font-family:var(--inter);
  overflow:hidden;-webkit-font-smoothing:antialiased;
}
button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}
:focus-visible{outline:2px solid var(--gold);outline-offset:2px}

.rd{display:flex;flex-direction:column;height:100dvh}

/* ---------- top bar ---------- */
.rd-bar{
  display:flex;align-items:center;gap:1.4rem;
  padding:.7rem 1.1rem;background:var(--ink);border-bottom:1px solid var(--line);
  flex:0 0 auto;z-index:6;
}
.rd-logo img{height:26px;width:auto;display:block}
.rd-modes{display:flex;gap:2px;margin-left:auto;background:var(--ink-3);padding:3px;border-radius:2px}
.rd-modes button{
  font-family:var(--oswald);font-weight:600;text-transform:uppercase;letter-spacing:.08em;
  font-size:.74rem;padding:.5rem .95rem;color:var(--t-mut);white-space:nowrap;
  transition:background .16s,color .16s;
}
.rd-modes button[aria-selected="true"]{background:var(--gold);color:var(--ink)}
.rd-modes button:hover:not([aria-selected="true"]){color:var(--t-dark)}
.rd-back{
  color:var(--t-mut);text-decoration:none;font-size:.8rem;letter-spacing:.04em;white-space:nowrap;
}
.rd-back:hover{color:var(--gold)}

/* ---------- stage ---------- */
.rd-stage{position:relative;flex:1 1 auto;min-height:0;background:#0d0d0f;overflow:hidden}
#stage3d{position:absolute;inset:0}
#stage3d canvas{display:block;width:100%;height:100%}
.rd-photo-wrap{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:10px}
#stagephoto{max-width:100%;max-height:100%;display:block;box-shadow:0 18px 60px #0009}
.rd-mode-panel[hidden]{display:none}

/* overlays */
/* Scrim: the readout sits over open sky, and grey-on-pale-blue is unreadable.
   A soft top-left wash costs nothing and keeps the type legible at any sun angle. */
.rd-stage::before{
  content:'';position:absolute;inset:0 auto auto 0;width:min(70%,620px);height:230px;
  background:linear-gradient(140deg,rgba(10,10,12,.72),rgba(10,10,12,.32) 45%,transparent 78%);
  pointer-events:none;z-index:2;
}
.rd-readout{
  position:absolute;left:1.3rem;top:1.15rem;pointer-events:none;z-index:3;
  text-shadow:0 2px 14px rgba(0,0,0,.8);max-width:min(46vw,340px);
}
.rd-eyebrow{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.22em;
  font-size:.66rem;color:var(--gold);margin-bottom:.25rem;
}
.rd-color{
  font-family:var(--oswald);font-weight:600;text-transform:uppercase;letter-spacing:.02em;
  font-size:clamp(1.5rem,3.4vw,2.35rem);line-height:1.02;margin:0;
}
.rd-product{font-size:.8rem;color:#d8d5cd;margin-top:.45rem;letter-spacing:.02em;line-height:1.4}
.rd-note{font-size:.74rem;color:var(--t-mut);margin-top:.2rem;line-height:1.45}

.rd-tools{
  position:absolute;right:1.1rem;top:1.1rem;display:flex;flex-direction:column;
  align-items:flex-end;gap:.45rem;
}
.rd-views{display:flex;gap:2px;background:rgba(19,19,19,.72);padding:3px;backdrop-filter:blur(8px)}
.rd-views button{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.09em;font-size:.66rem;
  padding:.42rem .7rem;color:var(--t-mut);
}
.rd-views button[aria-pressed="true"]{background:var(--gold);color:var(--ink)}
.rd-views button:hover:not([aria-pressed="true"]){color:#fff}

.rd-slider{
  position:absolute;left:50%;transform:translateX(-50%);bottom:1rem;
  display:flex;align-items:center;gap:.7rem;
  background:rgba(19,19,19,.74);backdrop-filter:blur(8px);
  padding:.55rem 1rem;width:min(420px,72vw);
}
.rd-slider label{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.11em;
  font-size:.63rem;color:var(--t-mut);white-space:nowrap;
}
.rd-slider input[type=range]{flex:1;accent-color:var(--gold);min-width:0}
.rd-slider output{font-size:.7rem;color:var(--gold);min-width:5.5ch;text-align:right;font-variant-numeric:tabular-nums}

.rd-badge{
  position:absolute;left:1.3rem;bottom:1rem;
  font-size:.7rem;color:var(--t-mut);background:rgba(19,19,19,.7);
  padding:.4rem .7rem;backdrop-filter:blur(8px);max-width:min(52vw,420px);line-height:1.45;
}
.rd-badge strong{color:var(--gold);font-weight:600}

.rd-loading{
  position:absolute;inset:0;display:grid;place-items:center;background:#0d0d0f;z-index:8;
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.2em;font-size:.78rem;color:var(--t-mut);
  transition:opacity .35s ease;
}
.rd-loading[hidden]{display:none}

/* ---------- bottom rail ---------- */
.rd-rail{
  flex:0 0 auto;background:var(--ink);border-top:1px solid var(--line);
  display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 1.2rem;
  padding:.85rem 1.1rem 1rem;align-items:start;
}
/* the swatch strip is wider than the viewport; without min-width:0 the grid track
   refuses to shrink and pushes the quote button off the right edge */
.rd-rail > :first-child{min-width:0}
.rd-tiers{display:flex;gap:.4rem;flex-wrap:wrap;margin-bottom:.7rem}
.rd-tiers button{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.08em;font-size:.7rem;
  padding:.42rem .8rem;border:1px solid var(--line);color:var(--t-mut);
  transition:border-color .16s,color .16s;white-space:nowrap;
}
.rd-tiers button[aria-pressed="true"]{border-color:var(--gold);color:var(--gold)}
.rd-tiers button:hover:not([aria-pressed="true"]){color:var(--t-dark);border-color:#4a4a4a}

.rd-swatches{
  display:flex;gap:.5rem;overflow-x:auto;padding-bottom:.35rem;
  scrollbar-width:thin;scrollbar-color:#3a3a3a transparent;
}
.rd-swatches::-webkit-scrollbar{height:6px}
.rd-swatches::-webkit-scrollbar-thumb{background:#3a3a3a}
.sw{
  flex:0 0 auto;width:62px;text-align:left;position:relative;
  border:1px solid transparent;padding:2px;transition:border-color .14s,transform .14s;
}
.sw img{width:100%;height:52px;object-fit:cover;display:block}
.sw span{
  display:block;font-size:.62rem;line-height:1.2;color:var(--t-mut);
  margin-top:.28rem;letter-spacing:.01em;
}
.sw:hover{transform:translateY(-2px)}
.sw:hover span{color:var(--t-dark)}
.sw[aria-pressed="true"]{border-color:var(--gold)}
.sw[aria-pressed="true"] span{color:var(--gold)}

/* Compare mode: without a per-swatch badge there is no way to tell which colour is
   on the left of the split and which is on the right — both just look unselected. */
.sw[data-slot]{border-color:#5a5a5a}
.sw[data-slot] span{color:var(--t-dark)}
.sw[data-slot]::after{
  position:absolute;top:4px;left:4px;z-index:2;
  font-family:var(--oswald);font-weight:700;font-size:.62rem;letter-spacing:.06em;
  line-height:1;padding:3px 5px;background:var(--gold);color:var(--ink);
}
.sw[data-slot="a"]::after{content:"A"}
.sw[data-slot="b"]::after{content:"B"}
.sw[data-slot="ab"]::after{content:"A+B"}
.sw[data-slot]{border-color:var(--gold)}
/* the one your next click will change */
.sw[data-editing="true"]{outline:2px solid var(--gold);outline-offset:1px}

.rd-compare{
  position:absolute;inset:0;pointer-events:none;z-index:3;
  display:flex;align-items:flex-end;
}
.rd-compare .ct{
  flex:1;display:flex;align-items:center;gap:.45rem;
  margin:0 0 3.6rem;padding:.4rem .7rem;
  font-size:.78rem;color:var(--t-dark);
  background:rgba(19,19,19,.72);backdrop-filter:blur(8px);
}
.rd-compare .ct b{
  font-family:var(--oswald);background:var(--gold);color:var(--ink);
  padding:2px 6px;font-size:.68rem;letter-spacing:.06em;
}
.rd-compare .ct-a{margin-left:1.3rem;margin-right:auto;justify-content:flex-start}
.rd-compare .ct-b{margin-right:1.3rem;margin-left:auto;justify-content:flex-end}
.rd-compare .ct-line{
  position:absolute;left:50%;top:0;bottom:0;width:1px;
  background:linear-gradient(180deg,transparent,rgba(205,163,69,.75) 18%,rgba(205,163,69,.75) 82%,transparent);
}

.rd-actions{display:flex;flex-direction:column;gap:.5rem;align-self:end;min-width:210px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.55rem;
  font-family:var(--oswald);font-weight:600;text-transform:uppercase;letter-spacing:.08em;
  font-size:.86rem;padding:.85rem 1.5rem;border:1px solid transparent;cursor:pointer;
  transition:transform .18s ease,background .18s ease,color .18s ease,border-color .18s ease;
  text-decoration:none;
}
.btn-gold{background:var(--gold);color:var(--ink)}
.btn-gold:hover{background:var(--gold-hi);transform:translateY(-2px)}
.btn-ghost{border-color:#4a4a4a;color:var(--t-dark)}
.btn-ghost:hover{border-color:var(--gold);color:var(--gold)}
.btn-sm{font-size:.72rem;padding:.55rem 1rem}

.rd-disclaim{font-size:.66rem;color:#77736c;line-height:1.5;max-width:230px}

/* ---------- your home ---------- */
.yh-drop{position:absolute;inset:0;display:grid;place-items:center;padding:1.5rem;text-align:center}
.yh-intro h2{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.05em;
  font-size:clamp(1.3rem,3vw,1.9rem);margin:0 0 .5rem;
}
.yh-intro p{color:var(--t-mut);margin:0 0 1.1rem;font-size:.92rem}
.yh-intro .btn{display:inline-flex}
.yh-priv{font-size:.74rem;color:#77736c;margin-top:1rem !important;max-width:34ch;margin-inline:auto}
/* Decode status + failure line on the drop screen. Failure copy must be readable
   at a glance — it is the only thing standing between a HEIC on desktop Chrome
   and a silent dead end. */
.yh-drop-msg{font-size:.8rem;color:#a8a49c;margin:.8rem auto 0 !important;max-width:44ch;line-height:1.5}
.yh-drop-msg.bad{color:#ff8a6b}
.yh-drop.over{outline:2px dashed var(--gold);outline-offset:-14px}

.yh-work{position:absolute;inset:0;display:flex;flex-direction:column}
.yh-canvas-wrap{position:relative;flex:1;min-height:0;display:grid;place-items:center;padding:10px}
.yh-canvas-wrap canvas{
  position:absolute;max-width:100%;max-height:100%;
  box-shadow:0 18px 60px #0009;touch-action:none;
}
#yh-overlay{cursor:crosshair}
.yh-steps{flex:0 0 auto;background:rgba(19,19,19,.86);backdrop-filter:blur(8px)}
.yh-step{
  display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;
  padding:.7rem 1rem;font-size:.84rem;color:var(--t-dark);
}
.yh-step b{
  font-family:var(--oswald);background:var(--gold);color:var(--ink);
  width:1.5rem;height:1.5rem;display:grid;place-items:center;flex:0 0 auto;font-size:.8rem;
}
.yh-step .btn{margin-left:auto}
.yh-step .btn + .btn{margin-left:.5rem}
.yh-tol{display:flex;align-items:center;gap:.5rem;font-size:.74rem;color:var(--t-mut)}
.yh-tol input{accent-color:var(--gold);width:110px}
.yh-mode{display:flex;gap:2px}
.yh-mode button{
  font-family:var(--oswald);text-transform:uppercase;letter-spacing:.08em;font-size:.66rem;
  padding:.4rem .7rem;border:1px solid var(--line);color:var(--t-mut);
  transition:border-color .16s,color .16s;
}
.yh-mode button[aria-pressed="true"]{border-color:var(--gold);color:var(--gold)}
/* full-width small print under the step-1 controls: the honest disclosure for the
   hosted "find my roof" path */
.yh-autonote{flex:1 1 100%;margin:.15rem 0 0;font-size:.68rem;color:#77736c;line-height:1.5}
#yh-auto[disabled]{opacity:.6;cursor:default;transform:none}

/* the on-device alternative on the drop screen: a real choice, visibly clickable,
   deliberately quieter than the main button */
.yh-priv-link{
  display:block;margin:.55rem auto 0;max-width:38ch;
  font-size:.74rem;color:var(--t-mut);line-height:1.5;
  text-decoration:underline;text-underline-offset:3px;cursor:pointer;
}
.yh-priv-link:hover{color:var(--gold)}

/* step buttons grouped so hiding any one of them never re-flows the row */
.yh-btns{margin-left:auto;display:flex;gap:.5rem;flex-wrap:wrap;align-items:center}
.yh-btns .btn{margin-left:0}

/* Progress while the roof find runs. It lives ON the photo — a card over the image
   plus the scan veil below — because a status line tucked under a row of buttons
   does not read as "working on it". Honest stage text + elapsed seconds, never a
   percentage (we have no idea how far along the server is). */
.yh-progress{
  position:absolute;z-index:3;left:50%;top:50%;transform:translate(-50%,-50%);
  display:flex;flex-direction:column;align-items:center;gap:.7rem;
  background:rgba(15,15,16,.84);backdrop-filter:blur(8px);
  border:1px solid rgba(205,163,69,.30);
  padding:1rem 1.25rem;max-width:min(88%,400px);text-align:center;
  font-size:.84rem;color:var(--t-dark);box-shadow:0 14px 44px #000a;
}
.yh-progress-row{display:flex;align-items:center;gap:.6rem}
.yh-spin{
  width:13px;height:13px;flex:0 0 auto;border-radius:50%;
  border:2px solid rgba(205,163,69,.28);border-top-color:var(--gold);
  animation:yh-spin .8s linear infinite;
}
@keyframes yh-spin{to{transform:rotate(360deg)}}
.yh-progress-time{color:var(--gold);font-variant-numeric:tabular-nums;min-width:3ch;text-align:left}
.yh-progress-sub{margin:0;font-size:.7rem;color:var(--t-mut);line-height:1.45}

/* The veil + scanning band, painted as the overlay CANVAS's own background so it
   covers exactly the photo's box (the canvas is the photo's box) and never blocks
   a tap — backgrounds don't take events, and taps during the find are kept. */
#yh-overlay.busy{
  background-color:rgba(8,8,10,.42);
  background-image:linear-gradient(180deg,transparent,
    rgba(205,163,69,.14) 38%,rgba(220,179,86,.30) 50%,rgba(205,163,69,.14) 62%,transparent);
  background-size:100% 34%;background-repeat:no-repeat;
  animation:yh-scan 2.8s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes yh-scan{0%{background-position:0 -60%}100%{background-position:0 160%}}
@media (prefers-reduced-motion:reduce){
  #yh-overlay.busy{animation:none;background-image:none}
}

.yh-keys{font-size:.7rem;color:#77736c}
@media (max-width:620px){ .yh-keys{display:none} }

/* ── Phone: the step buttons become a real 2-column grid ────────────────────
   What was wrong at 390px: `.yh-btns` is `margin-left:auto` + `flex-wrap`, so each
   wrapped row right-aligns to its OWN width and the stack comes out ragged, with a
   lone button on a row in places. It is also simply too tight — "USE A DIFFERENT
   PHOTO" at .72rem uppercase Oswald with .08em tracking needs about 172px, and half
   of a 390px row (less padding and gap) is about 175px.

   ⚠️ Checked on EVERY step, not just the first — the counts differ and a naive grid
   leaves a hole in some of them:
     step 1  4 buttons   Find / Use a different photo / Start over / Looks right
     step 2  3 buttons   Back / Use a different photo / Show my roof
     reveal  2 buttons   Adjust the outline / Use a different photo
   So the longest secondary (`#yh-auto`) takes a full row and the primary always
   spans the full width and lands last. That leaves no gaps at 4, 3 or 2 buttons,
   and puts the primary in the same place on every step. */
@media (max-width:430px){
  .yh-step{gap:.55rem;padding:.65rem .8rem}
  .yh-tol{width:100%}
  .yh-tol input{flex:1 1 auto;width:auto}
  .yh-btns{
    margin-left:0;width:100%;
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem;
  }
  .yh-btns .btn{
    width:100%;padding:.6rem .5rem;font-size:.7rem;letter-spacing:.05em;
    /* labels must be allowed to wrap, or they overflow their cell */
    white-space:normal;line-height:1.15;
    min-height:44px;               /* the iOS minimum tap target */
  }
  .yh-btns #yh-auto{grid-column:1/-1}
  .yh-btns .btn-gold{grid-column:1/-1;order:9}
  /* the drop screen's one call to action, same tap target */
  .yh-intro .btn{display:flex;width:100%;min-height:44px}
}

/* ---------- quote dialog ---------- */
dialog.rd-quote{
  border:1px solid var(--line);background:var(--ink-2);color:var(--t-dark);
  padding:0;width:min(640px,94vw);max-height:92dvh;
}
dialog.rd-quote::backdrop{background:rgba(0,0,0,.72);backdrop-filter:blur(3px)}
.q-head{display:flex;gap:1rem;padding:1.1rem 1.3rem;border-bottom:1px solid var(--line);align-items:center}
.q-head img{width:104px;height:72px;object-fit:cover;flex:0 0 auto;border:1px solid var(--line)}
.q-head h2{font-family:var(--oswald);text-transform:uppercase;letter-spacing:.06em;font-size:1.1rem;margin:0 0 .2rem}
.q-head p{margin:0;font-size:.78rem;color:var(--t-mut)}
.q-body{padding:1.1rem 1.3rem;overflow:auto}
.q-grid{display:grid;grid-template-columns:1fr 1fr;gap:.75rem}
.q-field{display:flex;flex-direction:column;gap:.3rem}
.q-field.full{grid-column:1/-1}
.q-field label{font-size:.72rem;letter-spacing:.06em;text-transform:uppercase;color:var(--t-mut);font-family:var(--oswald)}
.q-field input,.q-field textarea{
  background:var(--ink);border:1px solid var(--line);color:var(--t-dark);
  padding:.6rem .7rem;font:inherit;font-size:.88rem;border-radius:0;
}
.q-field input:focus,.q-field textarea:focus{border-color:var(--gold);outline:none}
.q-field textarea{min-height:74px;resize:vertical}
.q-foot{display:flex;gap:.6rem;align-items:center;padding:1rem 1.3rem;border-top:1px solid var(--line)}
.q-foot .btn{flex:1}
.q-note{font-size:.68rem;color:#77736c;padding:0 1.3rem 1rem;line-height:1.5}
.q-carry{
  margin:0 0 .45rem;font-size:.78rem;line-height:1.5;color:var(--t-mut);
}
.q-carry b{color:var(--gold);font-weight:600}

.q-error{color:#ff8a6b;font-size:.8rem;padding:0 1.3rem .6rem}
#q-turnstile{padding:0 1.3rem .9rem;min-height:65px}

/* ---------- responsive ---------- */
@media (max-width:820px){
  .rd-bar{gap:.8rem;padding:.6rem .8rem}
  .rd-back{display:none}
  .rd-rail{grid-template-columns:1fr;padding:.7rem .8rem .8rem}
  .rd-actions{min-width:0;flex-direction:row;align-items:center}
  .rd-actions .btn{flex:1}
  .rd-disclaim{display:none}
  /* On a phone the readout and the camera buttons fight for the top of the stage,
     so the buttons drop to the bottom-left and the scrim spans the full width. */
  .rd-readout{max-width:none;right:1rem;left:1rem}
  .rd-color{font-size:1.45rem}
  .rd-stage::before{width:100%;height:150px;
    background:linear-gradient(180deg,rgba(10,10,12,.78),rgba(10,10,12,.30) 60%,transparent)}
  .rd-tools{top:auto;bottom:3.3rem;right:auto;left:.8rem;align-items:flex-start;flex-direction:row}
  .rd-badge{display:none}
  .rd-slider{width:calc(100% - 1.6rem);bottom:.7rem}
  .sw{width:56px}
  .sw img{height:46px}
  .q-grid{grid-template-columns:1fr}
}
@media (max-height:620px){
  .rd-tiers{margin-bottom:.45rem}
  .sw img{height:42px}
}
@media (prefers-reduced-motion:reduce){
  *{transition-duration:.01ms !important;animation-duration:.01ms !important}
}

/* ---- roof picker --------------------------------------------------------- */
/* Sits under the stage, not over it: anything floating on the photo competes with
   the before/after slider and covers the roof the visitor came to look at. */
.rd-roofs-bar{
  display:flex;align-items:center;gap:.9rem;flex-wrap:wrap;
  padding:.7rem clamp(.75rem,2vw,1.4rem);border-top:1px solid rgba(255,255,255,.08);
}
.rd-roofs-lab{
  font-family:var(--rd-oswald,inherit);font-size:.68rem;letter-spacing:.18em;
  text-transform:uppercase;color:#8d8a85;white-space:nowrap;
}
.rd-roofs{display:flex;gap:.45rem;flex-wrap:wrap}
.rd-roofs button{
  font:inherit;font-size:.78rem;letter-spacing:.04em;cursor:pointer;
  padding:.42rem .8rem;color:#d8d5d0;background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.14);border-radius:2px;
  transition:background .14s,border-color .14s,color .14s;
}
.rd-roofs button:hover{background:rgba(205,163,69,.14);border-color:rgba(205,163,69,.5)}
.rd-roofs button[aria-pressed="true"]{
  color:#12100e;background:var(--rd-gold,#cda345);border-color:var(--rd-gold,#cda345);
}
.rd-roofs button:focus-visible{outline:2px solid var(--rd-gold,#cda345);outline-offset:2px}
.rd-roofs[aria-busy="true"] button{opacity:.55;pointer-events:none}
.rd-roofs-note{font-size:.78rem;color:#8d8a85;flex:1 1 14rem;min-width:0}
@media (max-width:620px){ .rd-roofs-note{display:none} }
