/* ============================================================
   TERRA — Landscape Research Studio
   Bone panels over a deep earth canvas.
   ============================================================ */

:root {
  --bone: #E8E2D6;
  --ink: #141210;
  --accent: #C89B5E;
  --bone-70: rgba(232, 226, 214, 0.7);
  --bone-55: rgba(232, 226, 214, 0.55);
  --bone-40: rgba(232, 226, 214, 0.4);
  --bone-16: rgba(232, 226, 214, 0.16);
  --pad-x: clamp(24px, 4vw, 56px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  touch-action: none;
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: 'Archivo', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

::selection {
  background: var(--accent);
  color: var(--ink);
}

a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

/* The dossier scrolls natively — re-enable touch panning while open. */
html.is-report {
  touch-action: auto;
}

/* While the dossier is open the slider chrome bows out.
   (Containers only — GSAP tweens their children, never these.) */
main,
.site-head {
  transition: opacity 0.45s ease;
}

html.is-report main,
html.is-report .site-head {
  opacity: 0;
  pointer-events: none;
}

/* Gate the UI until the intro runs — avoids a flash before GSAP takes over. */
body:not(.is-ready) :is(.site-head, .slide-ui, .counter, .rail, .hint, .report-cta) {
  visibility: hidden;
}

/* ------------------------------------------------------------ canvas */

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.no-webgl #gl {
  display: none;
}

.no-webgl body,
body.no-webgl {
  background:
    radial-gradient(120% 120% at 70% 20%, #2a241c 0%, #141210 62%),
    var(--ink);
}

/* film grain over everything (incl. the field-report dossier) */
.grain {
  position: fixed;
  inset: -60px;
  z-index: 60;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ loader */

.loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: min(420px, 78vw);
}

.loader__brand {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--bone-55);
}

.loader__pct {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 340;
  font-size: clamp(4.5rem, 12vw, 8rem);
  line-height: 1;
  color: var(--bone);
}

.loader__pct sup {
  font-size: 0.28em;
  font-weight: 400;
  margin-left: 0.1em;
  color: var(--bone-55);
}

.loader__bar {
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--bone-16);
}

.loader__bar span {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.loader__note {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-40);
  min-height: 1em;
}

/* ------------------------------------------------------------ header */

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 26px var(--pad-x);
  pointer-events: none;
}

.site-head a {
  pointer-events: auto;
}

.brand {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 60;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
  color: var(--bone);
  text-decoration: none;
}

.brand sup {
  font-size: 0.5em;
  color: var(--bone-55);
}

.head-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-55);
}

/* ---------------------------------------------------------- slide ui */

.slide-ui {
  position: fixed;
  left: var(--pad-x);
  right: var(--pad-x);
  bottom: clamp(84px, 14vh, 150px);
  z-index: 20;
  pointer-events: none;
}

.chip {
  display: inline-block;
  background: var(--bone);
  color: var(--ink);
  border-radius: 2px;
}

.eyebrow {
  margin-bottom: 20px;
}

.eyebrow .chip {
  background: var(--accent);
  padding: 7px 11px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 380;
  font-size: clamp(2.7rem, 10.5vw, 9rem);
  line-height: 0.96;
  letter-spacing: -0.015em;
  color: var(--bone);
  max-width: 12ch;
}

.t-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.07em;
  margin-bottom: -0.07em;
}

.t-line__in {
  display: inline-block;
  will-change: transform;
}

.t-line__in.is-italic {
  font-style: italic;
  font-weight: 310;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(18px, 3vh, 30px);
  list-style: none;
}

.meta__item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 108px;
  padding: 10px 14px;
  background: var(--bone);
  color: var(--ink);
  border-radius: 2px;
}

.meta__label {
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.5;
}

.meta__value {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.desc {
  position: fixed;
  right: clamp(64px, 7vw, 110px);
  bottom: clamp(150px, 24vh, 260px);
  z-index: 20;
  max-width: 30ch;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-variation-settings: 'opsz' 30;
  font-weight: 340;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--bone-70);
  pointer-events: none;
}

