/* Sun-path study (assets/fx/sunpath.js) */
/* space reserved before the module loads (measured heights of the finished feature) */
[data-fx='sunpath'] { color: var(--ink); min-height: 1440px; }
@media (min-width: 700px) { [data-fx='sunpath'] { min-height: 1250px; } }
@media (min-width: 1024px) { [data-fx='sunpath'] { min-height: 870px; } }
[data-fx='sunpath'].fx-on { min-height: 0; }
.sp-fallback { max-width: 60ch; display: grid; gap: 14px; padding-block: 24px; }
.sp-fallback p:not(.label) { font-weight: 400; opacity: 0.8; }

.sp {
  display: grid; gap: 24px 48px; align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 340px);
  grid-template-areas: 'pin read' 'pin more' 'ctl ctl' 'cap cap';
  grid-template-rows: auto 1fr auto auto;
}
.sp__pin { grid-area: pin; display: grid; gap: 6px; }
.sp__fig { margin: 0; }
.sp__stage {
  position: relative; aspect-ratio: 132 / 73; max-height: max(420px, calc(100svh - 330px)); background: #fff;
  border: 1px solid var(--line-dark); border-radius: var(--radius-sm); overflow: hidden;
}
.sp__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sp__cap { grid-area: cap; font-size: 12px; line-height: 1.6; opacity: 0.66; max-width: 110ch; font-weight: 400; }

/* svg type: Questrial labels with a paper halo so they stay legible over rays and hatch */
.sp-t { font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.1em; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; stroke-opacity: 0.85; }
.sp-t--lab { fill-opacity: 0.62; }
.sp-t--dim { fill-opacity: 0.85; }
.sp-t--dir { fill-opacity: 0.55; }
.sp-t--title { fill-opacity: 0.9; letter-spacing: 0.16em; }
.sp-t--ang { font-family: var(--f-display); font-size: 15px; letter-spacing: 0; }
.sp-t--sun { fill-opacity: 0.8; letter-spacing: 0.08em; }
.sp-dt { font-family: var(--f-ui); font-size: 12px; fill: var(--ink); fill-opacity: 0.7; }

/* reading */
.sp__read { grid-area: read; display: grid; gap: 10px; }
.sp__eyebrow { opacity: 0.6; }
.sp__time { font-size: clamp(44px, 4.2vw, 62px); font-weight: 300; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.sp__sun { font-family: var(--f-ui); font-size: 14px; letter-spacing: 0.02em; opacity: 0.75; }
.sp__state { font-size: 15px; font-weight: 400; line-height: 1.5; min-height: 4.5em; padding-left: 12px; border-left: 2px solid var(--brick); }
.sp__sentence { font-size: clamp(19px, 1.4vw, 21px); line-height: 1.45; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line-dark); min-height: 7.4em; }

.sp__more { grid-area: more; display: grid; grid-template-columns: 124px 1fr; gap: 16px; align-items: start; }
.sp__dial { width: 124px; height: 124px; display: block; }
.sp__notes { display: grid; gap: 8px; font-size: 13px; line-height: 1.5; font-weight: 400; }
.sp__notes .label { opacity: 0.6; }
.sp__notes p:not(.label) { opacity: 0.8; }

/* controls */
.sp__timebar {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: 1fr auto 1fr; grid-template-areas: 'lab lab btns' 'track track track' 'rise key set';
}
.sp__tlabel { grid-area: lab; opacity: 0.7; }
.sp__timebar .sp__btns { grid-area: btns; justify-self: end; }
.sp__track { grid-area: track; }
.sp__rise, .sp__set, .sp__key { font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.04em; opacity: 0.7; }
.sp__rise { grid-area: rise; }
.sp__set { grid-area: set; justify-self: end; }
.sp__key { grid-area: key; }
.sp__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.sp__row .label, .sp__grp legend { opacity: 0.7; }
.sp__btns { display: flex; gap: 8px; }
.sp__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-dark); font-family: var(--f-ui); font-size: 14px; color: var(--ink); white-space: nowrap;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.sp__btn:hover { border-color: var(--ink); }
.sp__btn svg { width: 11px; height: 11px; fill: currentColor; }
.sp__play .i-pause, .sp__play[aria-pressed='true'] .i-play { display: none; }
.sp__play[aria-pressed='true'] .i-pause { display: inline; }
.sp__play[aria-pressed='true'] { background: var(--ink); color: var(--bone); border-color: var(--ink); }

