/* Kantel, a live sun study. An example brand made with MALA.
   Solid colours only: the sky is one colour at a time and the page's ink and glass follow
   it (app.js sets the variables as the sun moves). Glass is blur, tint, an inset highlight
   and a hairline edge. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/manrope-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --sky: #e9d3b8;
  --ink: #221d17;
  --ink-2: rgba(34, 29, 23, .66);
  --ink-3: rgba(34, 29, 23, .42);
  --glass: rgba(255, 251, 245, .58);
  --glass-strong: rgba(255, 251, 245, .82);
  --line: rgba(34, 29, 23, .12);
  --hi: rgba(255, 255, 255, .55);
  --press: rgba(34, 29, 23, .07);
  --sun: #f0a43a;
  --clay: #b4532f;
  --on-clay: #fff7ef;
  --night: #1b2340;
  --blue: #3c5596;
  --golden: #e9a35f;
  --day: #f4dcab;
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Songti SC", serif;
  --r: 22px;
  --gap: clamp(12px, 2vw, 20px);
  color-scheme: light;
}
:root.is-dark {
  --ink: #f4eee5;
  --ink-2: rgba(244, 238, 229, .72);
  --ink-3: rgba(244, 238, 229, .46);
  --glass: rgba(18, 23, 40, .5);
  --glass-strong: rgba(18, 23, 40, .78);
  --line: rgba(244, 238, 229, .16);
  --hi: rgba(255, 255, 255, .12);
  --press: rgba(244, 238, 229, .1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--sky);
  color: var(--ink);
  font: 500 15px/1.4 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color .6s ease, color .4s ease;
  font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ stage */
.stage { position: fixed; inset: 0; }
.stage canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.embed .stage canvas { touch-action: pan-y; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -50%);
  font: 600 11px/1 var(--sans); letter-spacing: .06em;
  color: var(--ink-2);
  white-space: nowrap;
  will-change: transform;
}
.label.is-compass { font-size: 12px; color: var(--ink); opacity: .7; }
.label.is-hour { font-weight: 500; letter-spacing: .02em; opacity: .85; }
.label.is-sun {
  font-size: 12px; letter-spacing: .02em; color: var(--ink);
  padding: 6px 9px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hi);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: opacity .2s ease;
}
.grab { cursor: grab; }
.grabbing, .grabbing * { cursor: grabbing !important; }

/* ------------------------------------------------------------------ overlay */
.ui {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "head panel" "space panel" "foot foot";
  gap: var(--gap);
  padding: max(var(--gap), env(safe-area-inset-top)) max(var(--gap), env(safe-area-inset-right)) max(var(--gap), env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
  pointer-events: none;
}
.ui > * { pointer-events: auto; }
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hi), 0 12px 32px rgba(20, 16, 10, .08);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-radius: var(--r);
  transition: background-color .5s ease, border-color .5s ease;
}

/* head: the brand, the clock and the place */
.head { grid-area: head; display: grid; gap: 10px; justify-items: start; align-content: start; pointer-events: none; }
.head > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--ink-2); }
.brand b { font: 400 22px/1 var(--serif); letter-spacing: .01em; color: var(--ink); }
.clock { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.clock-time { font: 400 clamp(52px, 8.4vw, 96px)/.9 var(--serif); letter-spacing: -.01em; }
.clock-period { font: 600 14px/1 var(--sans); letter-spacing: .08em; color: var(--ink-2); text-transform: uppercase; }
.when { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.date-line { font-size: 15px; color: var(--ink-2); }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 var(--hi);
  font-size: 14px; font-weight: 600;
  transition: background-color .2s ease, transform .15s ease;
  white-space: nowrap;
}
.pill:hover { background: var(--glass-strong); }
.pill:active { transform: scale(.97); }
.pill svg { flex: none; }
.place-chip { max-width: min(78vw, 420px); }
.place-chip span { overflow: hidden; text-overflow: ellipsis; }
.place-chip small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #3fa66a; box-shadow: 0 0 0 3px rgba(63, 166, 106, .22); }
.is-live .live-dot { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(63, 166, 106, .08); } }
.hint { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }

