/* Green Tree Preservation site styles
   Palette from Grant County: sagebrush and juniper greens, lichen, and the basalt of the coulee walls.
   The striped "strata" line under each header echoes the stacked lava flows in those walls. */

:root {
  --basalt: #2b2724;        /* headings, footer, button */
  --basalt-soft: #4a423b;
  --ink: #2f2a25;           /* body text */
  --field: #4e6146;         /* page-header field: sagebrush in shade */
  --field-deep: #3b4c34;    /* current-page marker */
  --sage-pale: #d3ddc6;     /* light text on dark */
  --sage: #8a977a;
  --sage-light: #e3e6da;    /* quiet bands */
  --lichen: #b9c4a8;
  --link: #3f5d32;

  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --text: "Barlow", "Helvetica Neue", Arial, sans-serif;

  --wrap: 72rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --strata: linear-gradient(to bottom,
    var(--sage) 0 4px,
    var(--basalt) 4px 12px,
    var(--lichen) 12px 15px,
    var(--basalt-soft) 15px 19px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;                  /* footer stays at the bottom on short pages */
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 400 1.125rem/1.6 var(--text);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { color: var(--basalt); }

:focus-visible {
  outline: 3px solid var(--basalt);
  outline-offset: 3px;
}

::selection { background: var(--sage-pale); color: var(--basalt); }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--basalt);
  color: var(--sage-pale);
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

main { flex: 1; }

/* ------------------------------------------------------------ masthead */
.masthead { background: #fff; }

.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.25rem 1.5rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1rem var(--gutter) 0;
}

.wordmark {
  color: var(--basalt);
  font: 700 1.75rem/1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}

.masthead-phone {
  color: var(--basalt);
  font: 700 1.375rem/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
}

.masthead nav { grid-column: 1 / -1; }

.masthead ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.masthead nav a {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}

.masthead nav a:hover { border-bottom-color: var(--lichen); color: var(--basalt); }
.masthead nav a[aria-current="page"] { border-bottom-color: var(--field-deep); color: var(--basalt); }

/* ------------------------------------------------------------ field (page header) */
.field {
  position: relative;
  overflow: hidden;
  background: var(--field);
  color: #fff;
  padding-bottom: 19px;               /* room for the strata line */
}

.field::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 19px;
  background: var(--strata);
  z-index: 2;
}

.field-inner {
  position: relative;
  z-index: 1;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.field h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.field :focus-visible { outline-color: #fff; }

/* inner pages: a strip of green with the page title */
.field--page .field-inner { padding-top: 2.75rem; padding-bottom: 2.5rem; }
.field--page h1 { font-size: clamp(2.5rem, 6vw, 3.75rem); max-width: 18ch; }

/* home: headline on the green, the climber photo standing at the right */
.field--home { min-height: clamp(30rem, 74vh, 42rem); display: flex; align-items: center; }
.field--home .field-inner { width: 100%; padding-top: 3rem; padding-bottom: 3.5rem; }

.field-text { max-width: 33rem; }

.field--home h1 { font-size: clamp(3.5rem, 8.5vw, 6.5rem); }

.field-lead {
  max-width: 26rem;
  margin: 1.25rem 0 2rem;
  color: #e2e8da;
  font-size: 1.25rem;
  line-height: 1.45;
}

.field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0;
  font-weight: 600;
}

.call {
  display: inline-block;
  padding: 0.75rem 1.4rem 0.8rem;
  border-radius: 3px;
  background: var(--sage-light);
  color: var(--basalt);
  font: 700 1.5rem/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.call:hover { background: #fff; color: var(--basalt); }

.field-photo {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(44%, 38rem);
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}

@media (max-width: 860px) {
  .field--home { display: block; min-height: 0; }
  .field--home .field-inner { padding-bottom: 2rem; }
  .field-photo {
    position: static;
    width: 100%;
    height: 24rem;
  }
}

/* ------------------------------------------------------------ content */
.section {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter);
}

.prose { max-width: 40rem; }

.prose > * { margin-top: 0; margin-bottom: 1.25rem; }

.prose h2,
.section h2,
.band h2 {
  color: var(--basalt);
  font: 700 2rem/1.1 var(--display);
  letter-spacing: 0.005em;
}

.prose h2 {
  clear: both;
  margin-top: 3rem;
  margin-bottom: 0.75rem;
  scroll-margin-top: 1.5rem;
}

.lead {
  color: var(--basalt);
  font-size: 1.3125rem;
  line-height: 1.5;
}

.prose ul { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.4rem; }

/* photos that sit beside the text */
.aside {
  float: right;
  width: min(45%, 20rem);
  margin: 0.35rem 0 1.25rem 1.75rem;
}

.aside img { width: 100%; border-radius: 2px; }

/* wide screens: hang the photos in the margin and keep the text column clean */
@media (min-width: 70rem) {
  .prose .aside {
    width: 20rem;
    margin-right: -23rem;
    margin-left: 3rem;
  }
  .prose h2 + .aside { margin-top: -2.95rem; }
}

@media (max-width: 560px) {
  .aside { float: none; width: 100%; margin: 0 0 1.25rem; }
}

.phone-callout { margin: 1.5rem 0 2rem; }
.phone-callout a {
  color: var(--basalt);
  font: 700 clamp(2.5rem, 8vw, 3.5rem)/1 var(--display);
  letter-spacing: 0.01em;
  text-decoration-color: var(--field);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.12em;
}

/* the topping article: small diagrams and photos from another site, at their natural sizes */
.aside--plain { width: auto; max-width: min(40%, 14rem); }
.aside--plain img { width: auto; border-radius: 0; }

@media (min-width: 70rem) {
  .prose .aside--plain { width: 20rem; max-width: none; }   /* same margin column as other pages */
  .figure-row { margin-right: -23rem; }                     /* room for all four drawings on one line */
}

.figure-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  clear: both;
  padding: 0.5rem 0;
}
.figure-row img { width: auto; max-height: 16.25rem; }

.article h2 { margin-top: 2.5rem; }
.article .source { clear: both; padding-top: 1rem; color: #6b6359; font-size: 0.9375rem; }

@media (max-width: 560px) {
  .aside--plain { float: none; width: auto; max-width: 100%; margin: 0 0 1.25rem; }
  .figure-row img { max-height: 12rem; }
}

/* ------------------------------------------------------------ home bands */
.band { background: var(--sage-light); }

.band-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--gutter);
}

