/* Where Cody lends: offices + licensed footprint.
   Tile map is built by partials/reach.js from the license list in index.html. */

.reach {
  --reach-ink: rgba(242, 238, 228, .62);
  --reach-rule: rgba(242, 238, 228, .16);
  --reach-tile-line: rgba(242, 238, 228, .5);   /* 4.1:1 on forest: not-licensed edges must read */
  --reach-none-ink: rgba(242, 238, 228, .66);   /* 5.3:1 on the not-licensed wash */
  --reach-home: color-mix(in srgb, var(--clay) 92%, #000);   /* white "WA" label: 4.8:1 (plain clay is 4.2:1) */
  position: relative;
  padding: clamp(96px, 12vw, 176px) var(--page-x) clamp(80px, 10vw, 150px);
  overflow: hidden;
  color: var(--cream);
  background: var(--forest);
  isolation: isolate;
}

.reach::before {
  position: absolute;
  top: -12%;
  left: -18%;
  z-index: -1;
  width: 62%;
  aspect-ratio: 1;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, rgba(196, 93, 61, .13), transparent 62%);
}

.reach-top {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: clamp(56px, 7vw, 128px);
}

/* Copy + figure */

.reach-copy .eyebrow {
  margin-bottom: 26px;
  color: rgba(242, 238, 228, .55);
}

.reach-copy h2 {
  max-width: 13em;
  margin: 0;
  font-size: clamp(36px, 3.7vw, 58px);
  letter-spacing: -.035em;
  line-height: 1.02;
}

.reach-figure {
  margin: clamp(40px, 5vw, 72px) 0 clamp(28px, 3vw, 40px);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--reach-rule);
}

.reach-figure__mark {
  display: flex;
  align-items: flex-start;
  gap: .14em;
  margin: 0;
  font-family: var(--serif);
  line-height: .8;
}

.reach-figure__num {
  display: inline-grid;
  font-size: clamp(148px, 16.5vw, 268px);
  letter-spacing: -.055em;
}

.reach-figure__num > span {
  grid-area: 1 / 1;
}

.reach-figure__ghost {
  visibility: hidden;
}

.reach-figure__dc {
  margin-top: .32em;
  color: var(--clay);
  font-size: clamp(40px, 4.3vw, 70px);
  font-style: italic;
  letter-spacing: -.02em;
  white-space: nowrap;
  transition: opacity .7s var(--ease) .1s;
}

.reach-figure__dc[hidden] {
  display: none;
}

.reach--armed [data-reach-count],
.reach--armed .reach-figure__dc,
.reach--counting .reach-figure__dc {
  opacity: 0;
}

.reach-figure__label {
  margin: 20px 0 0;
  color: var(--reach-ink);
  font: 400 11px/1.5 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.reach-lede {
  max-width: 460px;
  margin: 0;
  color: var(--reach-ink);
  font-size: 14px;
  line-height: 1.8;
}

/* Atlas */

.reach-atlas {
  width: 100%;
  max-width: 860px;
  margin: 0;
  justify-self: end;
}

.reach-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  grid-template-rows: repeat(8, auto);
  gap: clamp(3px, .45vw, 7px);
}

.reach-tile {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  color: var(--reach-none-ink);
  font: 400 clamp(11px, .8vw, 12px)/1 var(--mono);
  letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px var(--reach-tile-line);
  cursor: default;
  isolation: isolate;
  user-select: none;
  transition: transform .35s var(--ease);
}

/* Not licensed: a faint wash plus an edge that holds 3:1, so the gaps read as part of the
   map but stay quiet next to the filled tiles. */
.reach-tile[data-status="none"] {
  background: rgba(242, 238, 228, .05);
}

.reach-tile::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0;
  transform: scale(.35);
  transition:
    opacity .55s var(--ease) var(--d, 0ms),
    transform .75s var(--ease) var(--d, 0ms);
}

.reach-tile[data-status="licensed"],
.reach-tile[data-status="home"] {
  color: var(--forest-dark);
}

.reach-tile[data-status="licensed"]::before {
  background: var(--cream);
}

