/* ============================================================
   MAMMOTH RIDGE — "Sediment Core"
   The page is a stratigraphic dig: each section is a stratum,
   scrolling is digging deeper. Mobile-first.
   ============================================================ */

:root {
  --peat:      #241C14;   /* deep soil — page base       */
  --peat-2:    #1B140E;   /* deepest / bedrock           */
  --bone:      #E9DFC9;   /* bone ivory — cards, light   */
  --bone-2:    #DACFB4;
  --limestone: #B7A98E;   /* secondary text, borders     */
  --ochre:     #A15B2B;   /* red earth — accents, links  */
  --ochre-hot: #C4732F;
  --umber:     #5C4632;   /* clay — mid strata           */
  --umber-2:   #46352A;
  --glacial:   #57736B;   /* sparse Ice Age accent       */
  --flame-1:   #FFB347;
  --flame-2:   #FF7A1A;
  --flame-3:   #D94F04;

  --font-display: 'Alfa Slab One', 'Rockwell', serif;
  --font-body: 'Alegreya', Georgia, serif;
  --font-tag: 'Alegreya Sans SC', 'Trebuchet MS', sans-serif;

  --content-w: 62rem;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--peat);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  overflow-x: hidden;
  /* faint sediment grain */
  background-image:
    radial-gradient(rgba(233, 223, 201, 0.025) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.18) 1px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
}

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

a { color: var(--ochre-hot); }
a:hover { color: var(--flame-1); }

:focus-visible {
  outline: 3px solid var(--flame-1);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

.skip-link {
  position: absolute; left: 0.5rem; top: -3rem;
  background: var(--ochre); color: var(--bone);
  padding: 0.5rem 1rem; z-index: 100; transition: top 0.15s;
  border-radius: 0 0 6px 6px; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ---------- Type ---------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; }

h1 { font-size: clamp(2.2rem, 8vw, 4.5rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.5rem, 4.5vw, 2.4rem); color: var(--bone); }
h3 { font-size: clamp(1.15rem, 3vw, 1.5rem); }

.eyebrow {
  font-family: var(--font-tag);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--ochre-hot);
}

/* ============================================================
   TORCHES — fire on poles
   ============================================================ */

main { position: relative; }

.torch {
  position: absolute;
  top: 1.2rem;
  width: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  z-index: 3;
}
.torch--left  { left:  clamp(0.5rem, 3vw, 2.5rem); }
.torch--right { right: clamp(0.5rem, 3vw, 2.5rem); }

.pole {
  width: 9px;
  height: clamp(90px, 16vh, 150px);
  background: linear-gradient(180deg, #6E5138 0%, #3E2D1E 60%, #2A1E13 100%);
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset -2px 0 2px rgba(0,0,0,0.5);
}
.pole::before {
  /* wrapped binding at the head of the pole */
  content: "";
  display: block;
  width: 13px; height: 14px;
  margin: -2px 0 0 -2px;
  background: repeating-linear-gradient(-25deg, #7A5A3A 0 3px, #4A3520 3px 6px);
  border-radius: 3px;
}

.flame {
  position: relative;
  width: 26px; height: 40px;
  margin-bottom: -4px;
  filter: blur(0.8px) drop-shadow(0 0 14px rgba(255, 122, 26, 0.55));
}
.flame span {
  position: absolute;
  bottom: 0; left: 50%;
  border-radius: 50% 50% 22% 22% / 62% 62% 30% 30%;
  transform-origin: 50% 100%;
}
.flame span:nth-child(1) {
  width: 24px; height: 38px; margin-left: -12px;
  background: radial-gradient(ellipse at 50% 85%, var(--flame-3) 0%, var(--flame-2) 55%, transparent 78%);
  animation: flicker 1.7s ease-in-out infinite;
}
.flame span:nth-child(2) {
  width: 16px; height: 28px; margin-left: -8px;
  background: radial-gradient(ellipse at 50% 85%, var(--flame-2) 0%, var(--flame-1) 60%, transparent 80%);
  animation: flicker 1.1s ease-in-out infinite reverse;
}
.flame span:nth-child(3) {
  width: 8px; height: 15px; margin-left: -4px;
  background: radial-gradient(ellipse at 50% 90%, #FFE9B0 0%, var(--flame-1) 70%, transparent 85%);
  animation: flicker 0.75s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { transform: scaleY(1)    scaleX(1)    rotate(-1.5deg); opacity: 0.95; }
  25%      { transform: scaleY(1.12) scaleX(0.92) rotate(1.8deg);  opacity: 1; }
  50%      { transform: scaleY(0.88) scaleX(1.06) rotate(-2.5deg); opacity: 0.85; }
  75%      { transform: scaleY(1.06) scaleX(0.95) rotate(1deg);    opacity: 1; }
}

.torch--small { position: static; }
.torch--small .pole  { height: 64px; }
.torch--small .flame { width: 20px; height: 30px; }

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: relative;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0)),
    linear-gradient(180deg, var(--umber-2), var(--peat));
  border-bottom: 3px solid var(--umber);
  padding: 0.75rem 0;
}