.band h2 { margin: 0 0 1.5rem; }

.service-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-index a {
  display: block;
  padding: 0.85rem 0;
  border-top: 1px solid #c3c9b4;
  color: var(--basalt);
  font: 600 1.5rem/1.2 var(--display);
  text-decoration: none;
}
.service-index a:hover { color: var(--link); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-bottom: 1.5rem;
}
.section-head h2 { margin: 0; }

.photo-strip {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-strip img {
  width: 100%;
  height: clamp(14rem, 30vw, 22rem);
  object-fit: cover;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .photo-strip { grid-template-columns: 1fr 1fr; }
  .photo-strip li:first-child { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------ gallery */
.gallery {
  columns: 3 16rem;
  column-gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery li { break-inside: avoid; margin-bottom: 0.75rem; }
.gallery img { width: 100%; border-radius: 2px; }
.gallery a:hover img { filter: brightness(1.06); }

/* ------------------------------------------------------------ footer */
.site-footer {
  position: relative;
  padding-top: 19px;
  background: var(--basalt);
  color: #e6e0d4;
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 19px;
  background: var(--strata);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem 3rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 3rem var(--gutter);
}

.site-footer p { margin: 0; }

.footer-name {
  color: #fff;
  font: 700 1.5rem/1.2 var(--display);
}

.footer-phone a {
  color: var(--sage-pale);
  font: 700 2.25rem/1.1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.footer-phone a:hover { text-decoration: underline; }
.site-footer :focus-visible { outline-color: var(--sage-pale); }

@media (max-width: 560px) {
  .wordmark { font-size: 1.375rem; }
  .masthead-phone { font-size: 1.125rem; }
  /* one swipeable row instead of three wrapped lines */
  .masthead nav { margin: 0 calc(var(--gutter) * -1); }
  .masthead ul {
    flex-wrap: nowrap;
    gap: 0 1.25rem;
    overflow-x: auto;
    padding: 0 var(--gutter);
    scrollbar-width: none;
    white-space: nowrap;
  }
  .masthead ul::-webkit-scrollbar { display: none; }
  .masthead nav a { font-size: 0.9375rem; padding: 0.6rem 0; }
}

/* ------------------------------------------------------------ photo viewer (js/lightbox.js) */
html:has(.lightbox[open]) { overflow: hidden; }

.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(27 24 22 / 0.96);
  color: #e6e0d4;
  touch-action: pan-y pinch-zoom;     /* horizontal swipes reach the script */
}

.lightbox[open] {
  display: grid;
  grid-template: 1fr auto / 4.5rem 1fr 4.5rem;
  align-items: center;
  animation: lightbox-in 0.18s ease-out;
}

.lightbox::backdrop { background: transparent; }

@keyframes lightbox-in { from { opacity: 0; } }

.lightbox-figure {
  grid-area: 1 / 2 / 3 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 1.5rem 0 1rem;
}

.lightbox-img {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
  object-fit: contain;
  border-radius: 2px;
}

.lightbox-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  max-width: 44rem;
  margin-top: 0.85rem;
  font-size: 1rem;
  line-height: 1.4;
  text-align: center;
}

.lightbox-count { color: var(--sage-pale); font-weight: 600; white-space: nowrap; }

.lightbox-btn {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  cursor: pointer;
}
.lightbox-btn:hover { background: rgb(255 255 255 / 0.18); }
.lightbox :focus-visible { outline: 3px solid var(--sage-pale); outline-offset: 2px; }

.lightbox-prev { grid-area: 1 / 1; justify-self: center; }
.lightbox-next { grid-area: 1 / 3; justify-self: center; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; }

@media (max-width: 640px) {
  .lightbox[open] { grid-template: 1fr auto / 1fr 1fr; }
  .lightbox-figure { grid-area: 1 / 1 / 2 / 3; padding: 4rem 0.75rem 0.5rem; }
  .lightbox-img { max-height: calc(100dvh - 12rem); }
  .lightbox-prev,
  .lightbox-next { grid-row: 2; margin-bottom: 1.25rem; }
  .lightbox-prev { grid-column: 1; }
  .lightbox-next { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox[open] { animation: none; }
}
