/* GrowthMotif v4 — finale (footer), paper look. Scoped to .gm-finale. */

.gm-finale {
  --gm-finale-pad: var(--gutter-l, clamp(16px, 3.2vw, 48px));
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(56px, 11vh, 128px) var(--gm-finale-pad) calc(16px + env(safe-area-inset-bottom, 0px));   /* the legal line clears a phone's home indicator */
  background: transparent;
  color: var(--ink);
  font-family: var(--f-display);
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  overflow: hidden;
  isolation: isolate;
}
.gm-finale *,
.gm-finale *::before,
.gm-finale *::after { box-sizing: border-box; }
.gm-finale-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }

/* ---------- ask ---------- */
.gm-finale-ask {
  margin: 0 0 clamp(28px, 5vh, 52px);
  max-width: 21ch;
  font-family: var(--f-display);
  font-size: var(--fs-h1, clamp(1.8rem, 3.8vw, 3.2rem));
  font-weight: 400;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  line-height: 1.08;
  letter-spacing: -0.018em;
  color: var(--ink);
  text-wrap: balance;
}

/* ---------- email ---------- */
.gm-finale-emailrow {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  align-self: stretch;
  margin: 0 0 clamp(40px, 7vh, 80px);
  max-width: 100%;
}
.gm-finale > .gm-finale-email { margin: 0 0 clamp(40px, 7vh, 80px); }
.gm-finale-email {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 4px 0 7px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-family: var(--f-display);
  font-size: var(--fs-h3, clamp(1.2rem, 2.2vw, 1.7rem));
  font-weight: 500;
  font-optical-sizing: auto;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: text;
  user-select: text;
}
.gm-finale-email::before,
.gm-finale-email::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
/* a hairline rule, and a yellow marker stroke that draws across on hover */
.gm-finale-email::before { bottom: 0; height: 1px; background: var(--ink); opacity: 0.35; }
.gm-finale-email::after {
  bottom: -1px;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);
}
.gm-finale-email:hover::after,
.gm-finale-email:focus-visible::after,
.gm-finale-email.is-copied::after {
  transform: scaleX(1);
  transform-origin: left center;
}
.gm-finale-email:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 6px;
  border-radius: 2px;
}
.gm-finale-email-txt { display: inline-block; }

.gm-finale-mailto {
  font-family: var(--f-display);
  font-size: var(--fs-small, 0.9rem);
  letter-spacing: -0.004em;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--glyph);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.gm-finale-mailto:hover { color: var(--ink); text-decoration-color: currentColor; }
.gm-finale-mailto:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

.gm-finale-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- rubber stamp ---------- */
.gm-finale-stamp {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: block;
  padding: 0.42em 0.95em 0.46em;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: var(--fs-body, 1rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.92;
  mix-blend-mode: multiply;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}
.gm-finale-stamp::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ink);
  border-radius: 6px;
}

/* ---------- clocks ---------- */
.gm-finale-clocks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 15rem));
  gap: 0 clamp(12px, 2.6vw, 36px);
  width: 100%;
  max-width: 52rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gm-finale-clocks li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: var(--fs-label, 12px);
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.gm-finale-city {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
}
.gm-finale-city-name { overflow: hidden; text-overflow: ellipsis; }
.gm-finale-off { flex: none; color: var(--muted); opacity: 0.8; }
.gm-finale-time {
  font-family: var(--f-mono);
  font-size: clamp(19px, 1.9vw, 25px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}
.gm-finale-colon { display: inline-block; transition: opacity 0.14s ease; }
.gm-finale--js.is-onscreen .gm-finale-clocks li.is-tick .gm-finale-colon { opacity: 0.2; }
.gm-finale-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.4s ease;
}
.gm-finale-clocks li.is-awake .gm-finale-state { color: var(--ink); }
.gm-finale-clocks li.is-asleep .gm-finale-state { color: var(--muted); }

/* seed-head glyph: awake = turning slowly with a yellow heart; asleep = still and grey */
.gm-finale-seed {
  flex: none;
  width: 17px;
  height: 17px;
  overflow: visible;
}
.gm-finale-seed-spin {
  transform-box: view-box;
  transform-origin: 0 0;   /* the viewBox is centred on 0,0, so the user-space origin is the middle of the glyph */
}
.gm-finale-seed-dot { fill: var(--ink); transition: fill 0.4s ease; }
.gm-finale-seed-heart { fill: var(--accent); stroke: var(--ink); stroke-width: 0.55; transition: fill 0.4s ease, stroke 0.4s ease; }
.gm-finale-clocks li.is-awake .gm-finale-seed-spin { animation: gm-finale-turn 16s linear infinite; animation-play-state: paused; }
.gm-finale.is-onscreen .gm-finale-clocks li.is-awake .gm-finale-seed-spin { animation-play-state: running; }
.gm-finale-clocks li.is-asleep .gm-finale-seed { opacity: 0.6; }
.gm-finale-clocks li.is-asleep .gm-finale-seed-dot { fill: var(--muted); }
.gm-finale-clocks li.is-asleep .gm-finale-seed-heart { fill: var(--glyph); stroke: var(--muted); }
@keyframes gm-finale-turn { to { transform: rotate(360deg); } }