.header-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 4rem;   /* clear the torches */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex; align-items: center; gap: 0.6rem;
  text-decoration: none; color: var(--bone);
}
.brand-mark { width: 46px; height: 46px; flex: none; }
.brand-text {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.45);
}

.nav-toggle {
  display: none;
  background: none; border: 2px solid var(--umber); border-radius: 6px;
  padding: 0.5rem 0.55rem; cursor: pointer;
}
.nav-toggle-bar {
  display: block; width: 22px; height: 3px; border-radius: 2px;
  background: var(--bone); margin: 4px 0;
}

.nav-list {
  display: flex; align-items: center; gap: 0.25rem;
  list-style: none;
}
.nav-list a {
  display: block;
  font-family: var(--font-tag); font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.85rem;
  color: var(--bone-2); text-decoration: none;
  padding: 0.55rem 0.8rem; border-radius: 6px;
}
.nav-list a:hover { color: var(--flame-1); background: rgba(0,0,0,0.25); }
.nav-list a[aria-current="page"] {
  color: var(--ochre-hot);
  box-shadow: inset 0 -3px 0 var(--ochre);
}

.sound-toggle {
  background: none; border: 2px solid var(--umber); border-radius: 50%;
  width: 2.4rem; height: 2.4rem; cursor: pointer; font-size: 1rem;
  color: var(--bone); line-height: 1;
}
.sound-toggle .sound-off { display: none; }
.sound-toggle[aria-pressed="false"] .sound-on  { display: none; }
.sound-toggle[aria-pressed="false"] .sound-off { display: inline; }

@media (max-width: 47rem) {
  .header-inner { padding: 0 3.2rem; }
  .nav-toggle { display: block; }
  .site-nav { position: relative; }
  .nav-list {
    display: none;
    position: absolute; right: 0; top: calc(100% + 0.5rem);
    flex-direction: column; align-items: stretch;
    background: var(--umber-2);
    border: 2px solid var(--umber); border-radius: 10px;
    padding: 0.5rem; min-width: 12rem; z-index: 50;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  }
  .nav-list.open { display: flex; }
  .nav-sound { align-self: center; padding-top: 0.4rem; }
}

/* ============================================================
   STRATA — the signature. Sections are sediment layers with
   jagged SVG boundaries and depth labels in the margin.
   ============================================================ */

.stratum { position: relative; padding: clamp(2.5rem, 7vw, 5rem) 1.25rem; }

.stratum--surface { background: linear-gradient(180deg, var(--umber-2) 0%, var(--umber) 100%); }
.stratum--topsoil { background: var(--umber); }
.stratum--clay    { background: var(--umber-2); }
.stratum--deep    { background: var(--peat); }
.stratum--bedrock { background: var(--peat-2); }

