/* DV54 SKYGLASS · AURA weather · stage 3 of 6 adds the WebGL canvas (html.gl) over the sky photo.
   The glass is drawn in WebGL (js/glass.js); this file lays out the DOM that sits on it
   (all text) and the CSS frosted fallback used when WebGL2 is missing. Theme is fixed: never reads the OS scheme. */
:root {
  color-scheme: only light;
  --ink: #fffaf2;
  --ink-2: rgba(255, 250, 242, .84);
  --ink-3: rgba(255, 250, 242, .66);
  --sun: #fbd25b;
  --gold: #f3c472;
  --shadow-t: 0 1px 2px rgba(48, 28, 12, .45), 0 0 10px rgba(48, 28, 12, .3);
  --ui: 'Montserrat', system-ui, sans-serif;
  --serif: 'Playfair Display', 'Didot', 'Bodoni 72', Georgia, serif;
  --w-r: 26px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: #8a6a52; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100svh; font-family: var(--ui); color: var(--ink); overflow-x: hidden;
  display: grid; grid-template-rows: auto 1fr auto;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 16px; top: -70px; min-height: 44px; z-index: 20; padding: 12px 16px; border-radius: 12px; background: #fffaf2; color: #3b2a1c; font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid #fff6dc; outline-offset: 3px; }

/* sky + glass canvas, fixed behind everything */
#gl, .sky-fallback { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { z-index: 0; opacity: 0; transition: opacity .5s ease; }
.sky-fallback { z-index: 0; object-fit: cover; object-position: 50% 50%; }
@media (max-aspect-ratio: 9/10) { .sky-fallback { object-position: 23% 50%; } }
html.gl #gl { opacity: 1; }
html.gl .sky-fallback { visibility: hidden; transition: visibility 0s .6s; }

/* ---------- header ---------- */
.top {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 3vw, 36px) 0;
}
.brand { min-width: 44px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: 44px; text-shadow: var(--shadow-t); }
.brand .mark { width: 40px; height: 40px; filter: drop-shadow(0 2px 6px rgba(70, 40, 10, .25)); }
.brand .word { font-size: 13px; letter-spacing: .2em; font-weight: 500; }
.brand .word b { font-weight: 700; }
.tools { display: flex; align-items: center; gap: 8px; }
.unit {
  height: 44px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .42);
  background: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .1));
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 6px 22px rgba(60, 36, 16, .16);
}
.unit { display: inline-flex; padding: 0 1px; height: auto; }
.unit button { min-width: 46px; height: 44px; border: 0; border-radius: 22px; background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; text-shadow: var(--shadow-t); position: relative; z-index: 0; }
.unit button::before { content: ''; position: absolute; inset: 4px 2px; border-radius: 18px; z-index: -1; transition: background .25s, box-shadow .25s; }
.unit button[aria-pressed="true"] { color: #5a3e26; text-shadow: none; }
.unit button[aria-pressed="true"]::before { background: rgba(255, 255, 255, .8); box-shadow: 0 2px 8px rgba(60, 36, 16, .18); }

/* ---------- stage + widget ---------- */
.stage { position: relative; z-index: 1; display: grid; place-items: center; padding: 18px clamp(16px, 3vw, 36px); min-width: 0; }
.widget {
  position: relative; width: min(1100px, 62vw); min-height: clamp(400px, calc(100svh - 270px), 760px);
  border-radius: var(--w-r); padding: 34px 40px 30px;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "city icon" "cond icon" "temp temp" "strip strip";
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: default;
}
.city { grid-area: city; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: .16em; text-shadow: var(--shadow-t); }
.city time { font-weight: 500; letter-spacing: .08em; margin-left: .45em; font-variant-numeric: tabular-nums; }
.cond { grid-area: cond; margin: 6px 0 0; font-size: 16px; font-weight: 600; color: rgba(255, 250, 242, .92); text-shadow: var(--shadow-t); transition: opacity .35s ease, transform .35s var(--ease); }
.cond.swap { opacity: 0; transform: translateY(4px); }
.w-icon { grid-area: icon; width: 74px; height: 74px; position: relative; margin: -8px -10px 0 0; filter: drop-shadow(0 6px 14px rgba(40, 30, 40, .22)); }
.w-icon .wx { will-change: transform, opacity; position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .45s ease, transform .6s var(--ease); }
.w-icon .wx.out { opacity: 0; transform: scale(.7) translateY(6px); }
.temp {
  grid-area: temp; align-self: center; justify-self: center; display: flex; align-items: flex-start;
  font-family: var(--serif); font-weight: 400; font-size: clamp(120px, min(15.5vw, 30svh), 290px); line-height: 1; letter-spacing: -.01em; font-variant-numeric: lining-nums;
  text-shadow: 0 2px 4px rgba(58, 36, 18, .22), 0 6px 22px rgba(58, 36, 18, .24); padding-bottom: .04em;
}
.digits { display: inline-flex; height: 1.25em; overflow: hidden; margin: -.125em 0; }
.dcol { display: inline-block; height: 1.25em; overflow: hidden; transition: width .7s var(--ease); }
.reel { display: flex; flex-direction: column; transition: transform .9s var(--ease); will-change: transform; }
.reel span { display: block; height: 1.25em; line-height: 1.25em; text-align: center; }
.deg { font-size: .3em; line-height: 1; margin: .3em 0 0 .05em; }
.widget.fogged { --shadow-t: 0 1px 2px rgba(48, 28, 12, .55), 0 0 12px rgba(48, 28, 12, .42); }
.widget.fogged .temp { text-shadow: 0 2px 6px rgba(58, 36, 18, .32), 0 6px 26px rgba(58, 36, 18, .36); }

/* hourly strip: an inset pane drawn by the shader; DOM cells on top */
.strip { grid-area: strip; position: relative; margin-top: 14px; border-radius: 20px; touch-action: pan-x; }
.hours { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 10px 10px; outline: none; }
.hour {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; padding: 10px 4px 10px;
  min-height: 44px; border: 0; border-radius: 16px; background: transparent; cursor: pointer; text-shadow: var(--shadow-t);
  transition: background .25s ease;
}
.hour:hover { background: rgba(255, 255, 255, .07); }
.hour:focus-visible { outline-offset: -2px; }
.hour .h-t { font-size: 13px; font-weight: 600; letter-spacing: .03em; color: var(--ink-2); }
.hour[aria-checked="true"] .h-t { color: var(--ink); }
.hour .wx { width: 46px; height: 46px; filter: drop-shadow(0 3px 5px rgba(40, 30, 40, .22)); transition: transform .5s var(--ease); will-change: transform; }
.hour:hover .wx { transform: translateY(-2px) scale(1.04); }
.hour .more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease); width: 100%; }
.hour .more > div { overflow: hidden; display: grid; justify-items: center; gap: 4px; min-height: 0; }
.widget.expanded .hour .more { grid-template-rows: 1fr; }
.hour .h-temp { font-variant-numeric: lining-nums; font-family: var(--serif); font-size: 26px; line-height: 1.1; margin-top: 2px; }
.hour .h-word { font-size: 11px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.hour .pp { width: 70%; max-width: 64px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .18); box-shadow: inset 0 1px 1px rgba(40, 30, 30, .25); overflow: hidden; margin-top: 4px; }
.hour .pp i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #a9dcff, #4f9cf5); box-shadow: 0 0 8px rgba(120, 190, 255, .7); transform-origin: left; transform: scaleX(var(--p)); transition: transform .8s var(--ease) .1s; }
.hour .h-pp { font-size: 10px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 2px; }
.widget:not(.expanded) .hour .pp i { transform: scaleX(0); }
.handle {
  position: absolute; left: 50%; bottom: -27px; transform: translateX(-50%); width: 64px; height: 44px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center;
}
.handle svg { width: 36px; height: 20px; padding: 0 8px; border-radius: 10px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  background: rgba(255, 255, 255, .2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 2px 10px rgba(50, 30, 20, .2); transition: transform .5s var(--ease), background .25s; }
.handle:hover svg { background: rgba(255, 255, 255, .34); }
.handle[aria-expanded="true"] svg { transform: rotate(180deg); }

/* ---------- foot ---------- */
.foot { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 3vw, 36px) max(16px, env(safe-area-inset-bottom)); font-size: 11px; letter-spacing: .06em; color: var(--ink-3); text-shadow: var(--shadow-t); }

