/* Design Your Garden Room: page layer on top of the lab's designer.css (loaded after it).
   designer.css is synced unchanged from qa/designer-demo/ by scripts/sync-designer.sh and was
   written for a full-screen app, so this file (a) puts the site's page-level rules back
   (scrolling body, typography, header/footer focus rings) and (b) fits the app between the
   shared header and footer. Edit this file, never the synced designer.css. */

/* ---------- give the page back to the site ---------- */
html, body { height: auto; }
body { overflow: visible; background: var(--color-white); line-height: 1.6; }
.app, .enquiry { line-height: 1.45; }
/* designer.css draws a blue focus ring on everything; the shared header, footer and banner keep the browser default as on every other page */
body > header :focus-visible, .site-footer :focus-visible, .cookie-banner :focus-visible, .skip-link:focus-visible { outline: revert; outline-offset: revert; }
#content:focus { outline: none; } /* focused by design-page.js after the skip link */
/* designer.css's global `button { font: inherit }` and `.btn` rules, undone for the shared header and cookie banner
   (only the properties style.css leaves to the browser or sets on .btn-sm) */
body > header button, .cookie-banner button { font-family: revert; font-size: revert; line-height: revert; }
.cookie-banner button { font-family: inherit; }
body > header .btn { min-height: 0; padding: 10px 20px; border-radius: 4px; font-weight: 900; font-size: 13px; }

