/* ==========================================================================
   The Weather Channel — BarTopTV widget
   Fixed 720 x 865 canvas. Nothing scrolls, nothing reflows: every row height
   is pinned so the layout can never push into the sponsored slot below.
   ========================================================================== */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: block;
}

:root {
  /* TWC brand tokens — brandguide.weathercompany.com */
  --tw-channel-blue: #003399;
  --blue-100: #001141;
  --blue-80: #002d9c;
  --blue-60: #0f62fe;
  --cyan-40: #33b1ff;
  --teal-20: #9ef0f0;
  --orange-30: #ffb784;

  --bg: #04070f;
  --card: #0c1220;
  --card-hi: #111a2c;
  --rule: rgba(255, 255, 255, 0.09);
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.72);
  --ink-3: rgba(255, 255, 255, 0.5);

  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
}

body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------- the canvas */

.twc {
  position: relative;
  width: 720px;
  height: 865px;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #0a1526 0%, var(--bg) 62%);
  display: grid;
  grid-template-rows: 184px 60px 1fr 190px 116px 41px;
  gap: 8px;
  padding: 10px 10px 0;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  overflow: hidden;
}

/* Small caps section label with the hairline beneath it, as in the mock. */
.sec-label {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--cyan-40);
  padding: 9px 16px 7px;
  line-height: 1;
  border-bottom: 1px solid var(--rule);
}

/* ------------------------------------------------------------------- hero */

.hero {
  display: grid;
  grid-template-columns: 190px 1fr;
  grid-template-rows: 76px 1fr;
  gap: 8px;
}

.brand {
  grid-row: 1 / 3;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--rule);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 10px;
  gap: 8px;
}

/* Official artwork, placed whole. Contain, never stretch: the mark carries its
   own blue field and its own registered mark. */
.brand__logo {
  /* 85% per request, centred in what is left, so the clearspace grows rather
     than the mark shifting into a corner. */
  width: 85%;
  height: 85%;
  min-height: 0;
  margin: auto;
  object-fit: contain;
  object-position: center;
  display: block;
}

.brand__by {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.brand__by img {
  width: 100%;
  height: auto;
  display: block;
}

/* location + clock */

.place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 4px;
}

.place__name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.01em;
  min-width: 0;
}

.place__name svg {
  width: 21px;
  height: 21px;
  flex: none;
  opacity: 0.9;
}

.place__name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clock {
  text-align: right;
  flex: none;
  padding-left: 12px;
}

