/* ==========================================================================
   BoTV — home page
   Loaded after styles.css by index.html only. Sections follow the page:
   hero, signal path, live close-ups, every screen, trust, install, dialog.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Shared pieces
   -------------------------------------------------------------------------- */

.lead {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  line-height: 1.5;
  color: var(--text-2);
  text-wrap: pretty;
}

.section-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  align-items: end;
  margin-bottom: clamp(1.75rem, 4vw, 3rem);
}

.section-head h2 {
  grid-column: 1 / span 6;
  margin: 0;
  font-size: clamp(1.7rem, 3.6vw, 3rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.section-head .lead {
  grid-column: 7 / -1;
}

.path,
.live,
.screens,
.trust,
.dl {
  padding-top: clamp(3.5rem, 9vw, 7rem);
}

.figure {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--ink-1);
}

.figure img {
  width: 100%;
  height: auto;
}

.figure::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.35);
}

h3 {
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

/* --------------------------------------------------------------------------
   1. Hero — the player on stage
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0 var(--gap);
  align-items: start;
  padding-block: clamp(1.25rem, 4vw, 3.5rem) 0;
}

.hero-title {
  grid-column: 1 / -1;
  margin: 0;
  font-size: clamp(2.7rem, 7.4vw, 6.8rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.hero-line {
  display: block;
  animation: rise 640ms var(--ease) both;
}

.hero-line:nth-child(2) {
  padding-inline-start: 0.6em;
  animation-delay: 70ms;
}

.hero-line:nth-child(3) {
  padding-inline-start: 1.2em;
  animation-delay: 140ms;
}

.hero-copy {
  grid-column: 1 / span 5;
  display: grid;
  gap: 1.5rem;
  align-content: start;
  margin-top: clamp(1.75rem, 3.5vw, 3rem);
  animation: rise 640ms var(--ease) 220ms both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.hero-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
  color: var(--text-2);
  font-weight: 600;
  text-decoration: none;
  transition: color 180ms var(--ease);
}

.hero-all:hover {
  color: var(--text);
}

.hero-all svg {
  width: 16px;
  height: 16px;
  transition: transform 200ms var(--ease);
}

.hero-all:hover svg {
  transform: translateY(2px);
}

.hero-stage {
  position: relative;
  isolation: isolate;
  grid-column: 6 / -1;
  margin: clamp(1.75rem, 3.5vw, 3rem) calc(-1 * max(var(--gutter), (100vw - 1280px) / 2)) 0 0;
  animation: stage-in 760ms var(--ease) 140ms both;
}

.hero-stage::before {
  content: "";
  position: absolute;
  inset: -22% -12% -30% -18%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(55% 55% at 55% 48%, rgba(215, 0, 43, 0.14), transparent 72%);
}

.hero-stage figcaption {
  margin-top: 0.8rem;
  padding-inline-end: var(--gutter);
}

.hero-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
}

/* A secondary button (DESIGN.md): hairline, 10px radius, white text. */
.film-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem 0.45rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms var(--ease);
}

.film-open[hidden] {
  display: none;
}

.film-open svg {
  width: 0.8rem;
  height: 0.8rem;
}

.film-open:hover {
  border-color: var(--text-2);
}

/* The one-minute film, in a dialog: fetched only when opened. */
.film {
  width: min(1100px, 100vw - 2 * var(--gutter));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.film::backdrop {
  background: rgba(5, 5, 5, 0.9);
}

.film-inner {
  position: relative;
}

.film video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  background: #000;
}

.film-close {
  position: absolute;
  top: -3.1rem;
  right: 0;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink-0);
  color: var(--text);
  cursor: pointer;
}

.film-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* --------------------------------------------------------------------------
   2. The signal path
   -------------------------------------------------------------------------- */

.path-diagram {
  display: block;
  margin-top: clamp(0.5rem, 2vw, 1.5rem);
}

.path-diagram svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.path-diagram text {
  font-family: var(--font-sans);
}

.path-label {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  fill: var(--text);
}

.path-hub-label {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  fill: var(--text-2);
}

.path-out-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  fill: var(--text);
}

.path-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.5;
}

.path-signal {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 700;
  stroke-dashoffset: 700;
  transition: stroke-dashoffset 1700ms var(--ease);
}

.path-diagram.is-drawn .path-signal {
  stroke-dashoffset: 0 !important;
}

.path-diagram.is-static .path-signal {
  transition: none;
}

.path-device {
  fill: var(--ink-1);
  stroke: var(--line-strong);
  stroke-width: 1.5;
}

