/* Living Quayside controls and static fallbacks. Scene animation stays on canvas. */
.tyne-ambient-scene[data-state="ready"] { opacity: 1; }

.scene-mode-switcher {
  width: 456px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  padding: 8px;
  border-radius: 19px;
}

.scene-controls-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  padding: 0 5px 3px;
  color: var(--ink-2);
  font: 500 9px/1.3 var(--sans);
  letter-spacing: .025em;
}

.scene-uk-clock {
  font: 500 10px/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: auto;
}

.scene-sky-style { display: inline-flex; gap: 1px; padding: 1px; border: 1px solid rgb(91 125 128 / .24); border-radius: 6px; }
.scene-sky-style button { appearance: none; border: 0; border-radius: 4px; padding: 0 5px; height: 18px; background: transparent; color: inherit; font: 500 8px/1 var(--sans); white-space: nowrap; cursor: pointer; }
.scene-sky-style button[aria-pressed="true"] { background: rgb(121 161 160 / .24); color: var(--ink); }
.scene-sky-style button:hover { background: rgb(121 161 160 / .16); }
.scene-sky-style button:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

.scene-view-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 88px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid rgb(91 125 128 / .28);
  border-radius: 7px;
  background: rgb(145 174 172 / .1);
  color: inherit;
  font: 500 9px/1 var(--sans);
  cursor: pointer;
  touch-action: manipulation;
}
.scene-view-toggle svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; }
.scene-view-toggle:hover { background: rgb(145 174 172 / .24); }
.scene-view-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.scene-time-presets {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
}
.scene-time-preset {
  appearance: none;
  flex: 1 1 auto;
  height: 24px;
  min-width: 0;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: 500 9px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.scene-time-preset:hover { background: rgb(121 161 160 / .16); }
.scene-time-preset[aria-pressed="true"] { background: rgb(121 161 160 / .25); box-shadow: inset 0 0 0 1px rgb(121 161 160 / .22); color: var(--ink); }
.scene-time-preset:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

.scene-mode-choice {
  height: 28px;
  gap: 0;
  padding: 0 3px;
  font: 500 9px/1 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  touch-action: manipulation;
}

.scene-mode-choice[data-scene-mode-choice="white"] { grid-column: span 2; }
.scene-mode-choice__icon { display: none; }

html[data-scene-selection="auto"] .scene-mode-choice[data-scene-mode-choice="auto"]::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-right: 4px;
  border-radius: 50%;
  background: currentColor;
}

.scene-time-controls {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 3px 5px 0;
  padding-top: 3px;
  border-top: 1px solid rgb(91 125 128 / .22);
  color: var(--ink-2);
}

.scene-time-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font: 500 9px/1.3 var(--sans);
}

.scene-time-readout {
  margin-left: auto;
  font: 400 9px/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.scene-time-live {
  appearance: none;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgb(91 125 128 / .35);
  border-radius: 7px;
  background: rgb(255 255 255 / .18);
  color: inherit;
  font: 500 9px/1 var(--sans);
  cursor: pointer;
}
.scene-time-live:disabled { opacity: .65; cursor: default; }
.scene-time-live:not(:disabled):hover { background: rgb(121 161 160 / .18); }
html[data-scene-time-mode="preview"] .scene-time-live { border-color: currentColor; }
.scene-time-live:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.scene-time-slider {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  height: 19px;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: ew-resize;
  touch-action: pan-y;
}
.scene-time-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #233344, #7d849e 23%, #dfb690 30%, #e4ce92 50%, #deaf84 74%, #6c7693 83%, #233344);
  box-shadow: inset 0 0 0 1px rgb(30 56 64 / .12);
}
.scene-time-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #233344, #7d849e 23%, #dfb690 30%, #e4ce92 50%, #deaf84 74%, #6c7693 83%, #233344);
}
.scene-time-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border: 2px solid #f2f6f4;
  border-radius: 50%;
  background: #176b65;
  box-shadow: 0 1px 4px rgb(0 25 32 / .32);
}
.scene-time-slider::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 2px solid #f2f6f4;
  border-radius: 50%;
  background: #176b65;
  box-shadow: 0 1px 4px rgb(0 25 32 / .32);
}
.scene-time-slider:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; border-radius: 4px; }
.scene-time-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-dim);
  font: 400 8px/1.2 var(--mono);
  font-variant-numeric: tabular-nums;
}