/* the day and right now */
.panel { grid-area: panel; width: 292px; align-self: start; padding: 18px; display: grid; gap: 16px; max-height: 100%; overflow: auto; scrollbar-width: none; }
.panel::-webkit-scrollbar { display: none; }
.panel h2 { margin: 0 0 4px; font: 600 13px/1 var(--sans); color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; }
.panel h2 span:last-child { font-weight: 500; }
.rows { display: grid; gap: 2px; margin: 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row dt { color: var(--ink-2); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.row dd { margin: 0; font-weight: 600; font-size: 14px; text-align: right; }
.big { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big div { display: grid; gap: 2px; }
.big dt { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.big dd { margin: 0; font: 400 34px/1 var(--serif); }
.big dd small { font: 600 13px/1 var(--sans); color: var(--ink-2); margin-left: 4px; }
.countdown { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--press); font-size: 14px; font-weight: 600; }
.countdown svg { color: var(--sun); flex: none; }

/* the parasol card */
.parasol { grid-area: space; align-self: end; justify-self: start; width: min(100%, 340px); max-height: 100%; overflow: auto; scrollbar-width: none; padding: 16px; display: grid; gap: 12px; }
.parasol::-webkit-scrollbar { display: none; }
.parasol-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.parasol-head b { font: 400 24px/1 var(--serif); }
.parasol-head .toggle-row { font-size: 13px; color: var(--ink-2); }
.parasol-opts { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.spec { margin: 0; font-size: 12px; line-height: 1.4; color: var(--ink-3); }
.meter { display: grid; gap: 8px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--ink-2); }
.meter-top strong { font: 400 30px/1 var(--serif); color: var(--ink); }
.meter-track { height: 6px; border-radius: 999px; background: var(--press); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.ctrl { display: grid; grid-template-columns: 52px minmax(0, 1fr) 42px; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.ctrl output { text-align: right; color: var(--ink); font-weight: 600; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--press); gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: inset 0 1px 0 var(--hi), 0 1px 3px rgba(0, 0, 0, .1); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); padding: 0; position: relative; }
.swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--ink); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.switch { width: 46px; height: 28px; border-radius: 999px; border: 1px solid var(--line); background: var(--press); position: relative; padding: 0; transition: background-color .2s ease; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--glass-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s cubic-bezier(.3, 1.4, .5, 1); }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--sky); }

/* sliders: a native range, styled; the band behind the day slider is drawn in solid blocks */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--ink); border: 3px solid var(--sky); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--sky); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

