/* The glance: Meridian's pole clock with the weather (js/glance.js). The dial carries its own style
   inside its SVG (so it is whole as a texture); this file places it: a movable widget on Dew's
   desktop, a full page on a phone (dial on top, the rest below; side by side when the screen lies
   down), and a dial filling a round watch. Colours from css/tokens.css. */

.gl-root { --gl-gap: 12px; color: var(--text); font-family: var(--font); font-size: calc(14px * var(--ts, 1)); }
.gl-root[hidden] { display: none !important; }
.gl-dialbox { line-height: 0; }
.gl-dialbox svg { width: 100%; height: auto; display: block; overflow: visible; }
.gl-root button { font: inherit; color: inherit; }
.gl-dim { color: var(--muted); }
.gl-old { color: var(--warn); font-weight: 600; }
.gl-small { font-size: .86em; }
.gl-link { background: none; border: 0; padding: 4px 2px; color: var(--accent-text, var(--accent)); cursor: pointer; text-decoration: underline; }
.gl-root :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Dew's desktop: a widget you can drag; ✕ puts it away ---- */
.gl-widget { position: fixed; top: 68px; right: 16px; width: var(--gl-size, 230px); z-index: 13; touch-action: none; border-radius: 50%; }
.gl-widget .gl-dialbox { cursor: grab; filter: drop-shadow(0 6px 18px var(--shadow)); }
.gl-widget.gl-dragging .gl-dialbox { cursor: grabbing; }
/* a module card open on the Earth desktop (js/earth.js): the clock steps aside until it closes */
body.earth-card .gl-widget { visibility: hidden; pointer-events: none; }
/* on the Earth desktop it starts below Dew's corners and the Earth's top-right buttons (js/earth.js) */
body.earth-desk .gl-widget { top: calc(max(16px, var(--earth-clear, 16px)) + 52px); }
/* only the round face takes a press, not the square around it */
.gl-widget .gl-dialbox { border-radius: 50%; }
.gl-widget .gl-dial { clip-path: circle(50%); }
.gl-away {
  position: absolute; top: 2%; right: 2%; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--rim); background: var(--glass-strong); cursor: pointer;
  opacity: 0; transition: opacity var(--mo-fast, .14s);
}
.gl-widget:hover .gl-away, .gl-widget:focus-within .gl-away, .gl-away:focus-visible { opacity: 1; }
@media (hover: none) { .gl-away { opacity: .85; } }

/* the panel and the settings card: glass beside the widget (placed by glance.js) */
.gl-widget .gl-panel, .gl-card {
  position: fixed; width: min(380px, calc(100vw - 16px)); max-height: min(74vh, 640px); max-height: min(74dvh, 640px); overflow: auto;
  background: var(--glass-strong); border: 1px solid var(--rim); border-radius: var(--radius, 18px);
  box-shadow: 0 12px 36px var(--shadow), var(--sheen, none); padding: 14px 16px; box-sizing: border-box; z-index: 14;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); line-height: 1.4; touch-action: auto;
}
.gl-panel[hidden], .gl-card[hidden] { display: none; }