.scene-weather-info {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 4px 5px 0;
  padding: 0 0 1px;
  color: var(--ink-2);
}

.scene-weather-status {
  min-height: 14px;
  font: 400 10px/1.4 var(--sans);
  letter-spacing: .005em;
  overflow-wrap: anywhere;
}

.scene-weather-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 15px;
  font: 400 9px/1.3 var(--sans);
  color: var(--ink-dim);
}

.scene-weather-attribution { min-width: 0; }
html:not([data-scene-selection="auto"]) .scene-weather-meta { display: none; }
.scene-weather-meta a { color: inherit; text-decoration: none; }
.scene-weather-meta a:hover { text-decoration: underline; text-underline-offset: 2px; }
.scene-weather-meta a:focus-visible,
.scene-weather-retry:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.scene-weather-retry {
  appearance: none;
  flex: 0 0 auto;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid rgb(91 125 128 / .3);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: 500 9px/1.4 var(--sans);
  cursor: pointer;
}
.scene-weather-retry:hover { background: rgb(121 161 160 / .14); }
.scene-weather-retry[hidden] { display: none; }

/* Keep the page and every draft in place while enjoying the full scene. */
html[data-scene-view="immersive"] { overflow: hidden; }
html[data-scene-view="immersive"] body { overflow: hidden; height: 100dvh; }
html[data-scene-view="immersive"] :is(.page, .mobile-topbar, .mobile-bottom-nav) { visibility: hidden; pointer-events: none; }
html[data-scene-view="immersive"] .scene-mode-switcher { position: fixed; }
html[data-scene-view="immersive"] .scene-view-toggle { background: rgb(145 174 172 / .24); }

@media (min-width: 761px) {
  .tyne-ambient-scene {
    inset: 0;
    width: 100%;
    height: 100dvh;
    /* The shader compensates this viewport fit, preserving source proportions. */
    object-fit: fill;
    object-position: center;
  }
}