.path-device-bar {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1;
}

.mark-shell {
  fill: var(--red);
}

.mark-orb {
  fill: var(--text);
}

.path-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

.path-in,
.path-out,
.path-hub-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}

.path-in {
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}

.path-in b,
.path-out b,
.path-hub-row b {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.path-hub-row {
  padding: 1.25rem 0;
  border-top: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
}

.path-thumb {
  flex: 0 0 auto;
  display: block;
  width: 96px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--ink-1);
}

.path-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.path-thumb-tv {
  aspect-ratio: 16 / 9;
}

.path-thumb-desktop {
  aspect-ratio: 16 / 10;
  border-radius: 5px;
}

.path-thumb-phone {
  width: 32px;
  aspect-ratio: 9 / 19;
  border-radius: 6px;
}

.path-thumb-phone img {
  object-position: top;
}

/* --------------------------------------------------------------------------
   3. Live TV, in close-up
   -------------------------------------------------------------------------- */

.closeups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.closeup {
  margin: 0;
}

.closeup-frame {
  /* Matches the aspect the three figures are rendered at — see
     apps/botv_app/store_assets/src/live_closeups.dart. */
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--ink-1);
}

.closeup-frame img {
  width: 100%;
  height: 100%;
  /* `contain`, and no transform: each close-up is its own render of the screen
     its caption names. This used to be a scale(2) zoom into three points of the
     single theater figure, which put an empty patch of picture under two of the
     three captions. */
  object-fit: contain;
}

.closeup figcaption {
  display: grid;
  gap: 0.45rem;
  padding-top: 1rem;
}

/* --------------------------------------------------------------------------
   4. Every screen
   -------------------------------------------------------------------------- */

.screens-figure {
  margin: 0;
}

/* TV and phone at the same height: 16:9 next to 9:20 is 320 : 81, plus the hairlines. */
.screens-pair {
  display: grid;
  grid-template-columns: 320fr 81.6fr;
  gap: var(--gap);
  align-items: start;
}

/* --------------------------------------------------------------------------
   5. Trust
   -------------------------------------------------------------------------- */

.trust-inner {
  max-width: 60ch;
  display: grid;
  gap: 1rem;
}

.trust h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 3.6vw, 3rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.trust p {
  margin: 0;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.55;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   6. Install
   The signal path ends here: one family per screen, the three screens
   standing on one line like the outputs of the diagram. Options are hairline
   rows; the visitor's own option carries the one red button, at button size.
   -------------------------------------------------------------------------- */

.dl-families {
  display: grid;
  /* TV, computer, phone: the widths follow the screens. */
  grid-template-columns: 1.4fr 1.15fr 1fr;
  grid-template-rows: auto auto 1fr;
  column-gap: calc(2 * var(--gap));
}

/* The stage floor: one hairline under the three screens, across the gaps. */
.dl-families::before {
  content: "";
  grid-row: 1;
  grid-column: 1 / -1;
  align-self: end;
  border-bottom: 1px solid var(--line-strong);
}

.dl-family {
  grid-row: 1 / span 3;
  display: grid;
  grid-template-rows: subgrid;
  min-width: 0;
}

.dl-family:nth-child(1) {
  grid-column: 1;
}

.dl-family:nth-child(2) {
  grid-column: 2;
}

.dl-family:nth-child(3) {
  grid-column: 3;
}

/* Screens at their true proportions, bottoms on the floor. The phone is as
   tall as the TV next to it: 9:20 against 16:9 in a column 1.4 / 1 wide. */
.dl-screen {
  align-self: end;
}

.dl-screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dl-screen-tv {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.dl-screen-desktop {
  width: 92%;
  aspect-ratio: 16 / 10;
}

.dl-screen-phone {
  width: 35.5%;
  aspect-ratio: 9 / 20;
}

.dl-screen-phone img {
  object-position: top;
}

.dl-family-head {
  display: grid;
  gap: 0.25rem;
  align-content: start;
  padding-top: var(--gap);
}

.dl-platforms {
  margin: 0;
  color: var(--text-3);
}

.dl-family-body {
  display: grid;
  gap: var(--gap);
  align-content: start;
  padding-top: var(--gap);
}

/* The TV installs from the TV: an address short enough for a remote. */
.dl-address {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
}

.dl-address p {
  margin: 0;
  color: var(--text-2);
}

/* Google Play on the TV is under review: say it, without a dead link. */
.dl-soon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--text-2);
}

.dl-soon-tag {
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.5;
}

.dl-address .dl-address-url {
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
}