.stratum-label {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  left: 0.35rem;
  writing-mode: vertical-rl;
  font-family: var(--font-tag); font-weight: 700;
  font-size: 0.68rem; letter-spacing: 0.42em; text-transform: uppercase;
  color: rgba(233, 223, 201, 0.32);
  user-select: none;
}
.stratum-label::after {
  content: "";
  display: block; margin-top: 0.8rem;
  width: 1px; height: 3.2rem;
  background: linear-gradient(180deg, rgba(233,223,201,0.32), transparent);
}

/* jagged earth boundary: sits at the top of a stratum, filled with
   the color of the layer above so the layers bite into each other */
.layer-break {
  position: absolute;
  top: -1px; left: 0;
  width: 100%; height: 26px;
  pointer-events: none;
}

.stratum-inner { max-width: var(--content-w); margin: 0 auto; padding-left: 1.4rem; }

.section-head { margin-bottom: clamp(1.4rem, 4vw, 2.4rem); }
.section-head .eyebrow { display: block; margin-bottom: 0.4rem; }

/* ============================================================
   HERO — cave-painting mammoth over the dig
   ============================================================ */

.hero { text-align: center; padding-bottom: 0; overflow: hidden; }

.hero-inner { max-width: var(--content-w); margin: 0 auto; position: relative; z-index: 2; }

.hero .eyebrow { display: block; margin-bottom: 0.8rem; }

.hero h1 {
  color: var(--bone);
  text-shadow: 3px 4px 0 rgba(0, 0, 0, 0.45);
}
.hero h1 .accent { color: var(--ochre-hot); }

.hero-sub {
  max-width: 38rem; margin: 1rem auto 0;
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  font-style: italic; color: var(--bone-2);
}

.hero-mammoth {
  width: min(560px, 82vw);
  margin: clamp(1rem, 4vw, 2.5rem) auto -6px;
  color: var(--ochre);
}

.hero-actions {
  display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap;
  margin-top: 1.6rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-tag); font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.9rem;
  text-decoration: none; cursor: pointer;
  padding: 0.75rem 1.5rem; border-radius: 8px;
  border: 2px solid var(--ochre);
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ochre); color: var(--bone); }
.btn-primary:hover { background: var(--ochre-hot); color: #fff; }
.btn-ghost { background: transparent; color: var(--ochre-hot); }
.btn-ghost:hover { background: rgba(161, 91, 43, 0.15); color: var(--flame-1); }

/* ============================================================
   FOSSIL FIELD-JACKET CARDS
   Bone-toned plaster boxes with torn edges and specimen tags.
   ============================================================ */

.jacket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1rem, 3vw, 1.8rem);
}

.jacket {
  position: relative;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.5), transparent 55%),
    linear-gradient(160deg, var(--bone) 0%, var(--bone-2) 100%);
  color: #33291D;
  padding: 1.1rem 1.1rem 1.25rem;
  /* torn plaster edges */
  border-radius: 1.1rem 0.35rem 1.4rem 0.5rem;
  border: 1px solid rgba(60, 45, 30, 0.35);
  box-shadow:
    0 3px 0 rgba(0,0,0,0.35),
    0 14px 28px rgba(0,0,0,0.45),
    inset 0 0 22px rgba(122, 96, 65, 0.22);
}
.jacket:nth-child(2n)  { border-radius: 0.4rem 1.3rem 0.5rem 1.2rem; transform: rotate(0.4deg); }
.jacket:nth-child(3n)  { border-radius: 1.3rem 0.5rem 0.9rem 1.35rem; transform: rotate(-0.35deg); }
.jacket:nth-child(5n)  { transform: rotate(0.25deg); }

