/* The week's weather: a light card on a white page, tinted by the sky of the day chosen. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1d2433;
  --muted: #6c7385;
  --sky-top: #fff6df;       /* the card's colours: the script changes them with the sky of the day */
  --sky-bottom: #ffe6b3;
  --line: #f2a516;          /* the curve of the temperatures */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Quicksand Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 28px 16px;
}

.weather {
  width: min(400px, 100%);
  padding: 22px 18px 16px;
  border-radius: 30px;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 24px 48px -30px rgba(29, 36, 51, 0.38);
}

/* ---------------------------------------------------------------- the day */
.weather__head {
  padding: 0 4px;
}

.weather__place {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.weather__when {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* a word or a figure that rolls: the old one leaves upwards or downwards, the new one comes from the other side */
.roll {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.roll > span {
  display: inline-block;
}

.now {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.now__icon {
  width: 112px;
  height: 112px;
  margin-left: -10px;
}

.now__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.now__temp {
  display: flex;
  align-items: flex-start;
  margin: 0;
  font-size: 64px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.now__sky {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
}

.now__deg {
  font-size: 38px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--muted);
}

.now__stats {
  display: grid;
  gap: 6px;
  justify-self: end;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.now__stats div {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

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

.now__stats dd {
  margin: 0;
  min-width: 52px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the curve of the day */
.chart {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  margin: 2px -4px 0;
  padding-bottom: 22px;
  border-radius: 14px;
  outline: none;
  cursor: crosshair;
  touch-action: pan-y;
}

.chart__svg {
  display: block;
  width: 100%;
  height: 90px;
  overflow: visible;
}

.chart__line {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart__guide {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-opacity: 0.22;
  opacity: 0;
}

/* the hour and the temperature under the pointer */
.chart__tip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.chart__hours {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.chart__hours span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.chart:focus-visible {
  box-shadow: 0 0 0 2px var(--ink);
}

html[data-using='pointer'] .chart:focus-visible {
  box-shadow: none;
}

/* ---------------------------------------------------------------- the week */
.days {
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-top: 10px;
}

.days__pill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 6px 16px -10px rgba(29, 36, 51, 0.45);
  pointer-events: none;
}

.day {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 0 9px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.day__name {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: color 0.3s;
}

.day[aria-checked='true'] .day__name {
  color: var(--ink);
}

.day svg {
  display: block;
  width: 34px;
  height: 34px;
  overflow: visible;
}

.day__max {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.day__min {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.day:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

html[data-using='pointer'] .day:focus-visible {
  outline: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
