/* water.portrait.org.uk front door (UI design call, board 20261119-1547, 15:50 + 16:29).
 *
 * Every colour here is a website token from vendor/ui_foundation.css (--ui-*); no new
 * colours. Dark is the tokens' default, body.theme-light (set by sw_theme.js from
 * prefers-color-scheme) switches to their light set.
 * Desktop (1024 and up): navy header, map edge to edge below it, one 380 px card on the
 * left, a "Map layers" button at the top right. Phone and tablet (under 1024): a 56 px
 * header, the search pinned under it, the card becomes a bottom sheet that never takes
 * more than about a third of the screen until the visitor drags it up, so at least 60%
 * stays map; the amber button is pinned at the foot of the sheet.
 * Rules UI settled: nothing in spaced capitals, body text 16 px, controls 44 px, no
 * coloured edges on cards (the old amber top rule is gone), no monospace.
 */
:root { --sw-head: 64px; --sw-card-w: 380px; --sw-gap: 16px; --sw-sheet-h: 0px; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ui-bg); color: var(--ui-text); font-family: var(--ui-font-body);
       font-size: 16px; line-height: 1.5; overflow: hidden; }
a { color: inherit; }

/* Header: the website's navy bar in both themes, logo left, "Sign in" as the website's
   secondary button. The header is always navy, so its button keeps the dark-theme values. */
.sw-top { position: fixed; top: 0; left: 0; right: 0; height: var(--sw-head); z-index: 30;
          display: flex; align-items: center; justify-content: space-between; gap: 16px;
          padding: 0 24px; background: var(--ui-navy); border-bottom: 1px solid rgba(255, 255, 255, 0.13); }
.sw-brand { display: inline-flex; align-items: center; min-height: 44px; }
.sw-brand img { display: block; width: 120px; height: auto; }
.sw-top .ui-btn--secondary { color: #f5f7fb; border-color: rgba(255, 255, 255, 0.3); }
.sw-top .ui-btn--secondary:hover { background: rgba(255, 255, 255, 0.08); color: #f5f7fb; }
.sw-signin { font-size: 15px; padding: 0.625rem 1.25rem; }

/* The map fills everything below the header, edge to edge. */
#map { position: fixed; top: var(--sw-head); left: 0; right: 0; bottom: 0; }

/* The one card (website card: surface, 12 px corners, no coloured edge). */
.sw-card { position: fixed; z-index: 20; top: calc(var(--sw-head) + var(--sw-gap)); left: var(--sw-gap);
           width: var(--sw-card-w); max-height: calc(100% - var(--sw-head) - 2 * var(--sw-gap));
           display: flex; flex-direction: column; background: var(--ui-surface); color: var(--ui-text);
           border: 1px solid var(--ui-line); border-radius: 12px; box-shadow: var(--ui-shadow-lg); }
.sw-body { padding: 24px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.sw-foot { padding: 0 24px 20px; flex: none; }
.sw-foot[hidden] { display: none; }
.sheet-handle { display: none; }
.sw-h1 { font-size: 1.75rem; margin: 0 0 16px; }

/* Search: 48 px high, 16 px text, website field colours. */
.search { position: relative; }
.search input { width: 100%; height: 48px; padding: 0 14px; font: inherit; font-size: 16px;
                color: var(--ui-field-text); background: var(--ui-field-bg);
                border: 1px solid var(--ui-field-line); border-radius: var(--ui-radius-lg); outline: none; }
.search input:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.search input::placeholder { color: #5b6b7f; }
#suggestions { position: absolute; left: 0; right: 0; top: 52px; z-index: 40; display: none;
               max-height: 46vh; overflow: auto; background: var(--ui-surface); color: var(--ui-text);
               border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-lg); }
#suggestions [role=option] { min-height: 44px; padding: 11px 14px; cursor: pointer; font-size: 16px;
                             border-bottom: 1px solid var(--ui-line); }
#suggestions [role=option]:last-child { border-bottom: 0; }
#suggestions [role=option].active, #suggestions [role=option]:hover { background: var(--ui-surface-2); }
#suggestions .empty-cta { font-weight: 600; }

/* The three points (approved claims, docs/claims.yaml) as ticked lines. */
.sw-ticks { list-style: none; margin: 20px 0 0; padding: 0; }
.sw-ticks li { position: relative; padding-left: 30px; margin: 0 0 12px; font-size: 16px; line-height: 1.5; }
.sw-ticks li:last-child { margin-bottom: 0; }
.sw-ticks li::before { content: ""; position: absolute; left: 4px; top: 4px; width: 7px; height: 13px;
                       border: solid var(--ui-amber); border-width: 0 3px 3px 0; transform: rotate(45deg); }
body.theme-light .sw-ticks li::before { border-color: var(--ui-navy); }
.sw-card.has-result .sw-ticks { display: none; }

/* Result: replaces the three points, in UI's order. */
#result { display: none; margin-top: 20px; }
#result.on { display: block; }
.r-addr { font-family: var(--ui-font-heading); font-size: 1.25rem; line-height: 1.25; color: var(--ui-heading); margin: 0 0 8px; }
.r-desc { font-size: 16px; margin: 0; }
.r-src { font-size: 14px; color: var(--ui-text-muted); margin: 4px 0 0; }
.r-est { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ui-line); }
.r-est-label { font-size: 14px; color: var(--ui-text-muted); margin: 0 0 6px; }
.r-band { font-size: 16px; margin: 0 0 2px; }
.r-saving { font-family: var(--ui-font-heading); font-weight: 700; font-size: 2rem; line-height: 1.15; color: var(--ui-heading); margin: 0; }
.r-saving-cap { font-size: 14px; color: var(--ui-text-muted); margin: 2px 0 0; }
.r-none { font-size: 16px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--ui-line); }
.note { font-size: 16px; color: var(--ui-text-muted); margin: 12px 0 0; }
.load { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--ui-text-muted); }
.load .ui-spinner { margin: 0; width: 20px; height: 20px; }
.cta { width: 100%; min-height: 48px; font-size: 16px; }
.acct { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 4px;
        font-size: 15px; color: var(--ui-link); text-decoration: underline; text-underline-offset: 2px; }
