/* The embeddable widget (/embed). Colours and type come from theme.css.

   It lives inside somebody else's page, so it owns nothing outside its own
   card: the page behind the frame shows through the corners, and the card
   sizes itself to the frame's width -- a sidebar, a column, a banner. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: transparent; /* the host page shows round the card's corners */
}
/* No colour scheme of its own. A frame whose scheme differs from the iframe
   element's gets an opaque backdrop from the browser, and the card's round
   corners then sit on a white or black square. The snippet sets
   color-scheme:normal on the iframe, so the two always agree. */
:root { color-scheme: normal; }
/* Sizes went up a step on 2026-11-16: the small print (labels, axis, footer)
   was 10 px and hard to read in a sidebar. */
body {
  color: var(--text);
  font: 16px/1.4 var(--font-body);
  padding: 2px; /* room for the card's shadow inside the frame */
}
a { color: var(--link); }

/* The dark card's small print, a step brighter than the site's own grey:
   it is read at a smaller size, often in a sidebar. */
html:not([data-theme='light']) { --muted: #9ea8b5; }

/* ---------- light, for pages that are ----------
   ?theme=light, or ?theme=auto to follow the reader's system. The lab at
   midnight is dark; this is the same lab with the lights on. */
html[data-theme='light'] {
  --text: #1d2430;
  --text-strong: #0e1116;
  --muted: #4f5967;
  --card-solid: #f6f7f9;
  --card: #f6f7f9;
  --surface-2: #e9ecf0;
  --glass-edge: rgb(20 30 45 / 14%);
  --glass-rim: inset 0 1px 0 #fff;
  --inset: rgb(20 30 45 / 6%);
  --link: #2563c9;
  --accent: #2563c9;
  --accent-ink: #fff;
  --shadow: 0 4px 14px rgb(20 30 45 / 12%);
  --rain: #3a9ff0;
}
@media (prefers-color-scheme: light) {
  html[data-theme='auto'] {
      --text: #1d2430;
    --text-strong: #0e1116;
    --muted: #4f5967;
    --card-solid: #f6f7f9;
    --card: #f6f7f9;
    --surface-2: #e9ecf0;
    --glass-edge: rgb(20 30 45 / 14%);
    --glass-rim: inset 0 1px 0 #fff;
    --inset: rgb(20 30 45 / 6%);
    --link: #2563c9;
    --accent: #2563c9;
    --accent-ink: #fff;
    --shadow: 0 4px 14px rgb(20 30 45 / 12%);
    --rain: #3a9ff0;
  }
}

/* ---------- the card ---------- */

.widget {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-rim), var(--shadow);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--tint) 30%, transparent), transparent 60%),
    radial-gradient(80% 70% at 0% 100%, color-mix(in srgb, var(--tint-2) 12%, transparent), transparent 70%),
    var(--card-solid);
}
/* Graph paper under the dark card, like the site's backdrop. */
.widget::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(160deg, #000, transparent 70%);
  mask-image: linear-gradient(160deg, #000, transparent 70%);
}
html[data-theme='light'] .widget::before { opacity: 0.6; }
.widget > * { position: relative; }

.w-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.w-title { min-width: 0; }
.w-eyebrow {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme='light'] .w-eyebrow { color: #4a5a70; }
.w-eyebrow:empty { display: none; }
.w-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-strong);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.w-brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 1.75rem;
  padding: 0 0.6rem 0 0.45rem;
  border-radius: 999px;
  line-height: 1;
  border: 1px solid var(--glass-edge);
  background: color-mix(in srgb, var(--surface-2) 70%, transparent);
  color: var(--text-strong);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.w-brand .brand-mark { display: block; width: 1.05rem; height: 1.05rem; }
.w-brand b { color: var(--accent); font-weight: 600; }

/* ---------- the answer ---------- */

.w-main { display: flex; align-items: center; gap: 0.8rem; min-height: 4.6rem; }
.w-mascot { flex: none; width: 4.8rem; height: 4.6rem; }
.w-mascot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.w-mascot[hidden] + .w-score { padding-left: 0.1rem; }

/* The dial (the number) left, what it says right. Settled in round 12
   (2026-11-28): the number in a soft tint of its band with the band under
   it, as the site's forecast card does it, and the biggest thing in the
   card. */
.w-score {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.2rem 0.9rem;
}
.w-dial {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 6.6rem;
  padding: 0.55rem 0.8rem 0.5rem;
  border-radius: 16px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--fsi, var(--inset)) 16%, var(--surface-2));
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--fsi, var(--muted)) 70%, transparent);
}
.w-value {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 650;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
/* "/10" belongs to the plain number of the banner strip. */
.w-of { display: none; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.w-dial-band {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--fsi, var(--muted)) 70%, var(--text-strong));
}
.w-dial-band:empty { display: none; }
.w-score.is-empty .w-value { color: var(--muted); }