/* ---------- icon motion ---------- */
@keyframes fall { 0% { transform: translateY(-3px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(6px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.w-icon .drops path { animation: fall 1.4s linear infinite; }
.w-icon .drops path:nth-child(2) { animation-delay: .45s; }
.w-icon .drops path:nth-child(3) { animation-delay: .9s; }
.w-icon .rays { transform-origin: 32px 32px; animation: spin 40s linear infinite; }

/* ---------- no WebGL2 (and the first paint before it is ready): CSS frosted glass ---------- */
html:not(.gl) .widget {
  background: linear-gradient(180deg, rgba(255, 246, 234, .26), rgba(255, 240, 225, .14));
  -webkit-backdrop-filter: blur(22px) saturate(1.15); backdrop-filter: blur(22px) saturate(1.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 0 0 1px rgba(255, 255, 255, .35), 0 24px 60px rgba(50, 30, 15, .25);
}
html:not(.gl) .strip { background: rgba(80, 50, 40, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
html:not(.gl) .hour[aria-checked="true"] { background: rgba(255, 255, 255, .2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
html.no-gl .widget.fogged { background: rgba(250, 245, 240, .55); }

/* ---------- tablet ---------- */
@media (max-width: 1000px) {
  .widget { width: min(720px, 100%); }
}
@media (min-width: 621px) and (orientation: portrait) {
  .widget { width: min(760px, 88vw); min-height: min(64svh, 860px); }
  .temp { font-size: clamp(150px, 26vw, 260px); }
}
/* ---------- phone, portrait ---------- */
@media (max-width: 620px) {
  .top { padding-top: max(12px, env(safe-area-inset-top)); }
  .brand .word { display: none; }
  .stage { padding: 12px 16px 10px; }
  .widget {
    width: 100%; min-height: calc(100svh - 128px); padding: 24px 18px 22px; --w-r: 30px;
    grid-template-rows: auto auto 1fr auto .55fr auto;
    grid-template-areas: "city icon" "city icon" "temp temp" "cond cond" ". ." "strip strip";
  }
  .city { font-size: 13px; line-height: 1.5; }
  .city time { display: block; margin: 0; }
  .cond { text-align: center; font-size: 16px; margin: 2px 0 18px; }
  .temp { align-self: end; }
  .w-icon { width: 60px; height: 60px; margin: -6px -4px 0 0; }
  .temp { font-size: clamp(96px, 30vw, 150px); }
  .strip { margin: 0 -4px; }
  .hours { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 8px) / 3); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 8px 4px; overscroll-behavior-x: contain; }
  .hours::-webkit-scrollbar { display: none; }
  .hour { scroll-snap-align: start; }
  .foot { justify-content: center; font-size: 10px; }
  .foot span:first-child { display: none; }
}
@media (max-width: 380px) {
  .tools { gap: 6px; }
  .unit button { min-width: 44px; }
}
/* ---------- short screens (phone landscape) ---------- */
@media (max-height: 520px) {
  body { min-height: auto; }
  .top { padding-top: 10px; }
  .stage { padding: 8px 16px; }
  .widget {
    width: min(760px, 100%); min-height: 0; padding: 16px 24px 18px;
    grid-template-columns: auto 1fr auto; grid-template-rows: auto auto auto;
    grid-template-areas: "city temp icon" "cond temp icon" "strip strip strip";
  }
  .city time { display: inline; margin-left: .45em; }
  .cond { text-align: left; margin: 6px 0 0; }
  .temp { font-size: 92px; justify-self: center; }
  .hours { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; padding: 4px; }
  .hour { padding: 6px 2px; }
  .hour .wx { width: 34px; height: 34px; }
  .foot { padding-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation: none !important; }
}
html.reduced *, html.reduced *::before, html.reduced *::after { transition-duration: 1ms !important; animation: none !important; }