.reach-tile[data-status="home"] {
  z-index: 2;
  color: var(--white);
}

.reach-tile[data-status="home"]::before {
  background: var(--reach-home);
}

.reach-tile[data-status="temporary"] {
  color: var(--cream);
}

.reach-tile[data-status="temporary"]::before {
  background:
    repeating-linear-gradient(135deg, rgba(242, 238, 228, .22) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 1px rgba(242, 238, 228, .75);
}

.reach-map.is-lit .reach-tile::before {
  opacity: 1;
  transform: scale(1);
}

/* Home pulse: a ring that breathes out from Washington once the wave lands. */
.reach-tile[data-status="home"]::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 1px var(--clay);
}

.reach-map.is-lit .reach-tile[data-status="home"]::after {
  animation: reach-pulse 2.8s var(--ease) 1.1s infinite;
}

@keyframes reach-pulse {
  0% {
    opacity: .85;
    transform: scale(1);
  }

  70%,
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

@media (hover: hover) {
  .reach-tile:hover,
  .reach-tile.is-active {
    z-index: 3;
    transform: translateY(-3px);
  }
}

.reach-tile.is-active {
  box-shadow: inset 0 0 0 1px var(--cream);
}

/* Tooltip */

.reach-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  display: grid;
  gap: 4px;
  min-width: max-content;
  padding: 10px 13px 11px;
  color: var(--forest-dark);
  background: var(--cream);
  box-shadow: var(--shadow-deep);
  pointer-events: none;
  opacity: 0;
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 100% - 4px));
  transition: opacity .2s var(--ease), transform .3s var(--ease);
}

.reach-tip[data-align="start"] {
  transform: translate(calc(var(--x, 0px) - 18px), calc(var(--y, 0px) - 100% - 4px));
}

.reach-tip[data-align="end"] {
  transform: translate(calc(var(--x, 0px) - 100% + 18px), calc(var(--y, 0px) - 100% - 4px));
}

.reach-tip.is-shown {
  opacity: 1;
}

.reach-tip.is-shown:not([data-align]),
.reach-tip.is-shown[data-align="center"] {
  transform: translate(calc(var(--x, 0px) - 50%), calc(var(--y, 0px) - 100% - 10px));
}

.reach-tip.is-shown[data-align="start"] {
  transform: translate(calc(var(--x, 0px) - 18px), calc(var(--y, 0px) - 100% - 10px));
}

.reach-tip.is-shown[data-align="end"] {
  transform: translate(calc(var(--x, 0px) - 100% + 18px), calc(var(--y, 0px) - 100% - 10px));
}

.reach-tip strong {
  font: 400 21px/1 var(--serif);
  letter-spacing: -.01em;
}

.reach-tip span {
  color: var(--ink);
  font: 400 11px/1.3 var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}

/* Accessible list: the map's text equivalent. Visible only when JS is off. */

.reach-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 18px;
  margin: 0 0 24px;
  padding: 0;
  color: var(--reach-ink);
  font: 400 11px/1.5 var(--mono);
  list-style: none;
}

.js .reach--ready .reach-list {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Caption: legend + source */

.reach-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px 32px;
  margin-top: clamp(22px, 2.4vw, 34px);
  padding-top: 16px;
  border-top: 1px solid var(--reach-rule);
}

.reach-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reach-legend li,
.reach-source {
  color: rgba(242, 238, 228, .6);
  font: 400 11px/1.5 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}