.w-says { min-width: 0; }
/* The band as a chip in its own colour: only the banner strip, which has no
   tile, shows it. */
.w-band {
  display: none;
  padding: 0.08rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 650;
  background: var(--fsi, var(--surface-2));
  color: var(--fsi-ink, var(--text));
}
.w-advice { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.32; color: var(--text-strong); }
.w-advice:empty { display: none; }
.w-source { margin: 0.25rem 0 0; font-size: 0.8rem; line-height: 1.35; color: var(--muted); }
.w-source:empty { display: none; }

/* ---------- now, high, low, rain: one line ---------- */

.w-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1.1rem;
}
.w-stats li { min-width: 0; display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.w-stats .k {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.w-stats .v {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}
/* A dot in the number's own colour: the temperature's, or the rain's blue. */
.w-stats .v i { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--dot, transparent); box-shadow: 0 0 6px var(--dot, transparent); }

/* Thin rules between, nothing round them (settled in round 12). */
.w-stats li + li { padding-left: 1.1rem; border-left: 1px solid var(--glass-edge); }

/* ---------- the bars ---------- */

.w-bars { display: grid; gap: 0.35rem; }
.w-bar-row { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.w-bar-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thick and round, as asked for: the whole window in one line each. */
.w-pill { height: 20px; cursor: crosshair; touch-action: pan-y; }
.pill {
  position: relative;
  display: block;
  min-width: 0;
  border-radius: 999px;
  overflow: hidden;
  background:
    repeating-linear-gradient(-45deg, transparent 0 4px, color-mix(in srgb, var(--text) 10%, transparent) 4px 8px),
    var(--inset);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent);
}
.pill-fill { position: absolute; inset: 0; }
.pill-past { position: absolute; top: 0; bottom: 0; left: 0; background: color-mix(in srgb, var(--card-solid) 62%, transparent); }
.pill-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--now); }
/* The margin either side of an event: travel time, hatched so it reads as
   "around it" rather than "during it". */
.pill-margin {
  position: absolute;
  top: 0;
  bottom: 0;
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--card-solid) 70%, transparent) 0 3px, color-mix(in srgb, var(--card-solid) 30%, transparent) 3px 6px);
}
.pill-range { position: absolute; top: 0; bottom: 0; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--text-strong); }
/* The hour under the pointer. */
.w-cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--text-strong); pointer-events: none; }

.w-axis { position: relative; height: 1.15rem; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.w-axis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.w-axis span.first { transform: none; }
.w-axis span.last { transform: translateX(-100%); }
.w-axis span.day { color: var(--text-strong); font-weight: 800; }

.w-readout {
  margin: 0.1rem 0 0;
  min-height: 1.3em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-strong);
}
.w-readout b { font-weight: 900; }
.w-readout .chip { display: inline-block; padding: 0 0.4rem; border-radius: 999px; font-weight: 900; background: var(--c); color: var(--c-ink); }

/* ---------- messages: too far ahead, over, warnings ---------- */

/* One dashed box, a line each (the chips were tried in round 12). */
.w-message {
  display: grid;
  gap: 0.3rem;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--text) 30%, transparent);
  background: var(--inset);
  font-size: 0.92rem;
  font-weight: 600;
}
.w-msg { display: block; }