/* ----------------------------------------------------------- counter */

.counter {
  position: fixed;
  right: var(--pad-x);
  bottom: clamp(26px, 5vh, 44px);
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Fraunces', serif;
  pointer-events: none;
}

.counter__win {
  position: relative;
  display: inline-block;
  width: 2.3ch;
  height: 1.05em;
  overflow: hidden;
  font-size: 1.9rem;
  font-variation-settings: 'opsz' 100;
  font-weight: 380;
  color: var(--bone);
}

.counter__num {
  position: absolute;
  inset: 0;
  line-height: 1.05;
}

.counter__sep {
  font-size: 0.8rem;
  color: var(--bone-40);
}

.counter__total {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--bone-55);
}

/* -------------------------------------------------------------- rail */

.rail {
  position: fixed;
  right: clamp(18px, 2.4vw, 36px);
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: min(36vh, 320px);
  background: var(--bone-16);
  z-index: 20;
  pointer-events: none;
}

.rail__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleY(0.2);
  transform-origin: center top;
}

.rail__tick {
  position: absolute;
  left: -3px;
  width: 8px;
  height: 1px;
  background: var(--bone-16);
}

.rail__tick:nth-child(2) { top: 20%; }
.rail__tick:nth-child(3) { top: 40%; }
.rail__tick:nth-child(4) { top: 60%; }
.rail__tick:nth-child(5) { top: 80%; }

/* -------------------------------------------------------------- hint */

.hint {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-55);
  pointer-events: none;
}

.hint::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: 40px;
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--bone-55), transparent);
}

@media (prefers-reduced-motion: no-preference) {
  .hint::after {
    animation: hint-pulse 2.6s ease-in-out infinite;
  }
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.35; transform: translateX(-50%) scaleX(0.55); }
  50% { opacity: 1; transform: translateX(-50%) scaleX(1); }
}

/* ------------------------------------------------------------ cursor */

body.has-cursor,
body.has-cursor a,
body.has-cursor button {
  cursor: none;
}

.cursor-ring,
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

body.is-cursor-active .cursor-ring,
body.is-cursor-active .cursor-dot {
  opacity: 1;
}

body:not(.has-cursor) .cursor-ring,
body:not(.has-cursor) .cursor-dot {
  display: none;
}

.cursor-dot {
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--bone);
}

.cursor-ring__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--bone-55);
  border-radius: 999px;
  transition:
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.3s ease,
    border-color 0.3s ease,
    scale 0.3s ease;
}

body.is-hover .cursor-ring__inner {
  scale: 1.35;
}

body.is-dragging .cursor-ring__inner {
  width: 78px;
  height: 34px;
  background: var(--bone);
  border-color: var(--bone);
}

body.is-dragging .cursor-dot {
  opacity: 0;
}

.cursor__label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.is-dragging .cursor__label {
  opacity: 1;
  transition-delay: 0.08s;
}

/* ---------------------------------------------------------- noscript */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bone);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 24px;
}

/* -------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .head-label--mid {
    display: none;
  }
}

@media (max-width: 700px) {
  .title {
    font-size: clamp(2.6rem, 13vw, 5rem);
  }

  .desc {
    display: none;
  }

  /* CTA takes the bottom-left slot; hide the hint to avoid collision. */
  .hint {
    display: none;
  }

  .report-cta {
    padding: 10px 14px;
  }

  .rail {
    right: 14px;
    height: 28vh;
  }

  .meta__item {
    min-width: 0;
    padding: 8px 11px;
  }

  .slide-ui {
    bottom: clamp(72px, 12vh, 120px);
  }

  .counter__win {
    font-size: 1.5rem;
  }
}

@media (max-height: 560px) {
  .desc {
    display: none;
  }

  .slide-ui {
    bottom: 64px;
  }
}

/* --------------------------------------------------- field report CTA */

