:root {
  --bg: #fbfcf9;
  --sidebar: #eef5ec;
  --surface: #ffffff;
  --text: #243028;
  --muted: #5c685f;
  --green: #315a3d;
  --lime: #4f7615;
  --lime-dark: #3f6110;
  --border: #d9e4d7;
  --dark: #243528;
  --sidebar-width: 272px;
  --rail-space: 1.7rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 32px;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: inherit;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  background: #fff;
  color: #000;
  padding: 0.75rem 1rem;
  border: 2px solid #000;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
}

.sidebar-upper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rail-space);
}

.brand-block {
  width: 100%;
  display: flex;
  justify-content: center;
}

.brand-link {
  display: inline-block;
  text-decoration: none;
}

.brand-logo {
  width: min(100%, 210px);
  height: auto;
}

.sidebar-rule {
  width: 44px;
  height: 2px;
  background: var(--lime);
  opacity: 0.45;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.sidebar-nav a {
  position: relative;
  width: fit-content;
  color: var(--lime);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  transition: color 180ms ease, transform 180ms ease;
}

.sidebar-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2rem;
  height: 2px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 220ms ease;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus {
  color: var(--lime-dark);
  transform: translateY(-1px);
}

.sidebar-nav a:hover::after,
.sidebar-nav a:focus::after {
  transform: scaleX(1);
}

.sidebar-meta {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.sidebar-meta p {
  margin: 0.12rem 0;
}

.sidebar-meta-title {
  color: var(--green);
  font-weight: 700;
  margin-bottom: 0.45rem !important;
}

.sidebar-contact {
  padding-top: var(--rail-space);
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
}

.sidebar-contact p {
  margin: 0 0 0.45rem;
}

.sidebar-contact a {
  color: var(--lime);
  font-weight: 700;
  text-decoration: none;
}

.sidebar-contact a:hover,
.sidebar-contact a:focus {
  color: var(--lime-dark);
  text-decoration: underline;
}

.site-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.masthead {
  position: relative;
  min-height: 395px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #fbfcf9;
}

.masthead-image {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 20px;
  width: calc(100% - 20px);
  height: 100%;
  object-fit: cover;
  object-position: right bottom;
  transform: translateY(34px);
}

.masthead-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 20px;
  width: calc(100% - 20px);
  height: 100%;
  transform: translateY(34px);
  background: linear-gradient(
    90deg,
    rgba(251, 252, 249, 0.34) 0%,
    rgba(251, 252, 249, 0.22) 32%,
    rgba(251, 252, 249, 0.12) 52%,
    rgba(251, 252, 249, 0.04) 68%,
    rgba(251, 252, 249, 0) 82%
  );
}

.masthead-copy {
  position: relative;
  z-index: 2;
  padding: 2.2rem clamp(2rem, 5vw, 5.5rem);
  max-width: 760px;
  transform: translateY(-0.4rem);
}

.masthead-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1rem 1.25rem 1rem 0;
  background: linear-gradient(
    90deg,
    rgba(251, 252, 249, 0.94) 0%,
    rgba(251, 252, 249, 0.86) 72%,
    rgba(251, 252, 249, 0) 100%
  );
}

.kicker,
.section-label {
  margin: 0 0 0.7rem;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  max-width: 620px;
  color: var(--green);
  font-size: clamp(2rem, 4.4vw, 3.35rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.cairn-note {
  max-width: 585px;
  margin-top: 1.9rem;
  padding-left: 1.15rem;
  border-left: 3px solid var(--lime);
  color: var(--green);
}

.cairn-note p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 600;
}

.section {
  padding: 4.25rem clamp(2rem, 5vw, 5.5rem);
  scroll-margin-top: 32px;
}

.services {
  background: var(--surface);
}

.service-list {
  border-top: 1px solid var(--border);
}

.service-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.service-number {
  color: var(--lime);
  font-size: 0.95rem;
  font-weight: 700;
}

.service-row h3,
.split-section h2,
.experience-copy h2,
.contact-section h2 {
  margin: 0;
  color: var(--green);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.2;
}

.service-row p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 4rem;
  background: #f1f6ef;
}

.copy-block {
  align-self: center;
}

.copy-block p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.experience-section {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  background: var(--bg);
}

.experience-copy {
  max-width: 760px;
}

.inline-link {
  display: inline-block;
  margin-top: 1.2rem;
  color: var(--lime);
  font-weight: 700;
  text-decoration: none;
}

.inline-link:hover,
.inline-link:focus {
  color: var(--lime-dark);
  text-decoration: underline;
}

.contact-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 3.2rem clamp(2rem, 5vw, 5.5rem);
  background: var(--dark);
  color: #fff;
  scroll-margin-top: 32px;
}

.section-label.light {
  color: #b7d96c;
}

