/* The windsock forecast: a dark widget on a black page, with a striped windsock of real cloth on its pole. The strength
   of the wind has its colour (a scale from a calm blue to a strong red), the same in the figures and in the bars. */
:root {
  --page: #000000;            /* the page */
  --card-top: #10202c;        /* the widget, at the top and at the bottom */
  --card-bottom: #0a141c;
  --ink: #f4f7fa;             /* the writing */
  --ink-soft: rgba(244, 247, 250, 0.62);
  --stripe: #ff5b22;          /* the windsock's stripes: the coloured ones */
  --stripe-alt: #f4efe4;      /* and the white ones */
  --pole: #9aa7b3;            /* the pole and the hoop */
  --air: #bcd8f0;             /* the lines of the air that blows past */
  --kn-calm: #6cc4ff;         /* the scale of the wind: up to 4 knots */
  --kn-light: #4fd8b4;        /* about 10 knots */
  --kn-good: #b9e65a;         /* about 16 knots */
  --kn-fresh: #ffd24a;        /* about 22 knots */
  --kn-strong: #ff7a45;       /* 28 knots and more */
  --radius: 30px;             /* the corners of the widget */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Saira 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;
}

/* ---------------------------------------------------------------- the widget */
.sock {
  position: relative;
  isolation: isolate;
  width: min(380px, 100%);
  height: 424px;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 70% at 55% 48%, rgba(120, 170, 210, 0.11), transparent 70%),
    linear-gradient(180deg, var(--card-top), var(--card-bottom));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07) inset;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y;
}

.sock__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------------------------------------------------------- the reading */
.read {
  position: absolute;
  top: 20px;
  left: 22px;
  right: 96px;
  pointer-events: none;
}

.read > * {
  margin: 0;
}

.read__place {
  font-size: 17px;
  font-weight: 620;
  line-height: 22px;
  letter-spacing: 0.005em;
}

.read__when {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 480;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.read__main {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 8px;
}

.speed {
  display: flex;
  align-items: baseline;
  margin: 0;
  white-space: nowrap;
}

/* the knots: an odometer, a wheel of digits for the units and one for the tens */
.speed__num {
  display: inline-flex;
  font-size: 66px;
  font-weight: 260;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.wheel {
  display: block;
  height: 1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 84%, transparent 100%);
}

.wheel__strip {
  display: block;
  will-change: transform;
}

.wheel__strip > span {
  display: block;
  height: 1em;
  text-align: center;
}

.speed__unit {
  margin-left: 5px;
  color: var(--ink-soft);
  font-size: 20px;
  font-weight: 520;
}

.facts {
  display: grid;
  gap: 3px;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 520;
  line-height: 18px;
  white-space: nowrap;
}

.fact {
  display: flex;
  gap: 6px;
}

.fact dt {
  color: var(--ink-soft);
}

.fact dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.fact--gust dd {
  color: var(--gust-ink, var(--ink));
}

.fact__name {
  color: var(--force-ink, var(--ink));
}

/* ---------------------------------------------------------------- the direction */
.dir {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 64px;
  pointer-events: none;
}

.dir__rose {
  display: block;
  width: 60px;
  height: 60px;
  overflow: visible;
}

.dir__ring {
  fill: rgba(255, 255, 255, 0.04);
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.dir__ticks path {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  stroke-linecap: round;
}

.dir__ticks path.is-main {
  stroke: rgba(255, 255, 255, 0.55);
}

.dir__n {
  fill: var(--ink-soft);
  font-size: 7.5px;
  font-weight: 700;
  text-anchor: middle;
}

.dir__arrow {
  fill: var(--ink);
}

.dir__tail {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dir__text {
  margin: 0;
  font-size: 14px;
  font-weight: 640;
  line-height: 18px;
  white-space: nowrap;
}

.dir__from {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 480;
}

/* ---------------------------------------------------------------- the hours */
.panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.09) inset, 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
}

.hours {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr));
  padding: 5px;
}

.hours__pill {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset, 0 8px 18px -10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.hour {
  position: relative;
  display: grid;
  grid-template-rows: 36px 14px 17px 14px;
  justify-items: center;
  align-content: center;
  row-gap: 3px;
  padding: 9px 0 7px;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .hour[aria-checked='false']:hover {
    background: rgba(255, 255, 255, 0.045);
  }
}

/* the bar of the hour: the mean wind full, the gusts above it fainter */
.hour__bars {
  position: relative;
  display: block;
  width: 6px;
  height: 36px;
  align-self: end;
}

.hour__bars > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 3px;
  background: var(--c);
  transform-origin: 50% 100%;
}

.hour__bars > .hour__gust {
  opacity: 0.32;
}

.hour__arrow {
  display: block;
  width: 14px;
  height: 14px;
  overflow: visible;
  fill: var(--ink-soft);
}

.hour[aria-checked='true'] .hour__arrow {
  fill: var(--ink);
}

.hour__kn {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 17px;
  font-variant-numeric: tabular-nums;
}

.hour__label {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 520;
  line-height: 14px;
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}

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

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

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

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

/* a narrow screen: the figure a little smaller, so the facts beside it keep clear of the direction */
@media (max-width: 400px) {
  .speed__num {
    font-size: 58px;
  }

  .read__main {
    gap: 12px;
  }
}