.review-card { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--ui-line); }
.contact-link { display: flex; align-items: center; min-height: 44px; color: var(--ui-link); font-weight: 600; }

/* Map layers: a button at the top right that opens a small panel of 44 px rows. */
.sw-mapbtn { position: fixed; z-index: 15; top: calc(var(--sw-head) + var(--sw-gap)); right: var(--sw-gap);
             min-height: 44px; padding: 0 16px; font: inherit; font-size: 15px; font-weight: 600;
             color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-line-strong);
             border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow); cursor: pointer; }
.sw-mapbtn[hidden], .sw-layers[hidden] { display: none; }
.sw-mapbtn:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.sw-layers { position: fixed; z-index: 16; top: calc(var(--sw-head) + var(--sw-gap) + 52px); right: var(--sw-gap);
             width: 300px; max-width: calc(100vw - 2 * var(--sw-gap)); padding: 8px 16px 12px;
             background: var(--ui-surface); color: var(--ui-text); border: 1px solid var(--ui-line);
             border-radius: 12px; box-shadow: var(--ui-shadow-lg); }
.lrow { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.lrow label { display: flex; align-items: center; gap: 12px; flex: 1; min-height: 44px; cursor: pointer; }
.lrow input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--ui-navy); cursor: pointer; }
.lsw { width: 16px; height: 16px; border-radius: 3px; flex: none; border: 1px solid var(--ui-line-strong); }
.lname { font-size: 15px; flex: 1; line-height: 1.3; }
.lscope { display: block; font-size: 14px; color: var(--ui-text-muted); }
.lop { width: 72px; flex: none; accent-color: var(--ui-navy); }
.lhint { font-size: 14px; color: var(--ui-text-muted); margin: 6px 0 0; }

/* Sign-up: the Suite's three-step pattern (marketing-suite signup_reviewed.html,
   #signup-steps / legend#step-legend / [data-step] / .step-nav). */
#signup-panel h2 { font-family: var(--ui-font-heading); font-weight: 400; font-size: 1.5rem; color: var(--ui-heading); margin: 0 0 4px; }
#signup-steps { display: flex; gap: 8px; list-style: none; margin: 16px 0; padding: 0; }
#signup-steps li { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 0 0;
                   border-top: 4px solid var(--ui-line-strong); color: var(--ui-text-muted); font-size: 15px; overflow-wrap: anywhere; }
#signup-steps li span { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
                        border-radius: 50%; border: 2px solid var(--ui-line-strong); font-weight: 600; }
#signup-steps li.done, #signup-steps li[aria-current] { border-top-color: var(--ui-amber); color: var(--ui-text); }
#signup-steps li[aria-current] span, #signup-steps li.done span { border-color: var(--ui-amber); background: var(--ui-amber); color: var(--ui-on-amber); }
body.theme-light #signup-steps li.done, body.theme-light #signup-steps li[aria-current] { border-top-color: var(--ui-navy); }
body.theme-light #signup-steps li[aria-current] span, body.theme-light #signup-steps li.done span { border-color: var(--ui-navy); background: var(--ui-navy); color: #ffffff; }
.sf fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.sf legend { font-size: 16px; font-weight: 600; padding: 0; margin: 0 0 12px; }
.sf [data-step] { display: flex; flex-direction: column; gap: 14px; }
.sf [data-step][hidden] { display: none; }
.sf .f { display: flex; flex-direction: column; gap: 6px; font-size: 15px; font-weight: 600; }
.sf .f input { width: 100%; min-height: 48px; padding: 0 12px; font: inherit; font-size: 16px; font-weight: 400;
               color: var(--ui-field-text); background: var(--ui-field-bg); border: 1px solid var(--ui-field-line); border-radius: var(--ui-radius-sm); }