.w-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.2rem 0.8rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted);
}
.w-more { font-weight: 800; text-decoration: none; white-space: nowrap; }
.w-more:hover { text-decoration: underline; }

/* ---------- narrow: a sidebar ---------- */
@container (max-width: 330px) {
  /* The mascot and the number side by side, what it says under both. The
     score's colours are set on .w-score and still inherit through
     display: contents. */
  .w-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.5rem 0.8rem; }
  .w-mascot[hidden] + .w-score { padding-left: 0; }
  .w-score { display: contents; }
  .w-says { grid-column: 1 / -1; }
  .w-mascot { width: 3.8rem; height: 3.8rem; }
  .w-dial { justify-self: start; }
  /* Four values as two by two. */
  html:not([data-layout='bar']) .w-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 0.8rem; }
  html:not([data-layout='bar']) .w-stats li + li { padding-left: 0; border-left: 0; }
  /* Only the mark: a round button with it in the middle. */
  .w-brand-name { display: none; }
  .w-brand { width: 1.75rem; padding: 0; }
  .w-bar-row { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .w-axis-row .w-bar-label { display: none; }
}

/* ---------- ?layout=bar: one strip for a banner ---------- */
html[data-layout='bar'] .widget {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'main bars stats';
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
}
html[data-layout='bar'] .w-head,
html[data-layout='bar'] .w-foot,
html[data-layout='bar'] .w-advice,
html[data-layout='bar'] .w-source,
html[data-layout='bar'] .w-readout,
html[data-layout='bar'] .w-axis-row,
html[data-layout='bar'] .w-message { display: none; }
html[data-layout='bar'] .w-main { grid-area: main; min-height: 0; gap: 0.5rem; }
html[data-layout='bar'] .w-mascot { width: 2.8rem; height: 2.6rem; }
html[data-layout='bar'] .w-value { font-size: 1.9rem; }
html[data-layout='bar'] .w-bars { grid-area: bars; gap: 0.25rem; }
html[data-layout='bar'] .w-pill { height: 12px; }
html[data-layout='bar'] .w-bar-row { grid-template-columns: 2.6rem minmax(0, 1fr); }
/* The strip: a plain number with "/10" and its band as a chip, the four
   values as small pills. */
html[data-layout='bar'] .w-score { display: flex; align-items: center; gap: 0.5rem; }
html[data-layout='bar'] .w-dial {
  flex-direction: row; align-items: baseline; min-width: 0; padding: 0;
  background: none; box-shadow: none; border-radius: 0;
}
html[data-layout='bar'] .w-value { color: var(--fsi, var(--text-strong)); }
/* On a light card the light index colours (amber above all) are faint as
   text: the number takes a darker shade of its band. */
html[data-theme='light'][data-layout='bar'] .w-value { color: color-mix(in srgb, var(--fsi, var(--text-strong)) 68%, #000); }
@media (prefers-color-scheme: light) {
  html[data-theme='auto'][data-layout='bar'] .w-value { color: color-mix(in srgb, var(--fsi, var(--text-strong)) 68%, #000); }
}
html[data-layout='bar'] .w-of { display: inline; font-size: 0.8rem; }
html[data-layout='bar'] .w-dial-band { display: none; }
html[data-layout='bar'] .w-band { display: inline-block; font-size: 0.8rem; }
html[data-layout='bar'] .w-band:empty { display: none; }
html[data-layout='bar'] .w-stats li + li { padding-left: 0.5rem; border-left: 1px solid var(--glass-edge); }
html[data-layout='bar'] .w-stats { grid-area: stats; flex-wrap: nowrap; gap: 0.3rem; }
html[data-layout='bar'] .w-stats li {
  flex: none; gap: 0.3rem; padding: 0.15rem 0.5rem;
  border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--inset);
}
html[data-layout='bar'] .w-stats .v { font-size: 0.95rem; }
html[data-layout='bar'] .widget::before { display: none; }
@container (max-width: 560px) {
  html[data-layout='bar'] .w-stats { display: none; }
}
