/* Home page. Loaded after styles.css. */

.home-intro {
  padding-top: clamp(1rem, 4vw, 3rem);
}

.home-intro .page-lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.how-steps {
  display: grid;
  gap: 1rem;
  max-width: 60rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

@media (min-width: 48rem) {
  .how-steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.how-steps li {
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  counter-increment: step;
}

.how-steps li::before {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--link);
  font-family: var(--font-display);
  font-size: 1.6rem;
  line-height: 1;
  content: counter(step);
}

/* Viewpoint cards */

.recommended[hidden] {
  display: none;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.view-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.view-card a:hover {
  border-color: var(--cyan);
}

.view-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: 50% var(--crop-y, 50%);
}

.view-card-body {
  display: grid;
  gap: 0.2rem;
  padding: 0.875rem 1rem 1rem;
}

.view-card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.2;
}

.view-card-mode,
.view-card-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.view-card-info:empty {
  display: none;
}

.view-card-info span {
  display: block;
}

.view-card-info strong {
  color: var(--ink);
}

/* Map */

.home-map-figure {
  margin: 0;
}

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

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

.map-marker-wedge {
  opacity: 0.45;
}

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

.map-marker-rise .map-marker-wedge,
.map-marker-rise .map-marker-dot {
  fill: var(--ray-rise);
}

.map-marker-set .map-marker-wedge,
.map-marker-set .map-marker-dot {
  fill: var(--ray-set);
}

.map-marker-label {
  fill: var(--ink);
  font-family: var(--font-text);
  font-size: calc(13px * var(--map-scale, 1));
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--map-land);
  stroke-width: calc(3px * var(--map-scale, 1));
}

/* Labels sit a fixed number of screen pixels beside their marker. */
.map-marker-label-right {
  transform: translate(calc(10px * var(--map-scale, 1)), 0);
}

.map-marker-label-left {
  transform: translate(calc(-10px * var(--map-scale, 1)), 0);
}

.map-marker-label-above {
  transform: translate(0, calc(-13px * var(--map-scale, 1)));
}

.map-marker-label-below {
  transform: translate(0, calc(14px * var(--map-scale, 1)));
}

/* Labels that would cover a neighbour (js/map-zoom.js) show on hover or keyboard focus only. */
.home-map .map-marker.is-crowded .map-marker-label {
  display: none;
}

.home-map .map-marker.is-crowded:hover .map-marker-label,
.home-map .map-marker.is-crowded:focus-visible .map-marker-label {
  display: inline;
}

/* Whole-region view (js/map-zoom.js): dots only; a label shows on hover or keyboard focus. */
.home-map.is-overview .map-marker-label {
  display: none;
}

.home-map.is-overview .map-marker:hover .map-marker-label,
.home-map.is-overview .map-marker:focus-visible .map-marker-label {
  display: inline;
}

.map-marker:hover .map-marker-label,
.map-marker:focus-visible .map-marker-label {
  fill: var(--link);
  text-decoration: underline;
}

.map-marker:focus-visible {
  outline: none;
}

.map-marker:focus-visible .map-marker-dot {
  stroke: var(--cyan);
  stroke-width: 3;
}

.home-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;
}

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

.legend-dot {
  width: 0.75rem;
  height: 0.75rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.legend-dot-rise {
  background: var(--ray-rise);
}

.legend-dot-set {
  background: var(--ray-set);
}

/* Sunrise / sunset filter for the map and the viewpoint list (js/home.js) */

.mode-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.mode-filter[hidden] {
  display: none;
}

.mode-filter button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  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;
}

.mode-filter button:hover {
  border-color: var(--cyan);
}

.mode-filter button[aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.home-map[data-mode-filter="rise"] .map-marker-set,
.home-map[data-mode-filter="set"] .map-marker-rise,
.all-views[data-mode-filter="rise"] .view-card[data-mode="set"],
.all-views[data-mode-filter="set"] .view-card[data-mode="rise"] {
  display: none;
}

/* A second viewpoint at the same spot (for example a sunset view next to a sunrise view):
   its dot sits just to the right of the first one, and its label appears only when sunsets are filtered. */
.map-marker-twin .map-marker-dot,
.map-marker-twin .map-marker-label {
  translate: calc(13px * var(--map-scale, 1)) 0;
}

.home-map:not([data-mode-filter="set"]) .map-marker-twin .map-marker-label {
  display: none;
}

/* Link to the guide article */

.guide-card {
  display: grid;
  gap: 0.5rem;
  max-width: 44rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  background: var(--panel);
}

.page .guide-card {
  color: var(--ink);
  text-decoration: none;
}

.guide-card:hover {
  border-color: var(--cyan);
}

.guide-card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.25;
}

.guide-card-text {
  color: var(--muted);
}

.guide-card-more {
  color: var(--link);
  font-weight: 600;
}