.dl-options {
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.dl-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name action";
  column-gap: var(--gap);
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

.dl-name {
  grid-area: name;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.dl-here {
  font-weight: 400;
  color: var(--text-3);
}

.dl-action {
  grid-area: action;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  transition:
    color 180ms var(--ease),
    transform 200ms var(--ease),
    box-shadow 200ms var(--ease),
    filter 200ms var(--ease);
}

.dl-icon {
  flex: none;
  width: 18px;
  height: 18px;
  transition: transform 200ms var(--ease);
}

.dl-link:hover .dl-action {
  color: var(--text);
}

.dl-link:hover .dl-icon {
  transform: translateX(3px);
}

.dl-link[target]:hover .dl-icon {
  transform: translate(2px, -2px);
}

.dl-link:hover .dl-name > span:first-child {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

/* The one red element of the section: the visitor's own download. */
.dl-option.is-primary .dl-action {
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--glow);
}

.dl-option.is-primary .dl-link:hover .dl-action {
  transform: translateY(-1px);
  box-shadow: var(--glow-hover);
  filter: brightness(1.05);
}

/* Narrower: a ledger, one family per line, separated by a stronger rule.
   The screen shrinks to a thumbnail, the way the signal path lists its
   outputs on a phone. The visitor's own family is moved first in the DOM
   (home.js), so reading order follows the eye. */
@media (max-width: 1100px) {
  .dl-families {
    --dl-thumb: clamp(5.5rem, 12vw, 8rem);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .dl-families::before {
    display: none;
  }

  .dl-family,
  .dl-family:nth-child(n) {
    grid-row: auto;
    grid-column: auto;
    grid-template-rows: none;
    grid-template-columns: var(--dl-thumb) minmax(0, 0.75fr) minmax(0, 1.5fr);
    grid-template-areas: "screen head body";
    column-gap: calc(1.5 * var(--gap));
    align-items: start;
    padding-block: calc(1.5 * var(--gap));
    border-top: 1px solid var(--line-strong);
  }

  .dl-family:last-child {
    border-bottom: 1px solid var(--line-strong);
  }

  .dl-screen {
    grid-area: screen;
    align-self: start;
  }

  .dl-screen-tv,
  .dl-screen-desktop {
    width: 100%;
  }

  .dl-screen-phone {
    width: 28%;
    justify-self: center;
  }

  .dl-family-head {
    grid-area: head;
    padding-top: 0;
  }

  .dl-family-body {
    grid-area: body;
    padding-top: 0;
  }

  .dl-options {
    border-bottom: 0;
  }

  /* The family rule already sits above the first option. */
  .dl-family-body > .dl-options:first-child > .dl-option:first-child .dl-link {
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 720px) {
  .dl-family,
  .dl-family:nth-child(n) {
    grid-template-columns: var(--dl-thumb) minmax(0, 1fr);
    grid-template-areas:
      "screen head"
      "body body";
    row-gap: var(--gap);
    align-items: center;
  }

  .dl-family-body > .dl-options:first-child > .dl-option:first-child .dl-link {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }
}

/* --------------------------------------------------------------------------
   Embedded in the app
   -------------------------------------------------------------------------- */

body[data-view="app"] .hero-actions,
body[data-view="app"] .dl {
  display: none;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: scale(1.015);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1100px) {
  .hero-copy {
    grid-column: 1 / span 6;
  }

  .hero-stage {
    grid-column: 7 / -1;
  }
}

@media (max-width: 900px) {
  .hero-copy {
    grid-column: 1 / -1;
    max-width: 40rem;
  }

  .hero-stage {
    grid-column: 1 / -1;
    margin-inline: calc(-1 * var(--gutter));
  }

  .hero-stage figcaption {
    padding-inline: var(--gutter);
  }

  .section-head h2,
  .section-head .lead {
    grid-column: 1 / -1;
  }

  .closeups {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

}

@media (max-width: 720px) {
  .hero-title {
    font-size: clamp(2.5rem, 11.5vw, 4.4rem);
    letter-spacing: -0.04em;
  }

  .hero-line:nth-child(2),
  .hero-line:nth-child(3) {
    padding-inline-start: 0;
  }

  .hero-copy {
    margin-top: 1.5rem;
  }

  .hero-actions .btn-primary {
    width: 100%;
  }

  .path-diagram {
    display: none;
  }

  /* Side by side, the phone would be 70px wide: stack it under the TV. */
  .screens-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .screens-pair .figure:last-child {
    width: min(12rem, 55%);
  }

  .path-list {
    display: block;
    margin-top: 0.5rem;
  }
}