.jacket h3 { color: #4A3520; margin-bottom: 0.35rem; }
.jacket p  { color: #4E4030; font-size: 0.98rem; }

.specimen-tag {
  display: inline-block;
  font-family: var(--font-tag); font-weight: 700;
  font-size: 0.68rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--bone);
  background: var(--umber);
  padding: 0.22rem 0.6rem;
  border-radius: 3px;
  margin-bottom: 0.7rem;
  box-shadow: 1px 2px 0 rgba(0,0,0,0.4);
}
.specimen-tag--ochre { background: var(--ochre); }
.specimen-tag--glacial { background: var(--glacial); }

/* media inside jackets */
.jacket-media {
  margin: 0 -0.35rem 0.8rem;
  border-radius: 0.7rem 0.3rem 0.8rem 0.35rem;
  overflow: hidden;
  border: 3px solid rgba(60, 45, 30, 0.5);
  background: #1a140d;
}
.jacket-media img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.25s ease;
}
.jacket-media img:hover { transform: scale(1.04); }
.jacket-media video { width: 100%; background: #000; }

.jacket-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; flex-wrap: wrap;
  margin-top: 0.6rem;
  font-size: 0.85rem; color: #6B5A45;
  font-family: var(--font-tag); letter-spacing: 0.06em;
}
.jacket-meta a { color: var(--ochre); font-weight: 700; text-decoration: none; }
.jacket-meta a:hover { color: var(--ochre-hot); text-decoration: underline; }

/* gallery filter tabs */
.dig-tabs {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: clamp(1.2rem, 3vw, 2rem);
}
.dig-tabs a {
  font-family: var(--font-tag); font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.15em; font-size: 0.82rem; text-decoration: none;
  color: var(--bone-2);
  border: 2px solid var(--umber); border-radius: 999px;
  padding: 0.45rem 1.1rem;
}
.dig-tabs a:hover { border-color: var(--ochre); color: var(--flame-1); }
.dig-tabs a.active { background: var(--ochre); border-color: var(--ochre); color: var(--bone); }

.empty-trench {
  border: 2px dashed var(--umber);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--limestone);
  font-style: italic;
}

/* ============================================================
   PROSE (about page) & misc content
   ============================================================ */

.prose { max-width: 44rem; }
.prose p + p { margin-top: 1rem; }
.prose h3 { margin: 1.8rem 0 0.6rem; color: var(--bone); }
.prose ul { margin: 0.8rem 0 0.8rem 1.4rem; }
.prose li + li { margin-top: 0.35rem; }
.prose .lead { font-size: 1.2rem; font-style: italic; color: var(--bone-2); }

.fact-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: 1rem;
  margin: 1.8rem 0;
}
.fact {
  border-left: 4px solid var(--ochre);
  background: rgba(0,0,0,0.22);
  border-radius: 0 10px 10px 0;
  padding: 0.9rem 1rem;
}
.fact .fact-num {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  color: var(--ochre-hot);
}
.fact .fact-label {
  font-family: var(--font-tag); font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.72rem;
  color: var(--limestone);
}

/* owner portrait beside the intro prose */
.story-intro {
  display: flex;
  gap: clamp(1.4rem, 4vw, 3rem);
  align-items: flex-start;
  flex-wrap: wrap;
}
.story-intro .prose { flex: 1 1 26rem; }
.portrait-jacket {
  flex: 0 1 19rem;
  margin: 0;
}
.portrait-jacket .jacket-media img {
  aspect-ratio: auto;
  object-fit: contain;
  width: 100%;
  height: auto;
  cursor: default;
}
.portrait-jacket figcaption {
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: #6B5A45;
  font-style: italic;
}

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.4rem 0;
  border: 3px solid rgba(233, 223, 201, 0.25);
  border-radius: 12px 5px 14px 6px;
  overflow: hidden;
  background: #000;
}
.video-embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

.map-embed { aspect-ratio: 16 / 10; max-width: 56rem; }
.map-note {
  margin-top: 0.8rem;
  font-family: var(--font-tag); letter-spacing: 0.06em;
  font-size: 0.9rem; color: var(--limestone);
}

.sources {
  margin-top: 2rem; padding-top: 1rem;
  border-top: 1px solid var(--umber);
  font-size: 0.85rem; color: var(--limestone);
}
.sources a { color: var(--limestone); overflow-wrap: anywhere; }
.sources a:hover { color: var(--ochre-hot); }
.sources li { margin-top: 0.3rem; }