/* Scene-aware contrast: gloomy weather and dusk share the transparent night UI. */
html[data-scene-tone="light"] { color-scheme: light; }
html[data-scene-tone="light"][data-scene-mode] body { background-color: #edf5f1; }
html[data-scene-tone="dark"] .scene-time-controls { border-color: rgb(190 219 228 / .18); }
html[data-scene-tone="dark"] .scene-time-live { background: rgb(25 58 66 / .5); }

@media (min-width: 761px) {
  /* Let the reading shade dissolve into the river before the footer. */
  html[data-scene-tone="dark"] .hero::after {
    -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  }
}

@media (min-width: 1101px) and (max-height: 900px) {
  /* The full bridge now passes behind the lower paragraph on shorter windows. */
  html[data-scene-tone="light"] .hero::after {
    display: block;
    background: radial-gradient(ellipse 380px 140px at calc(50% - 214px) 60%, rgb(240 248 248 / .68), transparent 100%);
  }
  html[data-scene-tone="light"] .hero .lede { text-shadow: 0 1px 2px rgb(249 252 251 / .42); }
}

/* The photo underneath the canvas is also the reduced-motion / mobile scene. */
@media (min-width: 761px) {
  /* Sunrise's blue upper sky needs contrast behind the existing business copy.
     This belongs to the hidden page UI, never to the shared scene canvas. */
  html[data-scene-mode="sunrise"][data-scene-tone="light"] .hero::after {
    display: block;
    background: radial-gradient(ellipse 380px 330px at calc(50% - 255px) 50%, rgb(241 239 239 / .64), transparent 100%);
  }
  html[data-scene-mode="sunrise"][data-scene-tone="light"] .tyne-hero-logo img {
    filter: drop-shadow(0 0 18px rgb(244 235 235 / .72));
  }
}

html[data-scene-selection="white"][data-scene-mode="day"] :is(body, .hero)::before {
  filter: saturate(.42) contrast(.88) brightness(1.24);
}
html:is([data-scene-mode="mist"], [data-scene-mode="snow"]) body { background: #354750; }
html:is([data-scene-mode="mist"], [data-scene-mode="snow"]) body::before {
  background-image: url("tyne-quayside-day-v3.png");
  opacity: .94;
}
html[data-scene-mode="mist"] body::before { filter: saturate(.7) contrast(.84) brightness(1.1); }
html[data-scene-mode="snow"] body::before { filter: saturate(.62) contrast(.96) brightness(1.12); }
html[data-scene-mode="blue-hour"] body { background: #162b43; }
html[data-scene-mode="blue-hour"] body::before {
  background-image: url("tyne-quayside-night-v3.png");
  opacity: .94;
  filter: brightness(1.24) saturate(.82);
}

@media (max-width: 760px), (prefers-reduced-motion: reduce) {
  html[data-scene-weather-condition="mist"] body::after {
    display: block;
    background: linear-gradient(180deg, transparent 35%, rgb(188 204 207 / .1) 68%, transparent 90%);
  }
  html:is([data-scene-weather-condition="snow"], [data-scene-weather-condition="sleet"]) body::after {
    display: block;
    background-image:
      radial-gradient(circle at 34% 28%, rgb(239 247 250 / .42) 0 .7px, transparent 1.3px),
      radial-gradient(circle at 71% 62%, rgb(239 247 250 / .3) 0 .6px, transparent 1.2px);
    background-size: 251px 217px, 337px 303px;
    animation: none;
  }
  html[data-scene-weather-condition="rain"] body::after {
    display: block;
    background-image:
      linear-gradient(180deg, rgb(75 107 123 / .055), rgb(7 24 34 / .08)),
      repeating-linear-gradient(103deg, transparent 0 54px, rgb(217 237 245 / .13) 55px 55.6px, transparent 57px 113px),
      repeating-linear-gradient(103deg, transparent 0 98px, rgb(217 237 245 / .09) 99px 99.6px, transparent 101px 183px);
    background-size: auto, 280px 430px, 360px 570px;
    animation: tyne-rain-fall 1.45s linear infinite;
  }
  html[data-scene-weather-condition="rain"][data-scene-weather-intensity="heavy"] body::after {
    background-size: auto, 180px 400px, 230px 520px;
    animation-duration: .9s;
  }
}

@media (min-width: 761px) and (max-width: 1368px) {
  .scene-mode-switcher { width: 438px; }
  .scene-mode-choice { font-size: 8px; }
}

@media (min-width: 1369px) {
  .scene-mode-choice { gap: 3px; }
  .scene-mode-choice__icon { display: grid; width: 12px; height: 12px; }
  .scene-mode-choice__icon svg { width: 12px; height: 12px; }
}

/* Keep every control available above the chat on shorter desktop windows. */
@media (min-width: 1101px) and (max-height: 960px) {
  .scene-mode-switcher { top: max(8px, env(safe-area-inset-top)); padding: 5px; gap: 1px; }
  .scene-controls-heading { min-height: 14px; padding-bottom: 1px; }
  .scene-uk-clock { font-size: 9px; }
  .scene-view-toggle { height: 18px; }
  .scene-sky-style { padding: 0; }
  .scene-sky-style button { height: 16px; }
  .scene-mode-choice { height: 24px; }
  .scene-time-controls { margin-top: 1px; padding-top: 2px; }
  .scene-time-label-row { min-height: 18px; gap: 5px; }
  .scene-time-preset { height: 18px; padding: 0 4px; }
  .scene-time-live { height: 18px; }
  .scene-time-slider { height: 14px; }
  .scene-time-scale { display: none; }
  .scene-weather-info { display: flex; align-items: center; gap: 8px; margin-top: 2px; padding-bottom: 0; }
  .scene-weather-status { flex: 1 1 auto; min-width: 0; min-height: 12px; font-size: 9px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .scene-weather-meta { flex: 0 0 auto; min-height: 12px; font-size: 8px; line-height: 1.25; }
  .scene-weather-retry { min-height: 16px; padding: 0 5px; font-size: 8px; }
}

/* Reserve the tablet heading area so a taller weather panel cannot cover it. */
@media (min-width: 761px) and (max-width: 1100px) {
  .scene-mode-switcher { position: absolute; }
  .hero { padding-top: 236px; }
  .tyne-hero-logo {
    top: 30px;
    left: 24px;
    transform: none;
    width: calc(100% - 480px);
    justify-content: flex-start;
  }
  .tyne-hero-logo img { max-width: 100%; }
}

@media (max-width: 760px) {
  .mobile-topbar {
    height: calc(396px + env(safe-area-inset-top));
    padding: calc(20px + env(safe-area-inset-top)) 24px 300px;
  }
  .scene-mode-switcher {
    position: absolute;
    top: calc(98px + env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left));
    right: max(20px, env(safe-area-inset-right));
    width: auto;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 7px;
    border-radius: 17px;
  }
  .scene-mode-choice {
    height: 32px;
    gap: 0;
    padding: 0 2px;
    letter-spacing: 0;
  }
  .scene-mode-choice__label::after { font-size: 9px; }
  .scene-controls-heading { flex-wrap: wrap; gap: 4px 6px; padding-inline: 2px; }
  .scene-sky-style { flex-basis: 100%; order: 2; }
  .scene-sky-style button { flex: 1; height: 24px; font-size: 9px; }
  .scene-view-toggle { min-width: 82px; padding-inline: 5px; height: 28px; }
  .scene-time-label-row { flex-wrap: wrap; gap: 2px 8px; }
  .scene-time-presets { flex-basis: 100%; order: 2; }
  .scene-time-preset { height: 32px; padding-inline: 4px; }
  .scene-time-readout { margin-left: 0; margin-right: auto; }
  .scene-time-live { height: 28px; min-width: 44px; }
  .scene-time-slider { height: 26px; }
  .scene-time-slider::-webkit-slider-thumb { width: 15px; height: 15px; margin-top: -5.5px; }
  .scene-time-slider::-moz-range-thumb { width: 12px; height: 12px; }
  .scene-weather-info { margin: 4px 5px 0; }
  .scene-weather-status { font-size: 10px; }
  .scene-weather-meta { min-height: 17px; }
  .scene-weather-retry { min-height: 26px; }
  html[data-scene-view="immersive"] .scene-mode-switcher { top: max(12px, env(safe-area-inset-top)); }

  html:is([data-scene-mode="mist"], [data-scene-mode="snow"]) body::before,
  html:is([data-scene-mode="mist"], [data-scene-mode="snow"]) .hero::before {
    background-image: url("tyne-quayside-day-v3.png");
    background-position: calc(50% - 70px) 350px;
    opacity: .42;
    filter: saturate(.7) contrast(.9) brightness(1.12);
  }
  html[data-scene-mode="mist"] .hero::before { filter: saturate(.65) contrast(.8) brightness(1.16); }
  html[data-scene-mode="blue-hour"] body::before,
  html[data-scene-mode="blue-hour"] .hero::before {
    background-image: url("tyne-quayside-night-v3.png");
    background-position: calc(50% - 70px) 350px;
    opacity: .48;
    filter: brightness(1.24) saturate(.82);
  }
}

@media (max-width: 360px) {
  .hero h1 { font-size: clamp(42px, 13.1vw, 47px); }
  .scene-mode-switcher { left: 12px; right: 12px; }
  .scene-mode-choice__label::after { font-size: 8px; }
  .scene-weather-status { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-mode-choice,
  .scene-mode-switcher { transition: none; }
  html body::after { animation: none !important; }
}

/* Static/mobile fallbacks keep the same complete, bottom-aligned photograph.
   They do not add the previous horizontal zoom or the duplicate hero crop. */
:root { --scene-fallback-sky: #b7cadd; }
html[data-scene-mode="sunrise"] { --scene-fallback-sky: #ceb5b8; }
html[data-scene-mode="sunset"] { --scene-fallback-sky: #3f3b50; }
html[data-scene-mode="night"] { --scene-fallback-sky: #091325; }
html[data-scene-mode="blue-hour"] { --scene-fallback-sky: #172c47; }
html:is([data-scene-mode="overcast"], [data-scene-mode="light-rain"], [data-scene-mode="heavy-rain"]) { --scene-fallback-sky: #a4b6c8; }
html:is([data-scene-mode="mist"], [data-scene-mode="snow"]) { --scene-fallback-sky: #b1c0cc; }
html[data-scene-mode] body::before {
  inset: 0;
  background-size: 100% auto;
  background-position: center bottom;
  background-color: var(--scene-fallback-sky);
  opacity: 1;
}
@media (max-width: 760px) {
  html[data-scene-mode] .hero::before { background-image: none; }
}

/* Keep the Quayside architecture below the reading area on 1080p desktop
   viewports. More compact layouts already create document clearance for it. */
@media (min-width: 761px) and (min-height: 961px) and (max-height: 1080px) {
  html[data-scene-layout="viewport"]:not([data-scene-view="immersive"]) .tyne-ambient-scene {
    transform: translateY(100px);
  }

  html[data-scene-layout="viewport"]:not([data-scene-view="immersive"])[data-scene-mode] body::before {
    background-position: center calc(100% + 100px);
  }
}