/* the foot: the timeline */
.foot { grid-area: foot; padding: 12px 16px 14px; display: grid; gap: 8px; min-width: 0; }
.foot > * { min-width: 0; }
.js-adjust { display: none; }
.foot-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; min-width: 0; }
.foot-top .chips { flex: 1 1 auto; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; transition: background-color .2s ease, color .2s ease; white-space: nowrap; }
.chip:hover { background: var(--press); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sky); border-color: transparent; }
.chip.is-now[aria-pressed="true"] .live-dot { box-shadow: none; }
.chip.is-now[aria-pressed="false"] .live-dot { background: var(--ink-3); box-shadow: none; animation: none; }
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.stepper button:hover { background: var(--press); color: var(--ink); }
.stepper span { font-size: 14px; font-weight: 600; min-width: 92px; text-align: center; }
.day-slider { position: relative; height: 40px; }
.band { position: absolute; left: 9px; right: 9px; top: 6px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--night); }
.band i { position: absolute; top: 0; bottom: 0; }
.band .b-blue { background: var(--blue); }
.band .b-golden { background: var(--golden); }
.band .b-day { background: var(--day); }
.band .b-noon { width: 2px; margin-left: -1px; background: rgba(34, 29, 23, .35); }
.day-slider input { position: absolute; inset: 0 0 auto; height: 26px; }
.day-slider input::-webkit-slider-runnable-track { background: transparent; height: 26px; }
.day-slider input::-moz-range-track { background: transparent; height: 26px; }
.day-slider input::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: 2px; background: var(--sun); border: 3px solid var(--glass-strong); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.day-slider input::-moz-range-thumb { width: 16px; height: 16px; background: var(--sun); border: 3px solid var(--glass-strong); }
.ticks { position: absolute; left: 9px; right: 9px; top: 25px; height: 14px; font-size: 11px; color: var(--ink-3); font-weight: 600; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }
.year-row { display: flex; align-items: center; gap: 12px; }
.year-row .chips { flex: 0 1 auto; max-width: 58%; }
.year-slider { position: relative; flex: 1; min-width: 120px; height: 34px; }
.year-slider input { position: absolute; inset: 0 0 auto; }
.months { position: absolute; left: 9px; right: 9px; top: 22px; font-size: 10px; color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.months span { position: absolute; transform: translateX(-50%); }

.sheet-toggles { display: none; gap: 8px; }
.note { font-size: 11px; color: var(--ink-3); max-width: 60ch; margin: 0; line-height: 1.35; }

/* ------------------------------------------------------------------ the place popup */
.place-pop {
  position: fixed; z-index: 20;
  top: max(var(--gap), env(safe-area-inset-top)); left: max(var(--gap), env(safe-area-inset-left));
  width: min(380px, calc(100vw - 2 * var(--gap)));
  max-height: calc(100vh - 2 * var(--gap));
  padding: 18px; display: grid; gap: 12px; overflow: auto;
  background: var(--glass-strong);
  transform-origin: 24px 24px;
  animation: pop .28s cubic-bezier(.3, 1.3, .5, 1);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.place-pop h2 { margin: 0; font: 400 28px/1.05 var(--serif); }
.place-pop p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.pop-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--press); display: grid; place-items: center; }
.field { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field input { height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass); padding: 0 14px; font-size: 15px; font-weight: 500; color: var(--ink); width: 100%; }
.field input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.results { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.results button { width: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; }
.results button:hover, .results button:focus-visible, .results button[aria-current="true"] { background: var(--press); }
.results small { color: var(--ink-3); font-size: 12px; font-weight: 500; }
.results .is-guess { color: var(--ink-2); }
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-btn { border: 0; background: transparent; padding: 0; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.btn-solid { height: 44px; border-radius: 999px; border: 0; background: var(--ink); color: var(--sky); font-weight: 700; padding: 0 18px; }
.err { color: #b4532f; font-size: 13px; font-weight: 600; }
.is-dark .err { color: #f0a58a; }

/* the loading note and a failed 3D view */
.boot { position: fixed; inset: 0; display: grid; place-items: center; font: 400 28px/1 var(--serif); color: var(--ink-2); transition: opacity .5s ease; pointer-events: none; }
.boot.is-gone { opacity: 0; }
.failed { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); max-width: 320px; text-align: center; font-size: 14px; color: var(--ink-2); }

/* ------------------------------------------------------------------ smaller frames */
@media (max-width: 1080px) {
  .panel { width: 260px; padding: 16px; gap: 14px; }
  .big dd { font-size: 30px; }
}
/* compact: the home page frames this page at about 1100 by 620, and short windows. The data
   panel keeps the essentials, the parasol folds behind "Adjust" and the timeline is one row. */
@media (max-height: 760px) and (min-width: 821px) {
  .clock-time { font-size: clamp(48px, 6.2vw, 72px); }
  .hint { display: none; }
  .panel { width: 236px; gap: 10px; padding: 14px 16px; }
  .panel .is-more, .panel .note, .panel .countdown { display: none; }
  .big dd { font-size: 28px; }
  .rows .row { padding: 5px 0; }
  .parasol { width: 290px; gap: 10px; padding: 14px; }
  .parasol:not(.is-expanded) .ctrl, .parasol:not(.is-expanded) .parasol-opts, .parasol .spec { display: none; }
  .js-adjust { display: block; }
  .foot { padding: 10px 14px 12px; gap: 6px; }
  .year-row { display: none; }
}
@media (max-width: 820px) {
  .ui { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "space" "foot"; }
  .panel, .parasol { position: fixed; z-index: 15; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: auto; max-height: 72vh; background: var(--glass-strong); animation: pop .26s cubic-bezier(.3, 1.3, .5, 1); transform-origin: 50% 100%; }
  .panel:not(.is-open), .parasol:not(.is-open) { display: none; }
  .parasol .ctrl, .parasol .parasol-opts { display: grid; }
  .parasol .parasol-opts { display: flex; }
  .sheet-toggles { display: flex; position: fixed; top: max(var(--gap), env(safe-area-inset-top)); right: max(var(--gap), env(safe-area-inset-right)); flex-direction: column; align-items: flex-end; gap: 6px; }
  .sheet-toggles .pill { height: 32px; font-size: 13px; padding: 0 12px; }
  .brand span { display: none; }
  .sheet-close { display: grid !important; }
  .foot-top { flex-wrap: nowrap; }
  .year-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .year-row .chips { max-width: none; width: 100%; }
  .year-slider { flex: none; }
}
@media (max-width: 520px) {
  :root { --gap: 10px; --r: 18px; }
  .clock-time { font-size: 54px; }
  .brand b { font-size: 19px; }
  .foot { padding: 10px 12px 12px; }
  .stepper button { width: 28px; }
  .stepper span { min-width: 58px; font-size: 13px; }
  .hint { display: none; }
}
@media (max-height: 600px) and (max-width: 820px) {
  .clock-time { font-size: 44px; }
  .year-row { display: none; }
  .foot { gap: 4px; padding-top: 8px; padding-bottom: 8px; }
}
.sheet-close { display: none; position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--press); place-items: center; }
.embed .note { display: none; }

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