.reach-legend li {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.reach-key {
  width: 10px;
  height: 10px;
  flex: none;
}

.reach-key--home {
  background: var(--reach-home);
  box-shadow: inset 0 0 0 1px rgba(242, 238, 228, .75);
}
.reach-key--licensed { background: var(--cream); }
.reach-key--none {
  background: rgba(242, 238, 228, .05);
  box-shadow: inset 0 0 0 1px var(--reach-tile-line);
}

.reach-key--temporary {
  background: repeating-linear-gradient(135deg, rgba(242, 238, 228, .6) 0 1.5px, transparent 1.5px 4px);
  box-shadow: inset 0 0 0 1px rgba(242, 238, 228, .7);
}

.reach-source {
  max-width: 460px;
  margin: 0;
  color: rgba(242, 238, 228, .6);
  letter-spacing: .06em;
  text-transform: none;
}

.reach-source a {
  color: var(--cream);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-color: rgba(242, 238, 228, .35);
  text-underline-offset: 3px;
  transition: text-decoration-color .3s var(--ease);
}

.reach-source a:hover {
  text-decoration-color: var(--clay);
}

/* Office ledger */

.reach-ledger {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: clamp(56px, 7vw, 128px);
  margin-top: clamp(80px, 9vw, 140px);
  padding-top: 28px;
  border-top: 1px solid var(--reach-rule);
}

.reach-ledger__intro .eyebrow {
  margin-bottom: 18px;
  color: rgba(242, 238, 228, .55);
}

.reach-markets {
  max-width: 360px;
  margin: 0;
  color: var(--reach-ink);
  font-size: 14px;
  line-height: 1.75;
}

.reach-offices {
  display: grid;
  width: 100%;
  max-width: 860px;
  justify-self: end;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.reach-office {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 clamp(18px, 2vw, 32px);
  border-left: 1px solid var(--reach-rule);
}

.reach-office:first-child {
  padding-left: 0;
  border-left: 0;
}

.reach-office__tag {
  color: rgba(242, 238, 228, .6);
  font: 400 11px/1 var(--mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.reach-office--home .reach-office__tag {
  color: var(--clay);
}

.reach-office h3 {
  margin: 0;
  font-size: clamp(30px, 2.7vw, 42px);
  letter-spacing: -.025em;
  line-height: 1;
}

.reach-office address {
  color: var(--reach-ink);
  font: 400 11px/1.65 var(--mono);
  font-style: normal;
  letter-spacing: .02em;
}

.reach-office__link {
  display: inline-flex;
  align-self: flex-start;
  gap: 6px;
  margin-top: auto;
  padding: 4px 0;
  color: var(--cream);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(242, 238, 228, .3);
  transition: border-color .3s var(--ease);
}

.reach-office__link span {
  display: inline-block;
  transition: transform .35s var(--ease);
}

.reach-office__link:hover {
  border-color: var(--clay);
}

.reach-office__link:hover span {
  transform: translate(2px, -2px);
}

.reach-office__link:focus-visible,
.reach-source a:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

/* Responsive */

@media (max-width: 1080px) {
  .reach-top,
  .reach-ledger {
    grid-template-columns: minmax(0, 1fr);
  }

  .reach-top {
    gap: clamp(48px, 8vw, 72px);
  }

  .reach-ledger {
    gap: 34px;
  }

  .reach-copy h2 {
    max-width: 16em;
  }

  .reach-lede {
    max-width: 560px;
  }
}

@media (min-width: 721px) and (max-width: 1080px) {
  .reach-copy {
    display: grid;
    align-items: end;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: clamp(40px, 6vw, 72px);
  }

  .reach-copy .eyebrow,
  .reach-copy h2 {
    grid-column: 1 / -1;
  }

  .reach-figure {
    margin-bottom: 0;
  }

  .reach-lede {
    padding-bottom: 24px;
  }
}

@media (max-width: 720px) {
  .reach-offices {
    grid-template-columns: minmax(0, 1fr);
  }

  .reach-office,
  .reach-office:first-child {
    padding: 24px 0;
    border-top: 1px solid var(--reach-rule);
    border-left: 0;
  }

  .reach-office:first-child {
    border-top: 0;
    padding-top: 0;
  }

  .reach-office:last-child {
    padding-bottom: 0;
  }

  .reach-office__link {
    margin-top: 4px;
  }

  .reach-caption {
    flex-direction: column;
  }

  .reach-legend {
    gap: 10px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reach-tile::before {
    transition: none;
  }

  .reach-map.is-lit .reach-tile[data-status="home"]::after {
    animation: none;
  }

  .reach--armed [data-reach-count],
  .reach--armed .reach-figure__dc,
  .reach--counting .reach-figure__dc {
    opacity: 1;
  }
}