.report-cta {
  position: fixed;
  left: var(--pad-x);
  bottom: clamp(26px, 5vh, 44px);
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: transparent;
  border: 1px solid var(--bone-40);
  border-radius: 2px;
  color: var(--bone);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition:
    background-color 0.35s ease,
    border-color 0.35s ease,
    color 0.35s ease;
}

.report-cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.report-cta__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transition: background-color 0.35s ease;
}

.report-cta:hover .report-cta__dot {
  background: var(--ink);
}

.report-cta__arrow {
  font-size: 0.8rem;
  line-height: 1;
}

/* ------------------------------------------------ field report dossier */

.report {
  position: fixed;
  inset: 0;
  z-index: 50;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.report.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* Legibility wash — the WebGL stage also dims via its uReport uniform. */
.report::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(16, 14, 12, 0.3) 0%,
    rgba(16, 14, 12, 0.55) 55%,
    rgba(16, 14, 12, 0.72) 100%
  );
}

.report__scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 226, 214, 0.25) transparent;
}

.report__scroll::-webkit-scrollbar {
  width: 5px;
}

.report__scroll::-webkit-scrollbar-thumb {
  background: var(--bone-16);
  border-radius: 3px;
}

.report__inner {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(96px, 16vh, 160px) var(--pad-x) 22vh;
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 9vh, 96px);
}

.report__eyebrow {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 26px;
}

.report__title {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 144;
  font-weight: 380;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  color: var(--bone);
}

.report__tline-mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.report__tline {
  display: inline-block;
}

.report__tline.is-italic {
  font-style: italic;
  font-weight: 310;
}

.report__coords {
  margin-top: 24px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-55);
}

.report__lede {
  margin-top: 26px;
  max-width: 46ch;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-variation-settings: 'opsz' 30;
  font-weight: 340;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--bone-70);
}

.r-sec__label {
  font-size: 0.575rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--bone-40);
  padding-bottom: 10px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--bone-16);
}

.rstat {
  display: grid;
  grid-template-columns: 1fr auto minmax(64px, auto);
  align-items: baseline;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--bone-16);
}

.rstat__label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-55);
}

.rstat__value {
  font-family: 'Fraunces', serif;
  font-variation-settings: 'opsz' 100;
  font-weight: 340;
  font-size: clamp(2rem, 5.4vw, 3.4rem);
  line-height: 1;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.rstat__suffix {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.report__map {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

#reportMap {
  width: min(460px, 100%);
  aspect-ratio: 1;
  display: block;
  background: rgba(232, 226, 214, 0.03);
  border: 1px solid var(--bone-16);
}

.report__mapcap {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-40);
}

.report__quote {
  position: relative;
  padding-left: clamp(28px, 5vw, 56px);
}

.report__quote::before {
  content: '\201C';
  position: absolute;
  left: 0;
  top: -0.12em;
  font-family: 'Fraunces', serif;
  font-size: 3.4rem;
  font-weight: 340;
  line-height: 1;
  color: var(--accent);
}

.report__quote p {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-variation-settings: 'opsz' 60;
  font-weight: 340;
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.35;
  color: var(--bone);
  max-width: 26ch;
}

.report__quote cite {
  display: block;
  margin-top: 20px;
  font-family: 'Archivo', system-ui, sans-serif;
  font-style: normal;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone-55);
}

.report__end {
  text-align: center;
  font-size: 0.575rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--bone-40);
  padding-top: 8px;
}

/* Scroll-reveal state for dossier sections. */
.r-sec {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s ease,
    transform 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.r-sec.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .r-sec {
    transition: none;
    transform: none;
  }
}

.report__close {
  position: absolute;
  top: 22px;
  right: var(--pad-x);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--bone-40);
  border-radius: 999px;
  color: var(--bone);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

.report__close:hover {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--ink);
}

.report__close span[aria-hidden] {
  font-size: 0.9rem;
  line-height: 1;
}

@media (max-width: 700px) {
  .report__inner {
    gap: 48px;
  }

  .rstat {
    gap: 12px;
  }

  .report__close .report__close-label {
    display: none;
  }

  .report__close {
    padding: 10px 13px;
  }
}
