/* Sun Path & Shadow Calculator: only what ft-tool-20261106.css lacks (city list, obstacle cards, chart
   frames, sky chart colours, print poster). Colours and sizes come from the shared tokens. */

/* Layout: place and obstacles on the left, results on the right (wide screens); in reading order on phones */
@media (min-width: 56rem) {
  .ssp-layout { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .ssp-p-place { grid-column: 1; grid-row: 1; }
  .ssp-p-sun { grid-column: 2; grid-row: 1 / span 2; }
  .ssp-p-obs { grid-column: 1; grid-row: 2 / span 2; }
  .ssp-p-months { grid-column: 2; grid-row: 3; }
}

/* Unit picker inside an input group: the shared unit style hides the select arrow, so draw it again */
.ft-inputgroup > select.ft-inputgroup__unit.ssp-unit {
  padding-right: 2rem;
  color: var(--ft-ink);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 1.05rem center, right 0.7rem center;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* The coordinate read-back is filled in by the script: keep its space so nothing below moves */
@media (max-width: 40rem) { #ssp-coord-read { min-height: 4.35em; } }
#ssp-tz-hint { min-height: 2.9em; }

/* Two inputs side by side, also on phones */
.ssp-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--ft-space-3); }
.ssp-pair > .ft-field { min-width: 0; }

/* City search (ARIA combobox with a listbox popup) */
.ssp-combo__box { position: relative; }
.ssp-combo__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: min(20rem, 60vh);
  margin: 0;
  padding: var(--ft-space-1) 0;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--ft-line-strong);
  border-radius: var(--ft-radius);
  background: var(--ft-surface);
  box-shadow: var(--ft-shadow);
}
.ssp-combo__list[hidden] { display: none; }
.ssp-combo__option {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--ft-space-2);
  min-height: var(--ft-target);
  padding: 0.55rem var(--ft-space-3);
  color: var(--ft-ink);
  font-size: var(--ft-text-md);
  line-height: 1.3;
  cursor: pointer;
}
.ssp-combo__option[aria-selected="true"], .ssp-combo__option:hover { background: var(--ft-accent-soft); }
.ssp-combo__option[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--ft-accent); }
.ssp-combo__where { color: var(--ft-ink-2); font-size: var(--ft-text-sm); }
.ssp-combo__empty { padding: 0.6rem var(--ft-space-3); color: var(--ft-ink-2); font-size: var(--ft-text-sm); }

/* Quick time buttons: 2 x 2 on phones, one row when there is room */
.ssp-jump { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ft-space-2); }
.ssp-jump .ft-btn { padding-inline: 0.5rem; }
@media (max-width: 30rem) { .ssp-jump { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Results: two stats per row on phones, four when there is room */
.ssp-now, .ssp-day { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); }
@media (max-width: 26rem) { .ssp-now, .ssp-day { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ssp-now .ft-stat, .ssp-day .ft-stat { padding: var(--ft-space-3); }
.ssp-now .ft-stat__note, .ssp-day .ft-stat__note { min-height: 2.9em; }
.ssp-now .ft-stat__value { font-size: var(--ft-text-xl); }
.ssp-day .ft-stat__value { font-size: var(--ft-text-lg); }
.ssp-summary { min-height: 3em; margin: var(--ft-space-3) 0 0; color: var(--ft-ink); font-size: var(--ft-text-sm); line-height: 1.5; }
.ssp-notes:empty { display: none; }
.ssp-notes .ft-note { margin: var(--ft-space-3) 0 0; }

/* Sky chart (square, centred, not wider than it needs to be) */
.ssp-sky { max-width: 32rem; margin: var(--ft-space-4) auto 0; }
.ssp-sky .ft-chart__frame { background: var(--ft-surface); }
.ssp-sky .ft-chart__legend { justify-content: center; }
.ssp-key-sun { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--ft-plot-2); box-shadow: 0 0 0 2px var(--ft-surface), 0 0 0 3px var(--ft-plot-2); }
.ssp-key-ref { display: inline-block; width: 1.1rem; border-top: 2px dashed var(--ft-ink-2); }
.ssp-key-ob { display: inline-block; width: 0.9rem; height: 0.9rem; border: 1px solid var(--ft-ink-2); background: repeating-linear-gradient(45deg, var(--ft-ink-2) 0 1px, transparent 1px 5px); opacity: 0.85; }
.ssp-sky__bg { fill: var(--ft-surface); }
.ssp-sky__grid { fill: none; stroke: var(--ft-plot-grid); }
.ssp-sky__rim { fill: none; stroke: var(--ft-plot-axis); }
.ssp-sky__label { fill: var(--ft-plot-ink-2); }
.ssp-sky__cardinal { fill: var(--ft-plot-ink); }
.ssp-sky__ref { fill: none; stroke: var(--ft-plot-ink-2); }
.ssp-sky__reflabel { fill: var(--ft-plot-ink-2); stroke: var(--ft-surface); }
.ssp-sky__today { fill: none; stroke: var(--ft-plot-1); }
.ssp-sky__hour { fill: var(--ft-plot-1); stroke: var(--ft-surface); }
.ssp-sky__hourlabel { fill: var(--ft-plot-ink); stroke: var(--ft-surface); }
.ssp-sky__sun { fill: var(--ft-plot-2); stroke: var(--ft-surface); }
.ssp-sky__sun--hidden { fill: var(--ft-surface); stroke: var(--ft-plot-2); }
.ssp-sky__obstacle { fill: var(--ft-plot-grid); fill: color-mix(in srgb, var(--ft-plot-ink-2) 16%, transparent); stroke: var(--ft-plot-ink-2); }
.ssp-sky__hatch { stroke: var(--ft-plot-ink-2); opacity: 0.55; }
.ssp-sky__oblabel { fill: var(--ft-plot-ink); stroke: var(--ft-surface); }

/* ft-plot charts: the frame keeps mountPlot's size (aspect 0.62, 220–560 px high), so nothing moves */
.ssp-plot {
  position: relative;
  width: 100%;
  aspect-ratio: 100 / 62;
  min-height: 300px;
  max-height: 560px;
  overflow: hidden;
  border: 1px solid var(--ft-line);
  border-radius: var(--ft-radius);
  background: var(--ft-plot-surface);
}
.ssp-plot > svg { display: block; width: 100%; height: auto; }
.ssp-plot--day { aspect-ratio: 2 / 1; max-height: 460px; }
.ssp-downloads { margin-top: var(--ft-space-4); }
.ssp-row3 { margin-top: var(--ft-space-4); }

/* Obstacles */
.ssp-obstacles { display: grid; gap: var(--ft-space-3); margin: 0; padding: 0; list-style: none; }
.ssp-ob { padding: var(--ft-space-3) var(--ft-space-4) var(--ft-space-4); border: 1px solid var(--ft-line); border-radius: var(--ft-radius); background: var(--ft-surface-2); }
.ssp-ob__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ft-space-2); margin-bottom: var(--ft-space-2); }
.ssp-ob__title { margin: 0; color: var(--ft-ink); font-size: var(--ft-text-md); font-weight: 650; }
.ssp-ob__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); gap: var(--ft-space-3); }
.ssp-ob__grid .ft-field--wide { grid-column: 1 / -1; }
.ssp-ob__summary { margin: var(--ft-space-2) 0 0; color: var(--ft-ink-2); font-size: var(--ft-text-sm); }
.ssp-ob .ft-input, .ssp-ob .ft-select { background: var(--ft-surface); }
.ssp-ob .ft-range { margin-top: var(--ft-space-1); }

