/* Viewpoint pages. Loaded after styles.css, which provides the tokens and page layout. */

/* Photo with the sun overlay */

/* A 16:9 band around the horizon; --crop-y positions it within the full photo. */
.sun-stage {
  position: relative;
  max-width: calc(60svh * 16 / 9);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.sun-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--crop-y, 50%);
}

/* On small screens keep the photo in view while using the time slider below it. */
@media (max-width: 48rem), (max-height: 40rem) {
  .sun-stage {
    position: sticky;
    z-index: 3;
    top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

.sun-tint,
.sun-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sun-tint {
  transition: background-color 0.25s ease;
}

.sun-day-path {
  fill: none;
  stroke: #ffe08a;
  stroke-linecap: round;
  opacity: 0.9;
}

.sun-ghost {
  fill: none;
  stroke: #ffe08a;
  stroke-dasharray: 4 4;
  opacity: 0.85;
}

.sun-disc {
  fill: #fff3c4;
  stroke: #f4b22e;
}

.sun-seasons line {
  stroke: #ffffff;
}

.sun-seasons text {
  fill: #ffffff;
  font-family: var(--font-text);
  font-weight: 600;
  paint-order: stroke;
  stroke: rgba(10, 30, 45, 0.7);
}

.sun-edge {
  position: absolute;
  top: 18%;
  margin: 0;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(12, 34, 51, 0.82);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.sun-edge[hidden] {
  display: none;
}

.sun-edge-left {
  left: 0.625rem;
}

.sun-edge-right {
  right: 0.625rem;
}

.sun-nojs {
  color: var(--muted);
  font-size: 0.9rem;
}

.sun-view:not(.is-ready) .needs-js,
.sun-view.is-ready .sun-nojs,
.page:not(:has(.sun-view.is-ready)) .map-legend {
  display: none;
}

.sun-legend,
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
  list-style: none;
}

.sun-legend li,
.map-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-path {
  width: 1.25rem;
  border-top: 3px dotted #e0b640;
}

.legend-marker {
  width: 2px;
  height: 0.9rem;
  background: var(--ink);
}

/* Controls */

.sun-controls {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

@media (min-width: 48rem) {
  .sun-controls {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
}

.sun-panel {
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.sun-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.sun-clock {
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.sun-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sun-date {
  min-height: 2.75rem;
  padding: 0.35em 0.6em;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 1rem;
}

.sun-time-field {
  display: block;
}

.sun-time {
  width: 100%;
  height: 2.75rem;
  margin: 0.5rem 0 0;
  accent-color: #f4b22e;
}

.sun-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.sun-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.875rem;
}

.sun-buttons button {
  min-height: 2.75rem;
  padding: 0.4em 1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.sun-buttons button:hover,
.sun-buttons button[aria-pressed="true"] {
  border-color: var(--cyan);
}

.sun-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.sun-facts dt {
  color: var(--muted);
}

.sun-facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* Weather forecast */

.forecast[hidden] {
  display: none;
}

.forecast-note,
.forecast-credit {
  color: var(--muted);
  font-size: 0.9rem;
}

.forecast-list {
  display: grid;
  gap: 0.25rem;
  max-width: 48rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.forecast-list button {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) 3.5rem minmax(0, 1.6fr) minmax(0, 1.6fr);
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.forecast-list button:hover {
  border-color: var(--line);
}

.forecast-list button[aria-pressed="true"] {
  border-color: var(--cyan);
  background: var(--control-bg);
}

.forecast-day {
  font-weight: 700;
}

.forecast-day small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.forecast-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.forecast-meter {
  display: grid;
  grid-template-columns: 1fr 3.2em;
  gap: 0.15rem 0.5rem;
  align-items: center;
  min-width: 0;
}

.forecast-meter-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.75rem;
}

.forecast-bar {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.forecast-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.forecast-fill.level-0 {
  background: #c8553d;
}

.forecast-fill.level-1 {
  background: #e0a526;
}

.forecast-fill.level-2 {
  background: #2e9e6b;
}

.forecast-percent {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Details of the selected day: a separate panel so it does not read as another list row. */
.forecast-detail {
  max-width: 48rem;
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cyan);
  border-radius: 0.625rem;
  background: var(--control-bg);
  font-size: 0.95rem;
}

.forecast-detail:empty {
  display: none;
}

.forecast-detail-title {
  font-weight: 700;
}

.forecast-detail p {
  margin: 0 0 0.4rem;
}

@media (max-width: 35rem) {
  .forecast-list button {
    grid-template-columns: 1fr auto;
  }

  .forecast-meter {
    grid-column: 1 / -1;
  }
}

/* Map */

.map-figure {
  margin: 0;
}

/* The width limit sits on the frame so the zoom buttons stay on the map. */
.map-figure .map-frame {
  max-width: 48rem;
}

.place-map {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.place-map .map-town {
  font-size: calc(12px * var(--map-scale, 1));
}

.map-wedge {
  fill: var(--ray-now);
  opacity: 0.45;
}

.map-point {
  r: calc(5px * var(--map-scale, 1));
  fill: var(--ray-now);
  stroke: var(--ink);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.ray {
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.ray-rise {
  stroke: var(--ray-rise);
  stroke-dasharray: 5 4;
}

.ray-set {
  stroke: var(--ray-set);
  stroke-dasharray: 5 4;
}

.ray-now {
  stroke: var(--ray-now);
  stroke-width: 3;
}

.legend-line {
  width: 1.25rem;
  border-top: 2px dashed;
}

.legend-rise {
  border-color: var(--ray-rise);
}

.legend-set {
  border-color: var(--ray-set);
}

.legend-now {
  border-top: 3px solid var(--ray-now);
}

.place-address {
  margin-top: 1rem;
}

/* Photos taken at the viewpoint */

.place-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 28rem), 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.place-photo {
  margin: 0;
}

.place-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.place-photo figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.photo-compare {
  min-height: 2.75rem;
  padding: 0.4em 1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.photo-compare:hover {
  border-color: var(--cyan);
}

.photo-dialog {
  max-width: min(96vw, 100rem);
  max-height: 96svh;
  padding: 0;
  border: 0;
  overflow: visible;
  background: transparent;
}

.photo-dialog::backdrop {
  background: rgb(0 0 0 / 0.85);
}

.photo-dialog img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(96svh - 3rem);
  margin: 0 auto;
  border-radius: var(--radius);
}

.photo-dialog-caption {
  margin: 0.6rem 0 0;
  color: #fff;
  font-size: 0.92rem;
  text-align: center;
}

.photo-dialog-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(0 0 0 / 0.6);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.photo-dialog-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
