/* ============================================================
   Xweather demos index
   ------------------------------------------------------------
   Palette, type and card anatomy are taken from xweather.com —
   measured off the industry-page card grid rather than guessed:

     section ground   #f2f4f6   (black-50)
     card             #ffffff   flat: no border, no shadow
     card radius      8px
     card padding     24px
     grid gap         24px
     heading / title  #09151c   (black-900)
     body copy        #2d3b56   (black-500)
     muted            #556079   (black-400)
     card title       20px / 1.4, weight 400
     card body        16px / 1.5
     link affordance  14px label + 36px ring holding a 14px arrow

   Vaisala Sans ships Light (300), Regular (400) and Bold (700) —
   there is no Medium (500), so nothing here asks for one and the
   browser is never left to synthesize a face.
   ============================================================ */

/* --- FONT FACES ------------------------------------------------ */

@font-face {
  font-family: 'Vaisala Sans';
  src: url('fonts/VaisalaSans_Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vaisala Sans';
  src: url('fonts/VaisalaSans_Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vaisala Sans';
  src: url('fonts/VaisalaSans_Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- TOKENS ---------------------------------------------------- */

:root {
  /* xweather.com neutral ramp */
  --black-0: #ffffff;
  --black-50: #f2f4f6;
  --black-100: #d9e0e6;
  --black-200: #a6b3c0;
  --black-300: #7d899c;
  --black-400: #556079;
  --black-500: #2d3b56;
  --black-700: #1b2336;
  --black-800: #121b25;
  --black-900: #09151c;

  --ground: var(--black-50);
  --surface: var(--black-0);

  --text-heading: var(--black-900);
  --text-body: var(--black-500);
  --text-muted: var(--black-400);

  --mint: #d3ebea; /* mistry-green-300 — the site's primary action colour */

  --rule: var(--black-100);
  --ring: #e7e8e9; /* the arrow ring — decorative, meaning sits in the label */

  --font-sans: 'Vaisala Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --radius: 8px;
  --card-padding: 24px;
  --grid-gap: 24px;

  --container: 1920px;
  --margin: 60px;
  --margin-sm: 24px;

  --ease: cubic-bezier(0.2, 0, 0, 1);

  color-scheme: light;
}

/* --- BASE ------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2 {
  margin: 0;
  color: var(--text-heading);
}

p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--black-900);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--black-100);
  color: var(--black-900);
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--margin);
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--margin-sm);
  inset-block-start: var(--margin-sm);
  z-index: 20;
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--black-0);
  text-decoration: none;
  background: var(--black-900);
  border-radius: 4px;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --- HEADER ---------------------------------------------------- */

/* No ground or rule of its own — the masthead reads as the top of the page
   rather than as a bar sitting on it. */
.masthead {
  background: transparent;
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding-block: 12px;
}

.masthead__logo {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  color: var(--black-900);
  text-decoration: none;
}

.masthead__logo svg {
  height: 32px;
  width: auto;
  fill: currentColor;
}

.masthead__nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-inline-start: auto;
}

.masthead__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 120ms ease;
}

.masthead__nav a:hover {
  color: var(--black-900);
}

/* Primary action, matching xweather.com: Misty Green carrying Xweather Black
   (14.8:1). White on Ember — the design system's stated pairing — measures
   3.01:1 and fails AA at this size. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--black-0);
  background: var(--black-900);
  border-radius: var(--radius);
  text-decoration: none;
  transition: background-color 200ms var(--ease);
}

.btn:hover {
  background: var(--mint);
  color: var(--black-900);
}

/* The button is its own affordance — it must not pick up the nav link's
   muted colour or hover. */
.masthead__nav .btn {
  color: var(--black-0);
}

/* --- PAGE INTRO ------------------------------------------------ */

/* Headline left, standfirst set into the trailing columns — the same
   split the industry pages use above their card grids. */
.intro {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: 24px;
  padding-block: 72px 48px;
}

.intro h1 {
  grid-column: 1 / 8;
  font-size: clamp(2rem, 4.4vw, 3.5rem);
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro__standfirst {
  grid-column: 8 / 12;
  align-self: end;
  text-wrap: pretty;
}

/* --- CARD GRID -------------------------------------------------- */

.demos {
  padding-block-end: 96px;
}

.demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--grid-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-grid > li {
  display: flex;
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition-property: box-shadow;
  transition-duration: 200ms;
  transition-timing-function: var(--ease);
}

.card:hover {
  box-shadow: 0 2px 4px rgb(9 21 28 / 0.04), 0 8px 24px rgb(9 21 28 / 0.08);
}

.card__shot {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--black-800);
}

/* <picture> is inline by default, which leaves the image with no definite
   height to resolve against in the full-height featured layout. */
.card__shot picture {
  display: block;
  width: 100%;
  height: 100%;
}

.card__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition-property: scale;
  transition-duration: 500ms;
  transition-timing-function: var(--ease);
}

.card:hover .card__shot img {
  scale: 1.05;
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--card-padding);
}

