/* ---------- About Me: page mode ----------
 * Projects keeps everything fixed to the viewport. About Me lets the page scroll:
 * the meadow layers sit at the top of the page and scroll away as you dig down.
 */
html.is-about { overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: none; background: #2b2723; }
html.is-about body { height: auto; overflow: visible; }
html.is-about #sky, html.is-about #yard, html.is-about #grass-front { position: absolute; }
html.is-about .hint { opacity: 0; }
body.is-under .hello { background: #f1e8d8; color: #16130f; }
html.is-about .stage { pointer-events: none; }

/* the clothesline is hauled up out of frame, then drops back with a bounce */
.layer--line { transition: transform 1.05s cubic-bezier(.3, 1.2, .45, 1) .12s; }
.layer--line.is-away { transform: translate3d(0, -115vh, 0); transition: transform .8s cubic-bezier(.6, 0, .35, 1); }
.layer--line.no-anim { transition: none; }

#about { position: relative; z-index: 4; pointer-events: none; }
#about[hidden] { display: none; }
.about__surface { position: relative; height: 100vh; }

.dig-hint {
  position: absolute; left: 50%; top: 70%; margin: 0; transform: translate(-50%, 8px);
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, .62); color: #16130f; font-size: 13px; font-weight: 500; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px -8px rgba(30, 20, 10, .45);
  opacity: 0; transition: opacity .5s, transform .5s var(--ease);
}
.dig-hint i { font-style: normal; display: inline-block; animation: nudge 1.3s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(4px); } }
.dig-hint.is-in { opacity: 1; transform: translate(-50%, 0); transition-delay: 1.3s; }
.dig-hint.is-in.is-gone { opacity: 0; transition-delay: 0s; }
body.is-night .dig-hint { background: rgba(24, 18, 13, .5); color: #f1eee6; }

/* ---------- header and bar over the soil ---------- */
.top::before, .bar::before {
  content: ""; position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none;
  opacity: 0; transition: opacity .4s;
}
.top::before { top: 0; height: 150%; background: linear-gradient(rgba(22, 15, 10, .92) 45%, rgba(22, 15, 10, 0)); }
.bar::before { bottom: 0; height: 150%; background: linear-gradient(rgba(22, 15, 10, 0), rgba(22, 15, 10, .7)); }
body.is-under .top::before, body.is-under .bar::before { opacity: 1; }
body.is-under .top { color: #f1eee6; text-shadow: 0 1px 10px rgba(0, 0, 0, .4); }
body.is-under .sub, body.is-under .env { color: rgba(241, 238, 230, .7); }

/* ---------- underground ---------- */
.under {
  position: relative; overflow: hidden; pointer-events: auto;
  color: #f1e8d8; background: #4e3525;
}
.stratum {
  position: absolute; left: 0; right: 0;
  background-image:
    radial-gradient(rgba(0, 0, 0, .16) 1.2px, transparent 1.7px),
    radial-gradient(rgba(255, 236, 210, .05) 1px, transparent 1.5px);
  background-size: 23px 19px, 31px 37px;
  background-position: 0 0, 11px 7px;
}
.stratum::before {
  content: ""; position: absolute; left: 0; right: 0; top: -17px; height: 18px;
  background: var(--wave) repeat-x 0 0 / 160px 18px;
}
.stratum:first-child::before { display: none; }

.turf {
  position: absolute; top: 0; left: 0; right: 0; height: 26px; z-index: 1;
  background: linear-gradient(var(--turf, #79ad57), color-mix(in srgb, var(--turf, #79ad57) 62%, #2b1d12));
}
.turf::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 14' preserveAspectRatio='none'%3E%3Cpath d='M0 14V8c15-7 30-7 45-1s30 6 45 0 22-5 30-3v10z' fill='%234e3525'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 14px;
}
.roots { position: absolute; top: 14px; left: 0; width: 100%; height: 170px; z-index: 1; pointer-events: none; }
.roots path { fill: none; stroke: #2e1f14; stroke-width: 2.4; stroke-linecap: round; opacity: .7; }

.pebbles { position: absolute; inset: 0; pointer-events: none; }
.pebble { position: absolute; border-radius: 50%; background: rgba(18, 10, 5, var(--o)); }
.pebble:nth-child(3n) { background: rgba(214, 190, 160, calc(var(--o) * .5)); }

/* buried things */
.relic { position: absolute; z-index: 1; pointer-events: none; will-change: transform; }
.relic svg { display: block; width: 100%; height: auto; }
.relic.is-small { scale: .7; }
.relic--worm { width: 90px; }
.relic--worm svg { animation: crawl 16s ease-in-out infinite alternate; }
.worm__body { transform-box: fill-box; transform-origin: 0 50%; animation: squirm .9s ease-in-out infinite alternate; }
@keyframes crawl { to { transform: translateX(180px); } }
@keyframes squirm { from { transform: scaleX(.88) scaleY(1.15); } to { transform: none; } }
.relic--stone { width: 64px; }
.relic--fossil { width: 86px; }
.relic--fossil svg { transform: rotate(-18deg); }
.relic--gem { width: 54px; }
.relic--gem::after {
  content: "✦"; position: absolute; right: -6px; top: -8px; color: #fff; font-size: 14px;
  animation: twinkle 2.8s ease-in-out infinite;
}
@keyframes twinkle { 0%, 60%, 100% { opacity: 0; transform: scale(.4); } 75% { opacity: 1; transform: scale(1) rotate(40deg); } }

.relic--bone {
  width: 80px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.relic--bone svg { transform: rotate(-14deg); transition: transform .3s var(--ease); }
.relic--bone:hover svg { transform: rotate(-6deg) scale(1.06); }
.relic--bone.is-poked svg { animation: jiggle .5s; }
@keyframes jiggle { 25% { transform: rotate(-24deg); } 50% { transform: rotate(-4deg); } 75% { transform: rotate(-18deg); } }
.relic--bone:focus-visible { outline: 2px solid #f1e8d8; outline-offset: 4px; border-radius: 10px; }
.relic__tip {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translate(-50%, 6px);
  padding: 5px 11px; border-radius: 12px; background: #fff; color: #16130f;
  font-size: 12px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .3s var(--ease);
}
.relic--bone.is-poked .relic__tip { opacity: 1; transform: translate(-50%, 0); }

/* the tunnel and its mole */
.tunnel { position: absolute; left: 0; top: 0; z-index: 2; overflow: visible; pointer-events: none; }
.tunnel__wall, .tunnel__hole { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tunnel__wall { stroke: rgba(0, 0, 0, .2); stroke-width: 46; }
.tunnel__hole { stroke: #22150d; stroke-width: 32; opacity: .88; }
.mole { transition: opacity .3s; }
.mole__paw { transform-box: fill-box; transform-origin: 30% 30%; }
.is-digging .mole__paw--f { animation: dig .16s ease-in-out infinite alternate; }
.is-digging .mole__paw--b { animation: dig .16s ease-in-out infinite alternate-reverse; }
.is-digging .mole__body { animation: waddle .32s ease-in-out infinite alternate; }
@keyframes dig { from { transform: rotate(-28deg); } to { transform: rotate(22deg); } }
@keyframes waddle { to { transform: translateY(-1.2px) rotate(2deg); } }
.crumb { position: absolute; z-index: 2; border-radius: 40%; background: #7b573c; pointer-events: none; }

/* chambers */
.dens { padding: 170px 0 0; }
.den {
  position: relative; z-index: 3;
  width: min(620px, calc(100% - 32px)); margin: 0 auto 150px;
  clip-path: circle(0% at var(--ox, 50%) 0%);
  transition: clip-path 1.15s cubic-bezier(.2, .8, .2, 1);
}
.den.is-open { clip-path: circle(150% at var(--ox, 50%) 0%); }
@media (min-width: 900px) {
  .den[data-side="l"] { margin-left: max(6vw, 40px); }
  .den[data-side="r"] { margin-right: max(6vw, 40px); margin-left: auto; }
}
.den__in {
  padding: 38px 42px 40px;
  border-radius: 42px 60px 46px 64px / 52px 42px 60px 46px;
  background: #2a1a10;
  box-shadow: inset 0 16px 32px -8px rgba(0, 0, 0, .6), inset 0 -1px 0 rgba(255, 255, 255, .06), 0 0 0 1px rgba(0, 0, 0, .18);
}
.den [data-up] {
  opacity: 0; transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: calc(var(--i, 0) * 80ms + 260ms);
}
.den.is-open [data-up] { opacity: 1; transform: none; }

.den__eyebrow, .bedrock .den__eyebrow {
  margin: 0 0 10px; color: #e8b67a; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
}
.den__title { margin: 0; font-weight: 650; letter-spacing: -.03em; line-height: 1.05; }
.den__title--big { font-size: clamp(32px, 4.4vw, 50px); }
.den__text { margin: 18px 0 0; font-size: 16px; line-height: 1.62; color: rgba(241, 232, 216, .86); }
.den__text--lead { margin-top: 4px; font-size: clamp(17px, 1.7vw, 20px); color: #f1e8d8; }
.den__hello { display: flex; align-items: center; gap: 22px; }
.avatar { flex: none; width: 92px; height: 92px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px rgba(232, 182, 122, .35); }
.avatar--ph {
  display: grid; place-items: center;
  background: linear-gradient(145deg, #f0c27f, #d0844e); color: #3b2414; font-size: 30px; font-weight: 700; letter-spacing: -.02em;
}

.den__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 6px; }
.den__card { padding: 20px 22px; border-radius: 22px; background: rgba(255, 240, 220, .06); box-shadow: 0 0 0 1px rgba(255, 240, 220, .08); }
.den__card h3 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.den__card p { margin: 8px 0 0; color: rgba(241, 232, 216, .78); line-height: 1.55; }

.trail { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.trail li { position: relative; display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 16px 0 16px 22px; }
.trail li::before { content: ""; position: absolute; left: 0; top: 24px; width: 9px; height: 9px; border-radius: 50%; background: #e8b67a; }
.trail li::after { content: ""; position: absolute; left: 4px; top: 38px; bottom: -10px; border-left: 1px dashed rgba(232, 182, 122, .4); }
.trail li:last-child::after { display: none; }
.trail__when { color: rgba(241, 232, 216, .6); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.trail h3 { margin: 0; font-size: 17px; font-weight: 600; }
.trail h3 span { font-weight: 400; color: rgba(241, 232, 216, .66); }
.trail p { margin: 5px 0 0; color: rgba(241, 232, 216, .78); line-height: 1.5; }

.den__group + .den__group { margin-top: 20px; }
.den__group h3 { margin: 0 0 10px; color: rgba(241, 232, 216, .6); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; }
.chips--soil { margin-top: 20px; }
.den__group .chips--soil { margin-top: 0; }
.chips--soil li { background: rgba(255, 240, 220, .1); color: #f1e8d8; padding: 5px 12px; }

/* bedrock: the end of the dig */
.bedrock {
  position: relative; z-index: 3; min-height: 80vh;
  display: grid; place-content: center; justify-items: center; gap: 0; text-align: center;
  padding: 120px 24px calc(150px + env(safe-area-inset-bottom));
}
.bedrock__title { margin: 0; max-width: 14ch; font-size: clamp(36px, 6.4vw, 76px); font-weight: 650; letter-spacing: -.04em; line-height: 1; }
.bedrock__links { margin-top: 32px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 12px 20px; border-radius: 999px;
  text-decoration: none; font-weight: 500; transition: transform .25s var(--ease), background-color .25s;
}
.btn:hover { transform: translateY(-2px); }
.btn--light { background: #f1e8d8; color: #16130f; }
.btn--ghost { color: #f1e8d8; box-shadow: inset 0 0 0 1px rgba(241, 232, 216, .35); }
.btn--ghost:hover { background: rgba(241, 232, 216, .08); }
.btn:focus-visible, .surface:focus-visible { outline: 2px solid #f1e8d8; outline-offset: 3px; }
.surface {
  margin-top: 44px; border: 0; background: none; cursor: pointer; padding: 8px 12px; border-radius: 999px;
  color: rgba(241, 232, 216, .7); font-weight: 500;
}
.surface:hover { color: #fff; }
.surface span { display: inline-block; transition: transform .3s var(--ease); }
.surface:hover span { transform: translateY(-3px); }
.credit { margin: 26px 0 0; font-size: 11px; color: rgba(241, 232, 216, .42); }
.credit a { color: inherit; }

/* depth gauge, bottom right while underground */
.depth {
  position: fixed; right: 28px; bottom: calc(30px + env(safe-area-inset-bottom)); z-index: 6;
  display: flex; align-items: center; gap: 10px; color: #f1e8d8; font-size: 13px; font-variant-numeric: tabular-nums;
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .4s, transform .4s var(--ease);
}
.depth.is-on { opacity: 1; transform: none; }
.depth b { font-weight: 600; }
.depth em { font-style: normal; color: rgba(241, 232, 216, .6); margin-left: 4px; }
.depth__gauge { position: relative; width: 4px; height: 34px; border-radius: 4px; background: rgba(241, 232, 216, .18); overflow: hidden; }
.depth__gauge i { position: absolute; inset: 0; background: #e8b67a; transform-origin: 50% 0; transform: scaleY(0); }

@media (max-width: 899px) {
  .den { margin-bottom: 110px; }
  .relic { scale: .75; }
}
@media (max-width: 560px) {
  .dens { padding-top: 130px; }
  .den__in { padding: 28px 22px 30px; border-radius: 32px 44px 36px 46px / 40px 32px 44px 36px; }
  .den__hello { gap: 16px; }
  .avatar { width: 68px; height: 68px; }
  .avatar--ph { font-size: 23px; }
  .trail li { grid-template-columns: 1fr; gap: 4px; }
  .depth { right: 16px; }
  .depth em { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .layer--line, .layer--line.is-away { transition: none; }
  .den { clip-path: none; transition: none; }
  .den [data-up] { opacity: 1; transform: none; transition: none; }
  .mole { display: none; }
  .dig-hint i, .relic--worm svg, .worm__body, .relic--gem::after { animation: none; }
  .is-ready .tabs__pill { transition: none; }
}