.sp__track { position: relative; height: 44px; }
.sp__litbar { position: absolute; left: 11px; right: 11px; top: 50%; height: 6px; margin-top: -3px; pointer-events: none; }
.sp__litbar i { position: absolute; top: 0; bottom: 0; background: var(--brick); opacity: 0.75; border-radius: 3px; }
.sp__ends { display: flex; justify-content: space-between; gap: 12px; font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.04em; opacity: 0.7; }
.sp__key { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sp__key i { width: 16px; height: 6px; border-radius: 3px; background: var(--brick); opacity: 0.75; }

.sp__range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; position: relative; }
.sp__range::-webkit-slider-runnable-track { height: 1px; background: rgba(36, 35, 35, 0.35); }
.sp__range::-moz-range-track { height: 1px; background: rgba(36, 35, 35, 0.35); }
.sp__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  background: var(--bone); border: 1.5px solid var(--ink); box-shadow: 0 1px 4px rgba(36, 35, 35, 0.18);
}
.sp__range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--bone); border: 1.5px solid var(--ink); }
.sp__range--t::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -12px; background: var(--brick); border: 2px solid var(--bone); box-shadow: 0 0 0 1px var(--brick), 0 1px 6px rgba(199, 67, 0, 0.35); }
.sp__range--t::-moz-range-thumb { background: var(--brick); border-color: var(--bone); }
.sp__range:focus-visible { outline: 2px solid var(--brick); outline-offset: 2px; box-shadow: none; border-radius: 4px; }

.sp__ctl {
  grid-area: ctl; display: flex; flex-wrap: wrap; gap: 20px 40px; align-items: end;
  border-top: 1px solid var(--line-dark); padding-top: 20px;
}
.sp__grp { border: 0; min-width: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.sp__grp legend { padding: 0; margin-bottom: 8px; }
.sp__grp--eave { flex: 1 1 220px; max-width: 340px; gap: 0; }
.sp__grp--eave .sp__row { min-height: 0; }
.sp__dval { font-family: var(--f-ui); font-size: 14px; }
.sp__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sp__chip { position: relative; }
.sp__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.sp__chip span {
  display: inline-flex; align-items: center; height: 44px; padding: 0 15px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-dark); font-family: var(--f-ui); font-size: 14px; white-space: nowrap;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.sp__chip span:hover { border-color: var(--ink); }
.sp__chip input:checked + span { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.sp__chip input:focus-visible + span { outline: 2px solid var(--brick); outline-offset: 2px; }

/* tablets and phones: one column */
@media (max-width: 1023px) {
  .sp { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'pin' 'read' 'ctl' 'more' 'cap'; grid-template-rows: none; gap: 24px; }
  .sp__more { max-width: 560px; }
  .sp__state, .sp__sentence { min-height: 0; }
}
/* phones: the drawing and the time slider stay pinned at the top while the other controls scroll under them */
@media (max-width: 699px) {
  .sp { gap: 20px; }
  .sp__pin {
    position: sticky; top: 0; z-index: 3; background: var(--bone);
    margin-inline: calc(-1 * var(--gutter)); padding: 0 var(--gutter) 2px;
    border-bottom: 1px solid var(--line-dark); transition: top 0.7s var(--ease-out);
  }
  .header:not(.is-hidden) ~ main .sp__pin { top: var(--header-h); }
  /* keyboard focus scrolls controls into view below the pinned drawing, not under it */
  .sp__ctl input, .sp__more, .sp__read { scroll-margin-top: calc(var(--header-h) + 380px); }
  .sp__stage {
    aspect-ratio: 105 / 70.5; max-height: none; border-radius: 0; border-inline: 0;
    margin-inline: calc(-1 * var(--gutter));
  }
  /* one compact row under the slider: sunrise · play · now · sunset */
  .sp__timebar { grid-template-columns: auto 1fr auto; grid-template-areas: 'track track track' 'rise btns set'; column-gap: 8px; padding-bottom: 4px; }
  .sp__tlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .sp__key, .sp__xs { display: none; }
  .sp__timebar .sp__btns { justify-self: center; gap: 6px; }
  .sp__btn { padding: 0 14px; }
  .sp__read { gap: 8px; }
  .sp__time { font-size: 40px; }
  .sp__sentence { font-size: 18px; }
  .sp__ctl { gap: 18px 24px; padding-top: 0; border-top: 0; }
  .sp__grp--eave { max-width: none; flex-basis: 100%; }
  .sp__chip span { padding: 0 13px; }
  .sp__more { grid-template-columns: 112px 1fr; gap: 14px; }
  .sp__dial { width: 112px; height: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  .sp__btn, .sp__chip span, .sp__pin { transition: none; }
}