/* ============================================================
   FORMS (contact + admin)
   ============================================================ */

.form-jacket { max-width: 34rem; }
.form-row { margin-bottom: 1.1rem; }
.form-row label {
  display: block; margin-bottom: 0.3rem;
  font-family: var(--font-tag); font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.8rem;
  color: #4A3520;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  font-family: var(--font-body); font-size: 1rem;
  color: #2E2418;
  background: #F5EEDD;
  border: 2px solid #8A7355; border-radius: 8px;
  padding: 0.65rem 0.8rem;
}
.form-row input:focus, .form-row textarea:focus {
  outline: 3px solid var(--ochre-hot); outline-offset: 1px;
}
.form-row textarea { min-height: 9rem; resize: vertical; }

.hp-field { position: absolute; left: -6000px; top: auto; }

.notice {
  border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 1.3rem;
  font-family: var(--font-tag); letter-spacing: 0.04em;
}
.notice--ok  { background: rgba(87, 115, 107, 0.28); border: 2px solid var(--glacial); color: #CFE0DA; }
.notice--err { background: rgba(161, 43, 43, 0.22); border: 2px solid #A12B2B; color: #EFC9C9; }

/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 14, 8, 0.94);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.lightbox[hidden] { display: none; }
.lightbox-body { max-width: min(70rem, 94vw); max-height: 90vh; text-align: center; }
.lightbox-body img {
  max-height: 78vh; width: auto; max-width: 100%;
  margin: 0 auto;
  border: 6px solid var(--bone);
  border-radius: 8px 3px 10px 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.lightbox-body figcaption {
  margin-top: 0.8rem; color: var(--bone-2); font-style: italic;
}
.lightbox-close {
  position: absolute; top: 0.8rem; right: 1.1rem;
  background: none; border: none; cursor: pointer;
  color: var(--bone); font-size: 2.6rem; line-height: 1;
}
.lightbox-close:hover { color: var(--flame-1); }

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer { text-align: center; border-top: 3px solid var(--umber); }
.footer-inner { max-width: var(--content-w); margin: 0 auto; }
.footer-torches {
  display: flex; justify-content: center; gap: clamp(4rem, 20vw, 12rem);
  margin-bottom: 1.2rem;
}
.footer-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--bone); }
.footer-sub { color: var(--limestone); font-size: 0.95rem; margin-top: 0.2rem; }
.footer-nav { display: flex; justify-content: center; gap: 1.3rem; flex-wrap: wrap; margin: 1.1rem 0; }
.footer-nav a {
  font-family: var(--font-tag); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--bone-2); text-decoration: none;
}
.footer-nav a:hover { color: var(--flame-1); }
.footer-fine { color: rgba(183, 169, 142, 0.6); font-size: 0.82rem; font-style: italic; }

/* ============================================================
   ADMIN
   ============================================================ */

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.admin-table th, .admin-table td {
  text-align: left; padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(92, 70, 50, 0.6);
}
.admin-table th {
  font-family: var(--font-tag); letter-spacing: 0.12em;
  text-transform: uppercase; font-size: 0.75rem; color: var(--limestone);
}
.table-scroll { overflow-x: auto; }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.75rem; }
.btn-danger { border-color: #A12B2B; color: #E08A8A; background: transparent; }
.btn-danger:hover { background: rgba(161, 43, 43, 0.25); color: #fff; }

.msg-block {
  background: rgba(0,0,0,0.25); border: 1px solid var(--umber);
  border-radius: 10px; padding: 0.9rem 1.1rem; margin-bottom: 0.9rem;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem;
}
.msg-block .msg-head { color: var(--ochre-hot); font-family: var(--font-tag); letter-spacing: 0.06em; }

/* ============================================================
   Scroll reveal + reduced motion
   ============================================================ */

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flame span { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .jacket-media img { transition: none; }
}