/* the site's .btn (uppercase, white !important, inline-flex) must not leak into the designer's buttons */
.app .btn, .enquiry .btn {
  display: block;
  text-transform: none;
  letter-spacing: normal;
  font-family: inherit;
  font-weight: 700;
  font-size: 15.5px;
  padding: 0 20px;
  border-radius: 8px;
  text-align: center;
}
.app .btn--primary:focus-visible, .enquiry .btn--primary:focus-visible { background-color: var(--green); }
.app .btn--ghost, .enquiry .btn--ghost { color: var(--navy) !important; }
.app .btn--ghost:focus-visible, .enquiry .btn--ghost:focus-visible { background-color: #fff; }
/* the site's .btn:hover would win over designer.css here; hover only where a pointer hovers */
.app .btn--primary:hover, .enquiry .btn--primary:hover { background-color: var(--green); }
.app .btn--ghost:hover, .enquiry .btn--ghost:hover { background-color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .app .btn--primary:hover, .enquiry .btn--primary:hover { background-color: var(--green-dark); }
  .app .btn--ghost:hover, .enquiry .btn--ghost:hover { background-color: var(--stone-2); }
}
.app .step__head { font-weight: inherit; color: inherit; }

/* ---------- intro ---------- */
.dgr-intro { max-width: var(--container-max-wide); margin-inline: auto; padding: 32px 20px 20px; }
.dgr-intro h1 { margin: 0 0 6px; color: var(--color-secondary); font-size: clamp(28px, 3.2vw, 40px); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.dgr-intro p { margin: 0; font-size: 18px; max-width: 62ch; }

/* ---------- app: desktop fills the viewport minus a small margin ---------- */
.dgr-app { padding: 0 16px 16px; }
.app {
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  min-height: 560px;
  max-height: 1100px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
/* Desktop: the whole designer on the first screen. The app takes what is left of the window under the
   site header (113px from 1025px wide, 65px below that) and the intro, so the view chips, the foot of
   the room and the spec bar are in view without scrolling. */
@media (min-width: 900px) {
  .dgr-intro { padding: 16px 20px 12px; }
  .dgr-intro h1 { font-size: 30px; margin-bottom: 2px; }
  .dgr-intro p { font-size: 16px; max-width: none; }
  .app { --dgr-above: 184px; height: max(560px, calc(100vh - var(--dgr-above))); height: max(560px, calc(100dvh - var(--dgr-above))); }
}
@media (min-width: 1025px) { .app { --dgr-above: 232px; } }
/* The step buttons and the options are built by designer.js after the first paint. Their room is kept
   beforehand (sizes measured from the built page: step 1 open, default design), so nothing below them
   jumps when they arrive: without this the note and the text under the designer moved about 1,250px. */
#progress:empty { min-height: 66px; }
#steps:empty { min-height: 1152px; }
/* let the wheel carry on to the page once the options list reaches its end (no scroll trap) */
.panel { overscroll-behavior: auto; }
.dgr-note { margin: 0; padding: 16px 20px 22px; font-size: 14px; color: #5b6b71; }

/* ---------- phones, upright or sideways (designer.css and designer.js use the same query) ----------
   The designer is a section of the page, which scrolls as any other: under the site header the 3D view sticks to
   the top of the screen, with the step row under it and the Back / Next bar stuck to the foot (designer.css); all
   of them let go at the end of the designer, so the text and the footer follow on. The intro's heading stays for
   search engines and screen readers. */
@media (max-width: 899px), (max-height: 500px) and (pointer: coarse) {
  .dgr-intro { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .dgr-app { padding: 0; }
  .app { height: auto; min-height: 0; max-height: none; border: 0; border-radius: 0; overflow: visible; }
  /* before designer.js builds the panel: the step row and the question's room are kept, so nothing jumps */
  #progress:empty { min-height: 44px; }
  #steps:empty { min-height: max(150px, var(--q-min)); margin-bottom: var(--bar-h, 66px); }
  /* the guide note: the summary's own first line says the same (we confirm everything at the free design visit) */
  .dgr-note { display: none; }
  .viewer__stage canvas { touch-action: none !important; }
  /* first visit, while the cookie notice covers the foot of the screen: a slightly shorter room, so the question
     between the room and the bar (which sits just above the notice) still has space */
  @media (orientation: portrait) { html.cookie-open .app { --view-h: clamp(180px, 32svh, 360px); } }
}

/* ---------- SEO copy below the app ---------- */
.dgr-seo { padding-block: 64px 72px; }
.dgr-seo .container { max-width: 820px; }
.dgr-seo h2 { color: var(--color-secondary); font-size: clamp(26px, 3vw, 34px); font-weight: 700; line-height: 1.2; margin-bottom: 16px; }
.dgr-seo p { font-size: 17px; }
.dgr-seo a { color: #3F5E18; text-decoration: underline; text-underline-offset: 3px; }
.dgr-seo a:hover { color: var(--color-secondary); }
@media (max-width: 899px) { .dgr-seo { padding-block: 44px 52px; } }

/* spam trap for the Formspree enquiry: off-screen, not focusable */
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* no JavaScript: the 3D view can't load, so say so over the "Building…" placeholder */
.dgr-noscript { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 24px; background: #eef2ea; text-align: center; }
.dgr-noscript p { max-width: 34em; margin: 0; font-size: 17px; color: var(--color-secondary); }
.dgr-noscript a { color: #3F5E18; text-decoration: underline; }

/* the 3D view couldn't start (design-page.js): message + Try again over the placeholder */
.dgr-fail { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; background: #eef2ea; text-align: center; }
.dgr-fail p { max-width: 34em; margin: 0; font-size: 17px; color: var(--color-secondary); }
.dgr-fail a { color: #3F5E18; text-decoration: underline; white-space: nowrap; }
.dgr-fail__retry { min-height: 48px; }

/* a light picture of a finished design while the 3D view builds (shows in the first frame, before any 3D work) */
/* poster.webp is made from the designer itself (qa/designer-demo/tools/make-poster.js): the default design in
   the default view. The camera frames the room to a share of the frame's width on every screen, so "cover"
   lines the picture up with the live 3D view and the one dissolves into the other. */
.viewer__loading {
  background: #5f7d3c url("poster.webp") center / cover no-repeat;
  place-items: end center; padding-bottom: 70px;
}
/* phones: the camera centres the room between the top row of controls and the pills at the foot (52px each),
   so on the middle of the view, as the picture is; the loading card sits just above the pills. */
@media (max-width: 899px), (max-height: 500px) and (pointer: coarse) {
  .viewer__loading { bottom: 0; padding-bottom: 62px; }
  /* a tall view (big phones): the camera keeps the room's share of the width, so the picture is sized to the
     width too; the strips of trees above and lawn below come from the same picture, scaled to cover, beneath */
  @media (max-aspect-ratio: 1/1) { .viewer__loading { background-image: url("poster.webp"), url("poster.webp"); background-size: 100% auto, cover; background-position: center, center; background-repeat: no-repeat; } }
}
.viewer__loading { font-size: 16px; color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75); }

/* touch screens: a one-finger up/down swipe on the 3D view scrolls the page (sideways turns the
   room, two fingers zoom). !important beats the inline touch-action OrbitControls sets. */
@media (pointer: coarse) and (min-width: 900px) and (min-height: 501px) {
  .viewer__stage canvas { touch-action: pan-y !important; }
}

/* Loading card over the poster: a bar that fills as the room is prepared and four build stages that take turns,
   so the wait reads as progress. CSS only, so it runs before the designer's script has even downloaded. The bar
   eases to 92% over 8 s and holds; the designer removes the whole cover when the room is ready. */
.dgr-load { width: min(360px, calc(100% - 40px)); padding: 18px 20px 16px; border-radius: 12px; background: rgba(35, 45, 51, 0.82); color: #fff; text-align: left; text-shadow: none; }
.dgr-load__title { margin: 0 0 12px; font-size: 17px; font-weight: 600; line-height: 1.3; color: #fff; }
.dgr-load__bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); overflow: hidden; }
.dgr-load__bar span { display: block; height: 100%; border-radius: 3px; background: #9cc864; transform-origin: left center; transform: scaleX(0.04); animation: dgr-load-fill 8s cubic-bezier(0.16, 0.8, 0.3, 1) forwards; }
.dgr-load__steps { position: relative; height: 22px; margin: 10px 0 0; padding: 0; list-style: none; }
.dgr-load__steps li { position: absolute; inset: 0; font-size: 15px; line-height: 22px; color: rgba(255, 255, 255, 0.92); opacity: 0; animation: dgr-load-step 8s ease-out forwards; }
.dgr-load__steps li:nth-child(2) { animation-delay: 2s; }
.dgr-load__steps li:nth-child(3) { animation-delay: 4s; }
.dgr-load__steps li:nth-child(4) { animation-name: dgr-load-last; animation-delay: 6s; animation-duration: 0.5s; }
@keyframes dgr-load-fill { to { transform: scaleX(0.92); } }
@keyframes dgr-load-step { 0% { opacity: 0; transform: translateY(6px); } 5%, 22% { opacity: 1; transform: none; } 27%, 100% { opacity: 0; transform: translateY(-6px); } }
@keyframes dgr-load-last { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .dgr-load__bar span { animation: none; transform: scaleX(0.6); }
  .dgr-load__steps { display: none; }
}
@media (max-width: 899px) {
  .dgr-load { width: min(300px, calc(100% - 32px)); padding: 12px 14px 10px; background: rgba(35, 45, 51, 0.78); }
  .dgr-load__title { margin-bottom: 8px; font-size: 15px; }
  .dgr-load__steps { margin-top: 6px; }
  .dgr-load__steps li { font-size: 14px; }
}
