/* ============================================================
   TOHU HERITAGE — Shared Site-Page Styles
   Loaded by all site pages (clark-house, swans-arch, etc.)
   Do NOT load on the map page (index.html) or content pages.
   ============================================================ */

/* --- Nav: initial hide states (mobile elements hidden on desktop) --- */
.nav-left-wrap  { display: flex; align-items: center; gap: 10px; }
.nav-left-text  { display: flex; flex-direction: column; gap: 1px; }
.nav-mobile-count {
  display: none;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: rgba(240,237,230,0.55); font-weight: 300; white-space: nowrap;
}
.nav-mobile-value   { color: var(--bone); font-weight: 500; }
.nav-menu-btn       { display: none; }
.mobile-menu        { display: none; }
.mobile-menu-overlay{ display: none; }
.sites-count        { display: none; }
.nav-search         { display: none; }
.nav-search-btn     { display: none; }
.mobile-search      { display: none; }
.nav-mobile-row     { display: none; }
body { overflow-x: hidden; }

/* --- Mobile nav (≤768px) --- */
@media (max-width: 768px) {
  .nav-mobile-count { display: block; }
  .nav-sub  { font-size: 12px; }
  .nav-logo-img { height: 44px; }
  .nav {
    padding: env(safe-area-inset-top, 0) max(24px, calc(env(safe-area-inset-right, 0px) + 16px)) 0 max(14px, calc(env(safe-area-inset-left, 0px) + 6px));
    height: calc(56px + env(safe-area-inset-top, 0px));
  }
  .nav-left-wrap { gap: 6px; }

  .nav-menu-btn {
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    gap: 5px; width: 34px; height: 34px;
    background: rgba(38,160,107,0.1);
    border: 0.5px solid rgba(38,160,107,0.45);
    cursor: pointer; flex-shrink: 0; padding: 0; margin-right: -8px;
    -webkit-tap-highlight-color: rgba(38,160,107,0.2);
    touch-action: manipulation;
  }
  .nav-menu-btn span {
    display: block; width: 15px; height: 1px;
    background: rgba(38,160,107,0.85);
    transition: transform 0.28s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease;
    transform-origin: center;
  }
  .nav-menu-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-menu-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-menu-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .mobile-menu-overlay {
    display: block !important; position: fixed; inset: 0; z-index: 100; pointer-events: none;
  }
  .mobile-menu-overlay.open { pointer-events: all; }

  .mobile-menu {
    display: block !important; position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    right: 0; left: auto; width: fit-content; min-width: 160px;
    background: rgba(13,13,10,0.25);
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-left: 0.5px solid rgba(240,237,230,0.07);
    border-bottom: 0.5px solid rgba(240,237,230,0.07);
    z-index: 101; transform: translateX(110%); opacity: 0; visibility: hidden;
    transition: transform 0.32s cubic-bezier(0.25,0.46,0.45,0.94),
                opacity 0.32s ease, visibility 0s linear 0.32s;
    pointer-events: none;
  }
  .mobile-menu.open {
    transform: translateX(0); opacity: 1; visibility: visible; pointer-events: all;
    transition: transform 0.32s cubic-bezier(0.25,0.46,0.45,0.94),
                opacity 0.32s ease, visibility 0s;
  }
  .mobile-menu a {
    display: flex; flex-direction: column-reverse; gap: 3px;
    padding: 9px 24px; font-size: 10px; letter-spacing: 3px;
    text-transform: uppercase; color: rgba(240,237,230,0.55);
    border-bottom: 0.5px solid rgba(240,237,230,0.05);
    text-decoration: none; font-family: var(--font-body);
    font-weight: 300; transition: color 0.2s;
  }
  .mobile-menu a:last-child { border-bottom: none; }
  .mobile-menu a:hover { color: var(--bone); }
  .mobile-menu a:hover .menu-maori { color: rgba(46,217,150,0.5); }
  .menu-maori {
    font-size: 11px; letter-spacing: 2px; text-transform: lowercase;
    color: rgba(240,237,230,0.55); font-style: italic;
    font-weight: 300; transition: color 0.2s;
  }

  .nav-mobile-row { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
  .nav-search-btn {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; background: none; border: none;
    cursor: pointer; color: #F0EDE6; padding: 0; margin-left: -4px;
    flex-shrink: 0; -webkit-tap-highlight-color: transparent; transition: color 0.2s;
  }
  .nav-search-btn.active { color: var(--bone); }
  @keyframes searchPop {
    0%   { transform: scale(1) rotate(0deg); }
    40%  { transform: scale(1.3) rotate(-14deg); }
    100% { transform: scale(1) rotate(0deg); }
  }
  .nav-search-btn.animating svg { animation: searchPop 0.32s cubic-bezier(0.25,0.46,0.45,0.94); }
  @keyframes navIconBreath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
  @keyframes navCopyrightPop { 0% { transform: scale(1) rotate(0deg); } 40% { transform: scale(1.35) rotate(14deg); } 100% { transform: scale(1) rotate(0deg); } }
  .nav-copyright-btn {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; font-size: 17px; line-height: 1;
    color: #F0EDE6; text-decoration: none;
    padding: 0; flex-shrink: 0; -webkit-tap-highlight-color: transparent;
    animation: navIconBreath 2.4s ease-in-out infinite 1.2s; transition: color 0.2s;
  }
  .nav-copyright-btn:visited, .nav-copyright-btn:active, .nav-copyright-btn:focus { color: #F0EDE6; text-decoration: none; outline: none; }
  .nav-copyright-btn:hover { color: #F0EDE6; }
  .nav-copyright-btn.animating { animation: navCopyrightPop 0.32s cubic-bezier(0.25,0.46,0.45,0.94); }
  .nav-partner-btn {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; color: #F0EDE6; text-decoration: none;
    padding: 0; flex-shrink: 0; -webkit-tap-highlight-color: transparent;
    animation: navIconBreath 2.4s ease-in-out infinite 0.6s; transition: color 0.2s;
  }
  .nav-partner-btn:visited, .nav-partner-btn:active, .nav-partner-btn:focus { color: #F0EDE6; text-decoration: none; outline: none; }
  .nav-partner-btn:hover { color: #F0EDE6; }

  .mobile-search {
    display: block !important; position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: 0; right: 0; z-index: 102;
    background: rgba(13,13,10,0.98); backdrop-filter: blur(20px);
    border-bottom: 0.5px solid rgba(46,217,150,0.35);
    transform: translateY(-110%); opacity: 0;
    transition: transform 0.26s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.26s ease;
    pointer-events: none;
  }
  .mobile-search.open { transform: translateY(0); opacity: 1; pointer-events: all; }
  .mobile-search-bar {
    display: flex; align-items: center; padding: 12px 20px; gap: 10px;
    border-bottom: 0.5px solid rgba(240,237,230,0.06);
  }
  .mobile-search-icon-lbl { color: rgba(240,237,230,0.3); font-size: 15px; flex-shrink: 0; }
  .mobile-search-input {
    flex: 1; background: none; border: none; color: var(--bone);
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    font-family: var(--font-body); font-weight: 300;
    outline: none; letter-spacing: 0.3px;
  }
  .mobile-search-input::placeholder { color: rgba(240,237,230,0.3); }
  .mobile-search-close {
    background: none; border: none; color: rgba(240,237,230,0.4); cursor: pointer;
    padding: 4px; flex-shrink: 0; display: flex; align-items: center;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-search-results { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .mobile-search-result {
    display: block; padding: 14px 24px;
    border-bottom: 0.5px solid rgba(240,237,230,0.05);
    cursor: pointer; -webkit-tap-highlight-color: rgba(38,160,107,0.08);
  }
  .mobile-search-result:last-child { border-bottom: none; }
  .mobile-search-result:active { background: rgba(240,237,230,0.04); }
  .mobile-search-result-name { font-size: 13px; font-weight: 500; color: rgba(240,237,230,0.85); }
  .mobile-search-result-loc  { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(240,237,230,0.55); margin-top: 3px; }
}

/* --- Hero: decorative hei-tiki (mobile only) --- */
.hero-hei-tiki { display: none; }
@media (max-width: 768px) {
  .site-hero { overflow: hidden; }
  .hero-hei-tiki {
    display: block; position: absolute;
    top: 37px; right: -27px; width: 160px; height: 160px;
    opacity: 0.38; pointer-events: none; z-index: 5;
    filter: invert(1) grayscale(1); mix-blend-mode: overlay;
  }
  .viewer-wrap { width: 100%; margin-left: 0; }
}

/* --- Hero map background --- */
#hero-map {
  position: absolute; top: 0; right: 0;
  width: 60%; height: 100%; z-index: 0; pointer-events: none;
}
.hero-map-fade {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(13,13,10,0.2) 0%, rgba(13,13,10,0.97) 100%),
    linear-gradient(135deg, var(--pounamu) 0%, var(--obsidian) 60%);
  -webkit-mask-image: linear-gradient(to right, black 38%, transparent 72%);
  mask-image: linear-gradient(to right, black 38%, transparent 72%);
}
.site-hero-content { position: relative; z-index: 2; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }
@media (max-width: 768px) { #hero-map { display: none; } }

/* --- Scroll-depth indicator --- */
#scroll-indicator {
  position: fixed; right: 18px; bottom: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 200; pointer-events: none;
}
#scroll-indicator svg { color: rgba(240,237,230,0.55); display: block; }
.scroll-track {
  width: 1px; height: 80px;
  background: rgba(240,237,230,0.12); position: relative; border-radius: 1px;
}
.scroll-thumb {
  position: absolute; left: -1px; width: 3px; height: 16px;
  background: rgba(240,237,230,0.55); border-radius: 2px; transition: top 0.1s linear;
}
@media (max-width: 768px) {
  #scroll-indicator {
    right: max(6px, env(safe-area-inset-right, 6px));
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
  }
}

/* --- Hei-tiki eye star animation (mobile only) --- */
.tiki-eye-star {
  display: none; position: absolute; width: 26px; height: 26px;
  pointer-events: none; z-index: 7; overflow: visible;
}
@keyframes starshine {
  0%   { opacity: 0;    filter: blur(2px); }
  72%  { opacity: 0;    filter: blur(2px); }
  86%  { opacity: 0.12; filter: blur(1px); }
  93%  { opacity: 0.38; filter: blur(0px) drop-shadow(0 0 3px rgba(255,255,255,0.5)) drop-shadow(0 0 8px rgba(210,228,255,0.28)); }
  97%  { opacity: 0.14; filter: blur(0.8px); }
  100% { opacity: 0;    filter: blur(2px); }
}
@media (max-width: 768px) {
  .tiki-eye-star { display: block; }
  .tiki-eye-star.left  { right: 78px; top: 93px;  transform: translate(50%,-50%); animation: starshine 9s ease-in-out infinite; }
  .tiki-eye-star.right { right: 23px; top: 146px; transform: translate(50%,-50%); animation: starshine 9s ease-in-out infinite 4.5s; }
}

/* --- Viewer → content transition --- */
.viewer-section { position: relative; }
.viewer-section::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 140px;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, var(--obsidian) 100%);
  pointer-events: none; z-index: 6;
}
@media (max-width: 768px) {
  .viewer-section::after { height: 110px; }
}
.viewer-divider {
  height: 0.5px;
  background: linear-gradient(to right,
    transparent 0%, rgba(38,160,107,0.07) 20%,
    rgba(38,160,107,0.22) 50%,
    rgba(38,160,107,0.07) 80%, transparent 100%
  );
}

/* --- Scroll-reveal animation --- */
.reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.85s cubic-bezier(0.25,0.46,0.45,0.94),
              transform 0.85s cubic-bezier(0.25,0.46,0.45,0.94);
  will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }
.content-title.reveal {
  filter: blur(4px);
  transition: opacity 1.15s cubic-bezier(0.25,0.46,0.45,0.94),
              transform 1.15s cubic-bezier(0.25,0.46,0.45,0.94),
              filter 1.15s cubic-bezier(0.25,0.46,0.45,0.94);
}
.content-title.reveal.in-view { filter: none; }

/* --- "Next site" footer link --- */
.site-next {
  border-top: 0.5px solid rgba(240,237,230,0.07);
  padding: 12px 48px 24px; text-align: center;
}
.site-next-label {
  font-size: 9px; letter-spacing: 4px; text-transform: uppercase;
  color: var(--mist); margin-bottom: 16px; font-weight: 300;
}
.site-next-title {
  font-family: var(--font-display);
  font-size: 30px; font-style: italic;
  color: var(--bone); margin-bottom: 32px; font-weight: 300;
}

/* --- Desktop nav links + search (≥769px) --- */
@media (min-width: 769px) {
  .nav-links {
    display: flex; align-items: stretch; justify-content: center; height: 56px; margin-left: 8px;
  }
  .nav-links .nav-link {
    display: flex; flex-direction: column-reverse;
    align-items: center; justify-content: center; text-align: center; gap: 3px;
    padding: 0 6px; font-size: 9px; letter-spacing: 2px;
    text-transform: uppercase; color: rgba(240,237,230,0.55);
    text-decoration: none; font-family: var(--font-body);
    font-weight: 500; transition: color 0.2s;
    border-left: 0.5px solid rgba(240,237,230,0.07); white-space: nowrap;
  }
  .nav-links .nav-link:first-child { border-left: none; }
  .nav-links .nav-link:hover { color: rgba(240,237,230,0.9); }
  .nav-link-en, .nav-link-maori { display: block; width: 100%; text-align: center; }
  .nav-link-maori {
    font-size: 10px; letter-spacing: 2px; text-transform: lowercase;
    font-style: italic; font-weight: 300; color: rgba(240,237,230,0.2); transition: color 0.15s;
  }
  .nav-links .nav-link:hover .nav-link-maori { color: rgba(240,237,230,0.4); }
  .sites-count { display: flex; flex-direction: row; align-items: baseline; gap: 7px; }
  .count-number { font-size: 14px; font-weight: 500; font-family: var(--font-body); color: var(--bone); line-height: 1; }
  .count-label  { font-size: 8px; letter-spacing: 2px; text-transform: uppercase; color: rgba(240,237,230,0.3); font-weight: 500; font-family: var(--font-body); }
  .count-div    { font-weight: 500; font-family: var(--font-body); margin: 0 1px; opacity: 0.6; }
  .count-inf    { font-size: 1.1em; font-weight: 500; font-family: var(--font-body); opacity: 0.85; margin-left: 1px; vertical-align: middle; }
  .site-back    { margin-top: 11px; }
  .nav-search {
    display: flex; align-items: center; flex: 1; max-width: 220px; margin: 0 20px; position: relative;
  }
  .nav-search-input {
    width: 100%; background: rgba(240,237,230,0.05);
    border: 0.5px solid rgba(240,237,230,0.1); color: var(--bone);
    padding: 6px 12px 6px 28px; font-size: 10px;
    font-family: var(--font-body); font-weight: 300; letter-spacing: 0.5px; outline: none;
  }
  .nav-search-input:focus-visible { outline: 2px solid rgba(255,255,255,0.25); outline-offset: -2px; }
  .nav-search-input::placeholder { color: rgba(240,237,230,0.3); }
  .nav-search-icon {
    position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
    color: rgba(240,237,230,0.3); font-size: 11px; pointer-events: none;
  }
  .search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(13,13,10,0.98); border: 0.5px solid rgba(240,237,230,0.12);
    border-top: none; z-index: 300; display: none; backdrop-filter: blur(16px);
  }
  .search-results.visible { display: block; }
  .search-result-item {
    padding: 10px 14px; cursor: pointer;
    border-bottom: 0.5px solid rgba(240,237,230,0.05); transition: background 0.15s;
  }
  .search-result-item:last-child { border-bottom: none; }
  .search-result-item:hover { background: rgba(240,237,230,0.04); }
  .search-result-name { font-size: 11px; font-weight: 500; letter-spacing: 1px; color: rgba(240,237,230,0.85); }
  .search-result-loc  { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(240,237,230,0.55); margin-top: 2px; }
}