.card__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text-heading);
  text-wrap: pretty;
}

.card__text {
  margin-block-start: 12px;
  color: var(--text-body);
  text-wrap: pretty;
}

/* The products a demo is built on, set above the title as quiet metadata
   so the action at the foot of the card can just say what it does. */
.card__meta {
  margin-block-end: 8px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Pinned to the bottom so a row of cards shares one action baseline
   regardless of how long the copy above it runs. */
.card__cta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-block-start: auto;
  padding-block-start: 32px;
  font-size: 0.875rem;
  color: var(--text-heading);
}

.card__arrow {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ring);
  border-radius: 50%;
  transition-property: background-color, border-color;
  transition-duration: 200ms;
  transition-timing-function: var(--ease);
}

.card__arrow svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 200ms var(--ease);
}

.card:hover .card__arrow {
  background: var(--black-900);
  border-color: var(--black-900);
}

.card:hover .card__arrow svg {
  stroke: var(--black-0);
}

@media (min-width: 40rem) {
  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Three-up is the widest the grid goes: five demos sit under the featured
   card as 3 + 2, which leaves one gap. Four-up would leave three. */
@media (min-width: 68rem) {
  .demo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- FEATURED CARD ---------------------------------------------- */

/* Spans the grid. DOM order stays shot-then-body like every other card, so
   the stacked layout and the reading order match; row-reverse moves the
   preview to the trailing side once there is room for two columns. */
.demo-grid > li.is-featured {
  grid-column: 1 / -1;
}

/* Splits into two columns only once the grid itself is three-up. Below that
   the trailing text column would be narrower than a regular card's, which
   makes the featured card read as the cramped one. */
@media (min-width: 68rem) {
  .is-featured .card {
    flex-direction: row-reverse;
    align-items: stretch;
    min-height: 380px;
  }

  /* Left to its own 16:10 the preview drives the card past 600px tall at the
     widest container, stranding the copy in the middle of an empty column.
     A 2:1 window keeps the card in the 380-500px range and crops the map,
     which it takes well. */
  .is-featured .card__shot {
    flex: 1 1 56%;
    aspect-ratio: 2 / 1;
  }

  .is-featured .card__body {
    flex: 1 1 44%;
    justify-content: center;
    padding: 48px;
  }

  .is-featured .card__title {
    font-size: clamp(1.75rem, 2.2vw, 2.75rem);
    font-weight: 300;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }

  .is-featured .card__text {
    margin-block-start: 16px;
    max-width: 46ch;
    font-size: 1.0625rem;
  }

  .is-featured .card__cta {
    margin-block-start: 0;
    padding-block-start: 32px;
  }
}

/* --- FOOTER ---------------------------------------------------- */

.site-footer {
  padding-block: 32px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-footer p {
  font-variant-numeric: tabular-nums;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration-line: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-color: var(--black-200);
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.site-footer a:hover {
  color: var(--black-900);
  text-decoration-color: currentColor;
}

/* --- RESPONSIVE ------------------------------------------------ */

@media (max-width: 68rem) {
  :root {
    --margin: 40px;
  }

  /* Standfirst drops under the headline before the grid reflows. */
  .intro h1 {
    grid-column: 1 / -1;
  }

  .intro__standfirst {
    grid-column: 1 / -1;
    max-width: 62ch;
  }
}

@media (max-width: 40rem) {
  :root {
    --margin: var(--margin-sm);
  }

  .intro {
    padding-block: 40px 32px;
  }

  .demos {
    padding-block-end: 56px;
  }

  .masthead__inner {
    gap: 16px;
  }

  .masthead__nav {
    gap: 16px;
  }
}

@media (max-width: 28rem) {
  .masthead__inner {
    flex-wrap: wrap;
    row-gap: 4px;
    padding-block: 16px 8px;
  }

  .masthead__nav {
    width: 100%;
    margin-inline-start: 0;
    justify-content: flex-start;
  }

  .masthead__nav a {
    font-size: 0.8125rem;
  }
}

/* --- MOTION PREFERENCES ---------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
  }

  .card:hover .card__shot img {
    scale: 1;
  }
}