/* ---- the panel's contents ---- */
.gl-panel h3 { font-size: .8em; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.gl-alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; margin-bottom: 10px; background: rgba(255, 210, 63, .12); border: 1px solid rgba(255, 210, 63, .5); }
.gl-alert-orange { background: rgba(255, 138, 42, .14); border-color: rgba(255, 138, 42, .6); }
.gl-alert-red { background: rgba(255, 77, 77, .14); border-color: rgba(255, 77, 77, .65); }
.gl-alert a { color: var(--accent-text, var(--accent)); display: inline-block; margin-top: 4px; }
.gl-alert-tri { flex: none; width: 22px; height: 20px; margin-top: 1px; }
.gl-alert-tri path { fill: #FFD23F; stroke: #0B100E; stroke-width: 1; stroke-linejoin: round; }
.gl-alert-orange .gl-alert-tri path { fill: #FF8A2A; }
.gl-alert-red .gl-alert-tri path { fill: #FF4D4D; }
.gl-alert-tri text { fill: #0B100E; font-size: 11px; font-weight: 800; text-anchor: middle; }
.gl-nowrow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 6px 8px; margin: 0 -8px;
  background: none; border: 0; border-radius: 12px; cursor: pointer;
}
.gl-nowrow:hover { background: rgba(var(--tint, 255,255,255), .06); }
.gl-big { font-size: 2.2em; font-weight: 600; font-variant-numeric: tabular-nums; }
.gl-place-line { margin: 6px 0 2px; }
.gl-hours {
  list-style: none; margin: 0; padding: 0 0 4px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(46px, 1fr);
  overflow-x: auto; gap: 2px; scrollbar-width: thin;
}
.gl-hours li { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; font-variant-numeric: tabular-nums; }
.gl-hours li:first-child { background: rgba(var(--tint, 255,255,255), .06); }
.gl-h { font-size: .82em; color: var(--muted); }
.gl-t { font-weight: 600; }
.gl-mm { display: flex; align-items: flex-end; gap: 2px; font-size: .82em; color: #7FC4FF; min-height: 16px; }
.gl-mm svg { width: 6px; height: 14px; }
.gl-mm line, .gl-legend .r { stroke: #7FC4FF; stroke-width: 3; stroke-linecap: round; }
.gl-mm circle, .gl-legend .m { fill: none; stroke: #7FC4FF; stroke-width: 1.4; }
.gl-pop { font-size: .78em; color: var(--muted); min-height: 1.2em; }
.gl-noicon { height: 28px; line-height: 28px; color: var(--muted); }
.gl-legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82em; color: var(--muted); }
.gl-legend li { display: flex; align-items: center; gap: 5px; }
.gl-legend svg { width: 12px; height: 14px; flex: none; }
.gl-legend .d { fill: none; stroke: rgba(255, 196, 80, .9); stroke-width: 2.4; stroke-linecap: round; }
.gl-legend .e { fill: none; stroke: #2E9BFF; stroke-width: 4; }
html[data-theme="light"] .gl-mm { color: #1F6FD1; }
html[data-theme="light"] .gl-mm line, html[data-theme="light"] .gl-legend .r { stroke: #1F6FD1; }
html[data-theme="light"] .gl-mm circle, html[data-theme="light"] .gl-legend .m { stroke: #1F6FD1; }
.gl-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 18px; }
.gl-sun { display: grid; grid-template-columns: auto auto; gap: 2px 12px; justify-content: start; font-variant-numeric: tabular-nums; }
.gl-sun span { color: var(--muted); }
.gl-allday { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.gl-allday span { background: #2E9BFF; color: #fff; border-radius: 999px; padding: 1px 9px; font-size: .86em; font-weight: 600; }
.gl-next div { margin-bottom: 3px; }
.gl-add {
  display: block; width: 100%; margin: 4px 0; padding: 9px 12px; border-radius: 12px; cursor: pointer;
  background: rgba(var(--tint, 255,255,255), .06); border: 1px solid var(--line);
}
.gl-add:hover { background: rgba(var(--tint, 255,255,255), .1); }
.gl-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
/* DEW · MERIDIAN, both wordmarks, at a size that reads (moved here from the dial, 2026-10-14) */
.gl-brand { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--muted); }
.gl-brand .wordmark { height: calc(11px * var(--ts, 1)); width: auto; }
.gl-brand .wordmark:first-child { color: #6FD3FF; }
.gl-brand .wordmark .wm-hi { fill: #FFB020; }
html[data-theme="light"] .gl-brand .wordmark:first-child { color: #0C7FB0; }
html[data-theme="light"] .gl-brand .wordmark .wm-hi { fill: #C47F00; }
.gl-gear { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: none; cursor: pointer; font-size: 1.2em; }

/* ---- the settings card ---- */
.gl-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gl-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: none; cursor: pointer; }
.gl-set { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.gl-set > div:first-child { flex: 1 1 160px; }
.gl-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.gl-seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; min-height: 36px; }
.gl-seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent, #061020); font-weight: 600; }
.gl-switch { width: 48px; height: 28px; border-radius: 999px; border: 1px solid var(--rim); background: rgba(var(--tint, 255,255,255), .1); position: relative; cursor: pointer; flex: none; }
.gl-switch span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform var(--mo-fast, .14s); }
.gl-switch[aria-checked="true"] { background: var(--accent); }
.gl-switch[aria-checked="true"] span { transform: translateX(20px); background: var(--on-accent, #061020); }

/* ---- glance.html: the whole page ---- */
html.gl-page, html.gl-page body { margin: 0; min-height: 100%; background: var(--bg); }
.gl-page-root { box-sizing: border-box; min-height: 100vh; min-height: 100dvh; padding: max(8px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.gl-page-root .gl-dialbox { width: min(100%, 560px, 72vh); width: min(100%, 560px, 72dvh); margin: 0 auto; }
.gl-page-root .gl-panel { max-width: 560px; margin: 8px auto 0; }
.gl-page-root .gl-card {
  left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
}
/* lying down (a phone turned, or a computer): the dial at full height on the left, the rest beside it */
@media (orientation: landscape) and (min-width: 560px) {
  html:not([data-round]) .gl-page-root { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; height: 100vh; height: 100dvh; padding: 8px 16px; }
  html:not([data-round]) .gl-page-root .gl-dialbox { width: min(calc(100vh - 16px), 58vw); width: min(calc(100dvh - 16px), 58vw); margin: 0; position: sticky; top: 8px; }
  html:not([data-round]) .gl-page-root .gl-panel { margin: 0; max-width: 620px; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow: auto; padding-right: 4px; }
}

/* ---- a round watch: the dial fills the circle; the rest opens from the centre, inside the circle ---- */
html[data-round], html[data-round] body { height: 100%; overflow: hidden; }
html[data-round] .gl-page-root { padding: 0; height: 100vh; height: 100dvh; display: grid; place-items: center; }
html[data-round] .gl-page-root .gl-dialbox { width: 100vmin; height: 100vmin; }
html[data-round] .gl-page-root .gl-panel {
  /* the square inside the circle (71 % of it), so nothing sits in the cut-off corners */
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
  width: 70.7vmin; max-height: 70.7vmin; overflow: auto; box-sizing: border-box; padding: 10px 12px;
  background: var(--glass-strong); border: 1px solid var(--rim); border-radius: 16px; font-size: calc(12px * var(--ts, 1));
}
html[data-round] .gl-page-root .gl-card { width: 70.7vmin; max-height: 70.7vmin; font-size: calc(12px * var(--ts, 1)); }
html[data-round] .gl-cols { grid-template-columns: 1fr; }
/* on a watch the warning's long text waits behind "Read more" */
html[data-round] .gl-alert .gl-dim { display: none; }

/* ---- reduced motion: nothing slides or fades ---- */
@media (prefers-reduced-motion: reduce) { .gl-root *, .gl-root { transition: none !important; scroll-behavior: auto !important; } }
html[data-motion="reduce"] .gl-root, html[data-motion="reduce"] .gl-root * { transition: none !important; scroll-behavior: auto !important; }
.gl-datebtn { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 4px 0; margin: 0; cursor: pointer; text-align: left; min-height: 32px; border-bottom: 1px dotted var(--muted); }
.gl-datebtn:hover, .gl-datebtn:focus-visible { color: var(--accent, inherit); border-bottom-color: currentColor; }