.contact-section h2 {
  color: #fff;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.contact-section p {
  margin: 0.55rem 0 0;
  color: rgba(255,255,255,0.78);
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.contact-button {
  display: inline-block;
  padding: 0.72rem 1.05rem;
  border-radius: 999px;
  background: var(--lime);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.contact-button:hover,
.contact-button:focus {
  background: var(--lime-dark);
}

.site-footer {
  padding: 0.55rem 1.4rem 0.65rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer p {
  margin: 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.2;
}

.section:target,
.contact-section:target {
  animation: reveal 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

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

@media (max-width: 900px) {
  :root {
    --sidebar-width: 100%;
  }

  html {
    scroll-padding-top: 112px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    padding: 0.9rem 1rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }

  .sidebar-upper {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
  }

  .brand-block {
    width: auto;
  }

  .brand-logo {
    width: 150px;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 0.8rem;
    margin-left: auto;
    flex-wrap: wrap;
  }

  .sidebar-rule,
  .sidebar-meta,
  .sidebar-contact {
    display: none;
  }

  .site-main {
    margin-left: 0;
  }

  .section,
  .contact-section {
    scroll-margin-top: 112px;
  }

  .masthead {
    min-height: 390px;
  }

  .masthead-image,
  .masthead-overlay {
    top: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: none;
  }

  .split-section,
  .experience-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 650px) {
  .sidebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sidebar-upper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .brand-logo {
    width: 165px;
  }

  .sidebar-nav {
    margin-left: 0;
    justify-content: flex-start;
  }

  .masthead {
    min-height: 430px;
    align-items: flex-start;
    background: #fbfcf9;
  }

  .masthead-copy {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: none;
    padding: 2.2rem 1.25rem 9.75rem;
    transform: none;
  }

  .masthead-copy::before {
    display: none;
  }

  .masthead-image {
    top: auto;
    right: 0;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 145px;
    object-fit: contain;
    object-position: right bottom;
  }

  .masthead-overlay {
    top: auto;
    right: 0;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 145px;
    background: linear-gradient(
      180deg,
      rgba(251, 252, 249, 0.95) 0%,
      rgba(251, 252, 249, 0.20) 42%,
      rgba(251, 252, 249, 0) 100%
    );
  }

  .section {
    padding: 3rem 1.25rem;
  }

  .service-row {
    grid-template-columns: 52px 1fr;
  }

  .contact-section {
    align-items: flex-start;
    flex-direction: column;
    padding: 2.6rem 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .section:target,
  .contact-section:target {
    animation: none;
  }

  .sidebar-nav a,
  .sidebar-nav a::after {
    transition: none;
  }
}


/* Accessibility: semantic section headings keep their compact label styling. */
h2.section-label {
  font: inherit;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Accessibility: consistent keyboard focus indication. */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
}

.contact-section a:focus-visible {
  outline-color: #ffffff;
}

/* Ensure service headings remain visually unchanged after semantic h3 conversion. */
.service-row h3 {
  margin: 0;
  color: var(--green);
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.2;
}


/* Mobile hero: tapered cairn note and larger trail artwork.
   Desktop and tablet rules above 650px remain unchanged. */
@media (max-width: 650px) {
  .masthead {
    min-height: 0; /* Let the copy determine height instead of forcing an empty gap. */
    align-items: flex-start;
  }

  .masthead-copy {
    padding: 1.65rem 1rem 5rem; /* Compact mobile hero: move trail art visibly closer to the introduction. */
  }

  .masthead h1 {
    font-size: clamp(1.85rem, 7.5vw, 2.2rem);
  }

  .cairn-note {
    max-width: none;
    margin-top: 1.2rem;
    padding-left: 0.8rem;
  }

  /* Exclude an increasingly wide triangular area on the right.
     This gives the paragraph a natural diagonal edge without overlap. */
  .cairn-note::before {
    content: "";
    float: right;
    width: 36%;
    height: 11rem;
    shape-outside: polygon(100% 0, 100% 100%, 0 100%);
    shape-margin: 0.25rem;
  }

  .cairn-note p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* The illustration is one image containing both the cairn and the path.
     Increase its display size while preserving the full composition. */
  .masthead-image,
  .masthead-overlay {
    top: auto;
    left: -8%;
    right: auto;
    bottom: -6px;
    width: 116%;
    max-width: none;
    height: 200px;
    object-fit: contain;
    object-position: right bottom;
  }

  .masthead-overlay {
    background: linear-gradient(180deg, rgba(251,252,249,0.55), rgba(251,252,249,0) 50%);
    pointer-events: none;
  }
}

/* New cropped Rock Cairn Design wordmark: maintain comfortable fit in the rail. */
.brand-logo {
  width: min(100%, 216px);
  height: auto;
}

@media (max-width: 900px) {
  .brand-logo { width: 150px; }
}

@media (max-width: 650px) {
  .brand-logo { width: 150px; }
}

/* Cairn icons replace the numbered markers in the Services list. */
.service-icon {
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  padding-top: 0;
}
.service-icon img {
  display: block;
  width: 34px;
  height: auto;
}
@media (max-width: 650px) {
  .service-icon { width: 40px; }
  .service-icon img { width: 31px; }
}

/* Individual intact stones: no image slicing or clip paths. */
.service-icon .cairn-stack {
  display: block;
  width: 34px;
  height: auto;
  overflow: visible;
  flex: 0 0 auto;
}

@media (max-width: 650px) {
  .service-icon .cairn-stack { width: 31px; }
}

/* Only hide rocks once JavaScript has enabled the observer. */
.cairn-motion-ready .cairn-stack .stone {
  opacity: 0;
}

.cairn-motion-ready .cairn-stack.is-built .stone {
  animation: cairn-stone-land 680ms cubic-bezier(.2, .78, .25, 1) both;
  animation-delay: calc(var(--stone-order) * 280ms);
}

/* Move complete SVG shapes, rather than clipping an image into strips. */
@keyframes cairn-stone-land {
  0%   { opacity: 0; transform: translateY(-12px); }
  72%  { opacity: 1; transform: translateY(1.5px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .cairn-motion-ready .cairn-stack .stone {
    opacity: 1;
    animation: none;
  }
}
