/* Colours and type taken from seekglobal.co: black and white, one orange accent, Raleway for text and STIX Two Text
   for headlines. */
:root {
  --black: #000;
  --cod-gray: #1a1a1a;
  --mine-shaft: #272626;
  --boulder: #757575;
  --silver-chalice: #ababab;
  --white: #fff;
  --orange: #ff6a00;
  --flamenco: #ff7608;
  --tenn: #c95d00;
  --peach: #ffe8d4;

  --font-base: 'Raleway', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'STIX Two Text', Georgia, 'Times New Roman', serif;
}

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

html {
  color-scheme: dark;
  background: var(--black);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) var(--black);
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--white);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
}

.noscript {
  margin: 0;
  padding: 16px;
  text-align: center;
  color: var(--silver-chalice);
}

/* ---------- the section ----------
   The title on top, then the stage with the face and the ten slots. The canvas covers the whole section under the
   content. Portrait first: five slots above the face, five below it; landscape (aspect >= 1): five in a column left
   of the face, five right of it. */
.ai-face {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 80px 0 0;
  overflow: hidden;
  background-color: var(--black);
}

/* the face is the section's backface: under the slots and the text, never catching the pointer */
.ai-face__canvas-host {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ai-face__canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 800ms ease;
}

.ai-face__canvas_visible {
  opacity: 1;
}

.ai-face__head {
  position: relative;
  z-index: 1;
  flex: none;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

.ai-face__eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
}

.ai-face__title {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--white);
}

.ai-face__lead {
  margin: 0;
  max-width: 760px;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.6;
  color: var(--silver-chalice);
}

.ai-face__stage {
  position: relative;
  z-index: 1;
  /* a zero basis, not auto: under size containment an auto basis is the empty content, and the container units
     inside would resolve against an indefinite height (0) */
  flex: 1 0 0px;
  min-height: 620px;
  /* the face box and the slot columns size to the stage */
  container-type: size;
  display: grid;
  grid-template-columns: 100%;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  row-gap: 16px;
  padding: 0 12px 40px;
}

/* the face box: the renderer stretches the face oval to it. Until the canvas draws (and for good without WebGL) a
   soft orange glow in the shape of the face stands in for it. */
.ai-face__oval {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  width: min(72cqw, 36cqh);
  aspect-ratio: 0.74;
}

.ai-face__oval::before {
  content: '';
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse at 50% 42%,
      rgba(255, 106, 0, 0.28),
      rgba(255, 106, 0, 0.08) 55%,
      transparent 72%
    );
  box-shadow: inset 0 0 0 1px rgba(255, 118, 8, 0.25);
  opacity: 1;
  transition: opacity 800ms ease;
  pointer-events: none;
}

.ai-face_live .ai-face__oval::before {
  opacity: 0;
}

.ai-face__slots {
  display: flex;
  flex-direction: row;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-face__slots_first {
  grid-row: 1;
  align-items: flex-end;
}

.ai-face__slots_second {
  grid-row: 3;
  align-items: flex-start;
}

.ai-face__slot {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* the slots share the row evenly, but a slot whose longest word is wider takes what it needs instead of breaking
     the word */
  min-width: min-content;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  transition: color 400ms ease;
}

/* above the face the icon is at the bottom, next to the face */
.ai-face__slots_first .ai-face__slot {
  flex-direction: column-reverse;
}

.ai-face__slot[data-lit='true'] {
  color: var(--white);
}

.ai-face__slot-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  transition:
    box-shadow 400ms ease,
    border-color 400ms ease,
    color 400ms ease;
}

.ai-face__slot-icon svg {
  width: 18px;
  height: 18px;
}

.ai-face__slot[data-lit='true'] .ai-face__slot-icon {
  color: var(--orange);
  box-shadow:
    0 0 14px rgba(255, 106, 0, 0.55),
    inset 0 0 8px rgba(255, 232, 212, 0.3);
}

.ai-face__slot-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  /* the floor for reading on a phone */
  font-size: 12px;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.ai-face__slot-full {
  display: none;
}

.ai-face__slot-frontier {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  opacity: 0.9;
}

/* full names from 768 px wide */
@media (min-width: 768px) {
  .ai-face__slot-full {
    display: inline;
  }

  .ai-face__slot-short {
    display: none;
  }

  .ai-face__slot-label {
    font-size: 13px;
  }
}

@media (min-aspect-ratio: 1/1) {
  .ai-face__stage {
    min-height: 480px;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: 100%;
    /* room for the strands to leave the face and fan in to the icons */
    column-gap: max(56px, 8cqw);
    padding: 0 3vw 40px;
  }

  /* the face is the section's main subject: a little taller than the stage (the line rows reach ~5 % beyond the box,
     into the headline's bottom margin and the stage's padding), the slot columns stay within 82 % of it */
  .ai-face__oval {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    height: min(104cqh, 58cqw);
  }

  .ai-face__slots {
    grid-row: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    max-width: 320px;
    height: min(82cqh, 100%);
  }

  .ai-face__slots_first {
    grid-column: 1;
    justify-self: end;
    align-items: flex-end;
  }

  .ai-face__slots_second {
    grid-column: 3;
    justify-self: start;
    align-items: flex-start;
  }

  .ai-face__slot {
    flex: none;
    flex-direction: row;
    gap: 12px;
    text-align: left;
  }

  /* left of the face the icon is on the right, next to the face */
  .ai-face__slots_first .ai-face__slot {
    flex-direction: row-reverse;
    text-align: right;
  }

  .ai-face__slot-label {
    font-size: 13px;
  }
}

@media (min-aspect-ratio: 1/1) and (min-width: 1280px) {
  .ai-face__slot-label {
    font-size: 15px;
  }

  .ai-face__slot-icon {
    width: 40px;
    height: 40px;
  }

  .ai-face__slot-icon svg {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-face__canvas,
  .ai-face__slot,
  .ai-face__slot-icon,
  .ai-face__oval::before {
    transition: none;
  }
}