.clock__time {
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.clock__time small {
  font-size: 18px;
  font-weight: 400;
  margin-left: 3px;
}

.clock__date {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  margin-top: 3px;
  white-space: nowrap;
}

/* current conditions */

.now {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 18px 0 4px;
  min-width: 0;
  background: var(--card-hi);
}

.now__icon {
  width: 94px;
  height: 94px;
  flex: none;
}

.now__temp {
  font-size: 68px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.now__temp sup {
  font-size: 0.44em;
  vertical-align: super;
  line-height: 0;
}

.now__phrase {
  font-size: 21px;
  font-weight: 400;
  color: var(--ink);
  margin-top: 3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now__feels {
  margin-left: auto;
  font-size: 16px;
  color: var(--ink-2);
  text-align: right;
  white-space: nowrap;
  flex: none;
}

/* ---------------------------------------------------------- metrics strip */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
}

.metric {
  display: grid;
  justify-items: center;
  gap: 2px;
  border-left: 1px solid var(--rule);
  padding: 0 6px;
}

.metric:first-child {
  border-left: 0;
}

.metric__value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.15;
}

.metric__value img {
  width: 19px;
  height: 19px;
  opacity: 0.92;
}

.metric__label {
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ------------------------------------------------------------ next 4 hours */

.hours {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hours__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  padding: 4px 0;
}

.hour {
  display: grid;
  justify-items: center;
  gap: 1px;
  border-left: 1px solid var(--rule);
}

.hour:first-child {
  border-left: 0;
}

.hour__label {
  font-size: 16px;
  line-height: 1;
  color: var(--ink-2);
  white-space: nowrap;
}

.hour__icon {
  width: 64px;
  height: 64px;
}

.hour__temp {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  white-space: nowrap;
}

.hour__pop {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}

.hour__pop img {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}

.narrative {
  display: flex;
  align-items: center;
  gap: 11px;
  border-top: 1px solid var(--rule);
  padding: 6px 16px;
  height: 52px;
}

.narrative__icon {
  width: 36px;
  height: 36px;
  flex: none;
}

.narrative p {
  font-size: 15px;
  line-height: 1.28;
  color: var(--ink);
  /* clamp to two lines; balance so we never strand a single word */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-wrap: pretty;
}

/* ------------------------------------------------------- sunrise & sunset */

.sun {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.sun__body {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 320px 1fr;
  align-items: center;
  padding: 0 16px;
  height: 96px;
}

/* soft dawn glow under the arc, built from brand evening-sky colors */
.sun__glow {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 320px;
  height: 40px;
  background: radial-gradient(
    60% 150% at 50% 100%,
    rgba(255, 183, 132, 0.55) 0%,
    rgba(255, 183, 132, 0.16) 45%,
    transparent 78%
  );
  pointer-events: none;
}

.sun__edge {
  display: grid;
  gap: 1px;
  justify-items: center;
}

.sun__edge--rise {
  justify-items: center;
}

.sun__edge h4 {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
}

.sun__edge strong {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sun__edge svg {
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.sun__arc {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sun__arc svg {
  width: 320px;
  height: 96px;
  display: block;
}

.sun__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  height: 60px;
  align-items: center;
}

.sun__stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-left: 1px solid var(--rule);
}

.sun__stat:first-child {
  border-left: 0;
}

.sun__stat svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.sun__stat div {
  min-width: 0;
}

.sun__stat span {
  display: block;
  font-size: 14px;
  color: var(--ink-3);
  white-space: nowrap;
}

.sun__stat strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
}

/* ------------------------------------------------------------- the insight */

.insight {
  display: grid;
  grid-template-columns: 206px 1fr;
  background: linear-gradient(100deg, #0b1a3a 0%, #0a1730 100%);
  border-color: rgba(51, 177, 255, 0.22);
}

.insight__art {
  position: relative;
  overflow: hidden;
  /* Venue photo when the operator passes ?art=, otherwise a warm brand-built
     placeholder rather than an empty grey box. */
  background:
    linear-gradient(0deg, rgba(255, 183, 132, 0.42) 0%, transparent 34%),
    linear-gradient(168deg, #2a5a8f 0%, #123055 46%, #060e18 100%);
  background-size: cover;
  background-position: center;
}

.insight__text {
  padding: 9px 18px 9px 16px;
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
}

.insight__eyebrow {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  line-height: 1.2;
  color: var(--ink-2);
}

.insight__headline {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.14;
  text-wrap: balance;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insight__support {
  font-size: 18px;
  color: var(--ink);
  line-height: 1.22;
  text-wrap: balance;
}

.insight__foot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  color: var(--ink-2);
  margin-top: 1px;
}

.insight__foot img {
  width: 19px;
  height: 19px;
  opacity: 0.9;
}

/* ------------------------------------- map tiles in the insight card ----- */

.radar__grid {
  position: absolute;
  width: 768px;
  height: 768px;
  transform-origin: 0 0;
  display: grid;
  grid-template-columns: repeat(3, 256px);
  grid-template-rows: repeat(3, 256px);
}

.radar__cell {
  position: relative;
  width: 256px;
  height: 256px;
}

.radar__cell img {
  position: absolute;
  inset: 0;
  width: 256px;
  height: 256px;
  display: block;
}

.radar__cell img.base {
  filter: saturate(0.45) brightness(0.6) contrast(1.05);
}

.radar__cell img.frame {
  opacity: 0;
  mix-blend-mode: screen;
}

.radar__cell img.frame.is-on {
  opacity: 1;
}

.radar__dot {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2b7fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(43, 127, 255, 0.35);
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}

/* ---------------------------------------------------------------- footer */

.footer {
  margin: 0 -10px;
  background: var(--tw-channel-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 24px;
}

.footer__url {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.footer__div {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.34);
}

.footer__powered {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.94);
  white-space: nowrap;
}

/* Fixed height, auto width, no box, no recolour. Brand rules forbid boxing,
   stretching or re-typesetting the wordmark, and require clearspace of one
   Drop-height on every side. */
.footer__wordmark {
  height: 23px;
  width: auto;
  display: block;
}

/* ------------------------------------------------------- states + a11y */

/* A field we could not source is hidden outright rather than shown empty. */
[hidden] {
  display: none !important;
}

.twc--error .twc__fallback {
  display: flex;
}

.twc__fallback {
  position: absolute;
  inset: 0;
  /* cancel the canvas padding so the footer bar cannot peek out at the edges */
  margin: -10px -10px 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  text-align: center;
  padding: 40px;
  z-index: 5;
}

.twc__fallback p {
  font-size: 20px;
  color: var(--ink-2);
  max-width: 460px;
  line-height: 1.4;
}