/* Month table labels */
.ssp-band { white-space: nowrap; }

/* Print: the whole page prints without the frame (ft-tool CSS); "Print sun path chart" prints only the poster */
.ssp-poster { display: none; }
@media print {
  .ssp-combo__list, .ssp-jump, .ssp-timeslider { display: none !important; }
  html.ssp-printing-poster body > *:not(main), html.ssp-printing-poster main > .ft-wrap > *:not(.ssp-poster) { display: none !important; }
  html.ssp-printing-poster .ssp-poster { display: block !important; color: #000; }
  html.ssp-printing-poster, html.ssp-printing-poster body { background: #fff !important; }
  html.ssp-printing-poster body { display: block !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; }
  html.ssp-printing-poster main, html.ssp-printing-poster main > .ft-wrap { padding: 0 !important; margin: 0 !important; }
  .ssp-poster h2 { margin: 0 0 1.5mm; font-size: 15pt; }
  .ssp-poster__meta { margin: 0 0 2mm; font-size: 8.5pt; line-height: 1.35; color: #333; }
  .ssp-poster__chart { width: 135mm; height: 135mm; margin: 0 auto 2mm; }
  .ssp-poster__chart svg { width: 100%; height: 100%; }
  .ssp-poster table { width: 100%; border-collapse: collapse; font-size: 8pt; break-inside: avoid; }
  .ssp-poster th, .ssp-poster td { padding: 0.6mm 1.5mm; border-bottom: 0.2mm solid #999; text-align: right; }
  .ssp-poster th:first-child, .ssp-poster td:first-child { text-align: left; }
  .ssp-poster__foot { margin: 2mm 0 0; font-size: 8pt; color: #333; }
  @page { margin: 12mm; }
}

/* Mobile form controls (16px to prevent iOS Safari zoom) and 44px primary buttons */
@media screen and (max-width: 640px), screen and (hover: none) and (pointer: coarse) {
  .ft-tool input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  .ft-tool select,
  .ft-tool textarea,
  .ft-tool .ft-input,
  .ft-tool .ft-select,
  .ft-tool .ft-textarea,
  .ft-tool .ft-inputgroup > .ft-select.ft-inputgroup__unit,
  .ft-tool .ft-inputgroup > select.ft-inputgroup__unit.ssp-unit {
    font-size: max(16px, 1rem);
  }
  .ft-tool .ft-btn--primary {
    min-height: 44px;
  }
}
