/* Depth: the layers read as rock you are looking into, not flat bands.
   Same colours and patterns as before; this only adds light, shade and grain. */

/* 1. each layer sits under the one above it: shade under the contact line,
      walls darken toward the sides like the inside of a cutting */
main > section[data-depth]:not(.hero),
.stratum {
  box-shadow:
    inset 0 52px 46px -30px rgba(0, 0, 0, .42),
    inset 0 0 0 100vmax rgba(8, 18, 28, var(--tint, 0)),
    inset 110px 0 120px -90px rgba(0, 0, 0, .16),
    inset -110px 0 120px -90px rgba(0, 0, 0, .16);
}
main > section.contact {
  box-shadow: inset 0 40px 50px -30px rgba(0, 0, 0, .35);
}

/* 2. the wavy top edge of every layer is a ledge: a lit lip, a shadow cast upward */
main > section:not(.hero):not(.contact)::before,
.stratum::before {
  filter: drop-shadow(0 -4px 3px rgba(0, 0, 0, .22)) drop-shadow(0 -1px 0 rgba(255, 255, 255, .22));
}

/* 3. fine mineral grain over everything, so surfaces read as stone, not paint */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: .08;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.4 -.25'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 4. the rock texture drifts slower than the words on it: near and far, like looking into a well.
      Only where the browser can tie it to scrolling; otherwise the layers simply stay still. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main > section[data-depth]:not(.hero):not(.contact),
    .stratum {
      animation: strata-drift linear both;
      animation-timeline: view();
    }
  }
}
@keyframes strata-drift {
  from { background-position: 0 -70px; }
  to   { background-position: 0 70px; }
}

/* 5. cards and panels float a little off the rock face */
.ministry { box-shadow: 0 18px 40px -28px rgba(40, 28, 10, .55); }
.cert-list button { box-shadow: 0 14px 26px -18px rgba(0, 0, 0, .7); }
.field-grid figure button { box-shadow: 0 16px 30px -20px rgba(40, 28, 10, .6); }

@media print {
  body::after { display: none; }
  main > section[data-depth], .stratum { box-shadow: none !important; }
}

/* phones: narrower screen, so softer side walls */
@media (max-width: 600px) {
  main > section[data-depth]:not(.hero),
  .stratum {
    box-shadow:
      inset 0 40px 36px -24px rgba(0, 0, 0, .38),
      inset 0 0 0 100vmax rgba(8, 18, 28, var(--tint, 0)),
      inset 50px 0 60px -45px rgba(0, 0, 0, .14),
      inset -50px 0 60px -45px rgba(0, 0, 0, .14);
  }
}

/* ---------- more depth ---------- */

/* 6. the deeper the layer, the less daylight reaches it */
.stats { --tint: .05; }
.services, .s-hydro { --tint: .03; }
.s-gis { --tint: .05; } .s-hydrogeo { --tint: .07; } .s-wells { --tint: .09; } .s-pm { --tint: .11; }
.projects { --tint: .07; }
.clients { --tint: .10; }
.team { --tint: .14; }
.certs { --tint: .16; }

/* 7. large stones buried deep in each layer, drifting slowest of all:
      far stones, nearer grain, then the words in front */
main > section[data-depth]:not(.hero):not(.contact),
.stratum { isolation: isolate; }
main > section[data-depth]:not(.hero):not(.contact)::after,
.stratum::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-color: var(--stone, rgba(40, 26, 8, .10));
  -webkit-mask: var(--stones) 0 0 / 560px 400px repeat;
          mask: var(--stones) 0 0 / 560px 400px repeat;
}
:root {
  --stones: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='400'%3E%3Cfilter id='b'%3E%3CfeGaussianBlur stdDeviation='2.2'/%3E%3C/filter%3E%3Cg filter='url(%23b)'%3E%3Cellipse cx='70' cy='60' rx='34' ry='20' transform='rotate(-12 70 60)'/%3E%3Cellipse cx='300' cy='40' rx='16' ry='10'/%3E%3Cellipse cx='470' cy='120' rx='42' ry='24' transform='rotate(18 470 120)'/%3E%3Cellipse cx='180' cy='200' rx='22' ry='14' transform='rotate(30 180 200)'/%3E%3Cellipse cx='380' cy='260' rx='28' ry='17' transform='rotate(-20 380 260)'/%3E%3Cellipse cx='60' cy='330' rx='18' ry='11'/%3E%3Cellipse cx='250' cy='350' rx='38' ry='21' transform='rotate(8 250 350)'/%3E%3Cellipse cx='520' cy='340' rx='14' ry='9'/%3E%3Cellipse cx='130' cy='120' rx='9' ry='6'/%3E%3Cellipse cx='420' cy='190' rx='8' ry='5'/%3E%3C/g%3E%3C/svg%3E");
}
.stats, .team, .certs, .s-pm, .s-wells { --stone: rgba(255, 255, 255, .055); }
.about::after { -webkit-mask-position: 140px 0; mask-position: 140px 0; }
.projects::after { -webkit-mask-position: 320px 60px; mask-position: 320px 60px; }
.team::after { -webkit-mask-position: 60px 140px; mask-position: 60px 140px; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main > section[data-depth]:not(.hero):not(.contact)::after,
    .stratum::after {
      animation: stones-drift linear both;
      animation-timeline: view();
    }
  }
}
@keyframes stones-drift {
  from { -webkit-mask-position-y: -170px; mask-position-y: -170px; }
  to   { -webkit-mask-position-y: 170px;  mask-position-y: 170px; }
}

/* 8. headings are cut into the rock: a lit lower lip on light stone, a cast shadow on dark stone */
.about h2, .services h2, .projects h2, .projects h3, .clients h2, .st-name {
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55), 0 -1px 0 rgba(0, 0, 0, .14);
}
.stats-list strong, .team h2, .certs h2, .s-pm .st-name {
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25), 0 6px 14px rgba(0, 0, 0, .35);
}

/* 9. the borehole is a real hole: dark inside, lit at its rim */
.hole { box-shadow: inset 6px 0 8px -2px rgba(0, 0, 0, .6), inset -6px 0 8px -2px rgba(0, 0, 0, .6); }

@media print {
  main > section[data-depth]::after, .stratum::after { display: none; }
  * { text-shadow: none !important; }
}
@media (max-width: 600px) {
  main > section[data-depth]:not(.hero):not(.contact)::after,
  .stratum::after { -webkit-mask-size: 380px 272px; mask-size: 380px 272px; }
}