/* ---------- wordmark: heavy wooden type ---------- */
.gm-finale-word {
  position: relative;
  z-index: 2;
  /* the wordmark is fitted to this box by the script, so the box sets its size: full width on a phone, at most 640px
     wide elsewhere, set against the right edge. The letters still drop, pile up and get carried home inside it. */
  align-self: flex-end;
  width: min(100%, 640px);
  margin-top: auto;
  padding-top: clamp(12px, 2.5vh, 32px);   /* tight, so the whole footer fits one laptop screen with the city tiles in */
  font-family: var(--f-display);
  font-weight: 600;
  font-variation-settings: "opsz" 144, "SOFT" 20, "WONK" 0;
  /* CSS fallback fit: (viewport - side padding) / measured em-width of the word */
  font-size: calc(min(100vw - 2 * var(--gm-finale-pad), 640px) / 4.95);
  letter-spacing: -0.03em;
  line-height: 0.82;
  white-space: nowrap;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.gm-finale-wordrow { display: inline-block; white-space: nowrap; }
.gm-finale-ch {
  display: inline-block;
  -webkit-user-select: none;
  user-select: none;
  backface-visibility: hidden;
}
.gm-finale-ch--accent {
  color: var(--accent);
}
.gm-finale-ch--it { font-style: italic; }
.gm-finale-base { display: inline-block; width: 0; height: 0; }
.gm-finale.is-live .gm-finale-ch { will-change: transform; }

/* agents: small tagged cursors that carry the fallen letters home */
.gm-finale-agent {
  position: absolute; left: 0; top: 0; z-index: 3;
  display: flex; align-items: flex-start; gap: 2px;
  pointer-events: none;
  opacity: 0; transition: opacity .4s ease;
  will-change: transform;
  font-size: 0; letter-spacing: 0; line-height: 1;
}
.gm-finale-agent.is-on { opacity: 1; }
.gm-finale-agent svg { width: 12px; height: 18px; flex: none; overflow: visible; }
.gm-finale-agent path { fill: var(--agent, var(--ink)); stroke: var(--paper); stroke-width: 1.2; stroke-linejoin: round; }
.gm-finale-agent i {
  margin-top: 13px; padding: 0 5px; border-radius: 4px;
  font-family: var(--f-mono); font-style: normal; font-weight: 500; font-size: 11px; line-height: 1.6;
  background: var(--agent, var(--ink)); color: var(--paper); white-space: nowrap;
}
@media (max-width: 700px) { .gm-finale-agent i { display: none; } }

/* the contact page's footer: only the clocks and the wordmark, so it takes its own height, not a full screen */
.gm-finale.gm-finale--short { min-height: 0; padding-top: clamp(48px, 8vh, 88px); }

/* ---------- legal ---------- */
.gm-finale-legal {
  align-self: stretch;
  margin: clamp(12px, 1.8vh, 18px) 0 0;
  font-family: var(--f-display);
  font-size: var(--fs-small, 0.9rem);
  letter-spacing: -0.004em;
  line-height: 1.45;
  color: var(--muted);
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 4px 28px;   /* kept left, clear of the f's tail */
}

/* ---------- phone ---------- */
@media (max-width: 560px) {
  .gm-finale { padding-top: clamp(48px, 9vh, 88px); }
  .gm-finale-clocks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
  .gm-finale-clocks li { font-size: 11px; }
  .gm-finale-time { font-size: 19px; }
  .gm-finale-off { display: none; }
}
@media (max-width: 300px) {
  .gm-finale-clocks { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
}

/* ---------- reduced motion: the finished, still page ---------- */
@media (prefers-reduced-motion: reduce) {
  .gm-finale .gm-finale-seed-spin { animation: none !important; }
  .gm-finale-email::after { transition: none; }
}
.gm-finale--reduced .gm-finale-seed-spin { animation: none !important; }
.gm-finale--reduced .gm-finale-email::after { transition: none; }

/* the label that says these cities are where the team is */
.gm-finale-where { margin: 0 0 14px; font-family: var(--f-display); font-size: var(--fs-body, 1.05rem); font-weight: 450; letter-spacing: -0.006em; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.gm-finale-where::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px var(--ink); flex: none; }

/* ---------- clocks: one shared set of rows ----------
   Each city's four lines (name, time, status, weather) sit on rows shared by all three cities. A status that wraps to
   two lines in one city ("Asleep. The agents aren't.") now makes that row taller for every city, so the weather lines
   stay level with each other. Without subgrid support the cities fall back to independent columns, as before. */
@supports (grid-template-rows: subgrid) {
  .gm-finale-clocks { grid-template-rows: repeat(4, auto); row-gap: 6px; }
  .gm-finale-clocks li { display: grid; grid-template-rows: subgrid; grid-row: span 4; align-items: start; }
  @media (max-width: 300px) { .gm-finale-clocks { row-gap: 6px; } }
}

/* browsers without subgrid: reserve two lines for the status, so the weather lines still match in the usual case */
@supports not (grid-template-rows: subgrid) {
  .gm-finale-clocks .gm-finale-state { min-height: 2.5em; align-items: flex-start; }
}

/* ---------- city tiles (tiles.js): a dithered photo of each city above its clock ----------
   Drawn at 104 x 72 and enlarged without smoothing, so every dot stays a crisp square. With the tiles in, each city takes
   a fifth shared row. The night-shift chip is placed from the top of the city block, so it moves down by the tile. */
.gm-finale-tile { display: block; width: min(100%, var(--gm-tile-w, var(--gm-tile-max))); height: auto; aspect-ratio: 104 / 72; margin-bottom: 6px; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
/* the tiles are a small touch beside each clock, not the subject: about 128px wide, about 90px on a phone */
.gm-finale-clocks { --gm-tile-max: 128px; }
@media (max-width: 560px) { .gm-finale-clocks { --gm-tile-max: 90px; } }
@supports (grid-template-rows: subgrid) {
  .gm-finale-clocks.has-tiles { grid-template-rows: repeat(5, auto); }
  .gm-finale-clocks.has-tiles li { grid-row: span 5; }
}
.gm-finale .gm-finale-clocks li.has-tile .gm-status--night { top: calc(var(--gm-tile-shift, 0px) + 23px); }
@media (max-width: 560px) { .gm-finale .gm-finale-clocks li.has-tile .gm-status--night { top: calc(var(--gm-tile-shift, 0px) + 17px); } }

/* ---------- the close in two groups ----------
   Group one is the ask and the two ways to answer it: the button and the address on one row, level with each other.
   Group two is where the team is. The gap between the groups is about three times the gaps inside them. */
.gm-finale.has-actions .gm-finale-ask { margin-bottom: clamp(26px, 4.4vh, 44px); }
.gm-finale-actions {
  display: flex; flex-wrap: wrap; align-items: center; align-self: stretch;
  gap: 18px clamp(24px, 3vw, 40px);
  margin: 0 0 clamp(36px, 6vh, 64px);
}
.gm-finale .gm-finale-actions .gm-finale-cta { margin: 0; flex: none; }
.gm-finale .gm-finale-actions .gm-finale-emailrow { margin: 0; flex: 1 1 auto; min-width: 0; align-self: center; }
.gm-finale.has-actions .gm-finale-where { margin-top: auto; margin-bottom: 18px; }

/* ---------- phone: one row per city ----------
   At 560px and under the three cities stack. Each is a two-column, two-row grid: name and time on the left,
   status and weather on the right. The night chip sits at the bottom right. Comes last so it beats the rules above. */
@media (max-width: 560px) {
  .gm-finale-clocks,
  .gm-finale-clocks.has-tiles { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; gap: 16px 0; }
  .gm-finale-clocks li,
  .gm-finale-clocks.has-tiles li {
    display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); grid-template-rows: auto auto; grid-row: auto;
    column-gap: 12px; row-gap: 6px; align-items: start; font-size: 12px;
  }
  .gm-finale-clocks .gm-finale-tile { display: none; }
  .gm-finale-clocks .gm-finale-city { grid-column: 1; grid-row: 1; }
  .gm-finale-clocks .gm-finale-time { grid-column: 1; grid-row: 2; font-size: 19px; }
  .gm-finale-clocks .gm-finale-state { grid-column: 2; grid-row: 1; min-height: 0; align-items: center; }
  .gm-finale-clocks .gm-weather { grid-column: 2; grid-row: 2; }
  .gm-finale-clocks .gm-weather[hidden] { display: none; }
  .gm-finale .gm-finale-clocks li .gm-status--night,
  .gm-finale .gm-finale-clocks li.has-tile .gm-status--night { top: auto; bottom: 0; right: 0; }
}