.sf .f input[type=file] { padding: 10px 0; background: transparent; color: var(--ui-text); border: 0; }
.sf input:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 2px; }
.sf .check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 1.45; min-height: 44px; cursor: pointer; }
.sf .check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--ui-navy); }
.sf .props { list-style: none; margin: 0; padding: 0; }
.sf .props li { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 16px;
                padding: 4px 0; border-bottom: 1px solid var(--ui-line); }
.sf .linkbtn, .sf .props button { background: none; border: 0; color: var(--ui-link); cursor: pointer; font: inherit;
                                  font-size: 15px; font-weight: 600; min-height: 44px; padding: 0 4px; text-decoration: underline; }
.sf .addlist [role=option] { min-height: 44px; padding: 11px 12px; font-size: 16px; cursor: pointer; border-bottom: 1px solid var(--ui-line); }
.sf .addlist [role=option]:hover { background: var(--ui-surface-2); }
.sf details { font-size: 15px; line-height: 1.5; color: var(--ui-text-muted); }
.sf details summary { cursor: pointer; color: var(--ui-link); min-height: 44px; display: flex; align-items: center; }
.sf .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sf .err { font-size: 15px; color: var(--ui-error-text); }
.sf .err:empty { display: none; }
.step-nav { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 4px; }
.step-nav .ui-btn { min-height: 48px; font-size: 16px; flex: 1 1 auto; }
.step-nav .ui-btn[hidden] { display: none; }
.sw-card.signing .sw-ticks, .sw-card.signing #result > :not(#signup-panel):not(.review-card) { display: none; }

/* MapLibre controls: 44 px targets. */
.maplibregl-ctrl-group button { width: 44px; height: 44px; }

@media (prefers-reduced-motion: reduce) { .sw-card { transition: none !important; } }

/* ---- Phone and tablet (under 1024 px) ----------------------------------------- */
@media (max-width: 1023.98px) {
  :root { --sw-head: 56px; --sw-gap: 12px; }
  .sw-top { padding: 0 16px; }
  .sw-brand img { width: 104px; }
  .sw-signin { min-height: 44px; padding: 0 16px; }

  /* Search pinned under the header, over the map. */
  #searchbar { position: fixed; z-index: 25; top: calc(var(--sw-head) + 12px); left: 12px; right: 12px; }
  #searchbar input { box-shadow: var(--ui-shadow-lg); }
  .sw-mapbtn { top: calc(var(--sw-head) + 12px + 48px + 12px); right: 12px; }
  .sw-layers { top: calc(var(--sw-head) + 12px + 48px + 12px + 52px); right: 12px; }

  /* The card becomes a bottom sheet. peek: one line or the result, under a third of
     the screen (so 60% or more stays map); full: drags up to just under the search. */
  .sw-card { top: auto; left: 0; right: 0; bottom: 0; width: auto; border-radius: 12px 12px 0 0;
             border-bottom: 0; max-height: none; height: var(--sw-sheet-h);
             transition: height 0.22s var(--ui-ease); }
  .sw-card[data-state=peek] { --sw-sheet-h: 112px; }
  .sw-card.has-result[data-state=peek], .sw-card.signing[data-state=peek] { --sw-sheet-h: 40dvh; }
  .sw-card[data-state=full] { --sw-sheet-h: calc(100dvh - var(--sw-head) - 72px); }
  .sw-card.dragging { transition: none; }
  .sheet-handle { display: flex; justify-content: center; align-items: center; flex: none; width: 100%; height: 28px;
                  min-height: 28px; padding: 0; background: none; border: 0; cursor: grab; touch-action: none; }
  .sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--ui-line-strong); }
  .sw-body { padding: 0 16px 16px; }
  .sw-h1 { font-size: 1.375rem; margin: 2px 0 12px; }
  .sw-card.has-result .sw-h1 { display: none; }
  .sw-ticks { margin-top: 0; }
  #result { margin-top: 0; }
  .sw-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--ui-line); }
  .acct { margin-top: 0; }
  /* Zoom controls stay clear of the sheet. */
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--sw-sheet-px, 112px) + 8px); }
  #signup-steps li { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 14px; }
}
