/* ── CSS custom properties (tweaked live by the dev panel) ─── */
:root {
  --card-bg: rgba(0, 0, 0, 0.22);
  --card-backdrop: blur(20px) saturate(160%);
  --card-border-color: rgba(100, 100, 100, 0.45);
  --card-text: #f8f8f8;
  --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  --card-inset: inset 0 1px 0 rgba(100, 100, 100, 0.80);
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  overflow-x: hidden;
  font-size: 1.15em;
}

h1,
h3 {
  font-family: "Quintessential", Georgia, serif;
}

h1 {
  font-weight: 900;
  letter-spacing: 0.01em;
}

h2,
h4,
h5,
h6 {
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-weight: 700;
}

#map {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 100%;
  background: #dfe8f3;
}

#map-error {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(920px, calc(100vw - 2rem));
  background: #7f1d1d;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

#header {
  position: relative;
  z-index: 20;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--card-bg);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  border-bottom: 1px solid var(--card-border-color);
  box-shadow: var(--card-shadow), var(--card-inset);
}

#hero-stack {
  position: relative;
  width: 160px;
  height: 180px;
  margin: 0 auto 2.2rem;
}

.hero-card {
  position: absolute;
  margin: 0;
  top: 16px;
  left: 24px;
  background: #fff;
  padding: 4px;
  border-radius: 7px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.30),
    0 4px 10px rgba(0, 0, 0, 0.18);
  transform-origin: center center;
  transition: translate 0.35s ease, box-shadow 0.35s ease;
}

.hero-card:hover {
  translate: 0 -6px;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.36),
    0 8px 16px rgba(0, 0, 0, 0.20);
}

.hero-card img {
  display: block;
  width: 100px;
  height: 134px;
  object-fit: cover;
  border-radius: 3px;
}

.hero-card--back {
  z-index: 1;
  animation:
    hero-spread-back 1.2s ease-out .4s both,
    hero-float-back 3.2s ease-in-out 1.6s infinite;
}

.hero-card--mid {
  z-index: 2;
  animation:
    hero-spread-mid 1.2s ease-out .5s both,
    hero-float-mid 3.8s ease-in-out 1.7s infinite;
}

.hero-card--front {
  z-index: 3;
  animation:
    hero-rise-front 1s ease-out .6s both,
    hero-float-front 4.4s ease-in-out 1.6s infinite;
}

@keyframes hero-spread-back {
  from { transform: rotate(0deg) translate(0px, 0px); }
  to   { transform: rotate(-11deg) translate(-75px, 5px); }
}

@keyframes hero-spread-mid {
  from { transform: rotate(0deg) translate(0px, 0px); }
  to   { transform: rotate(8deg) translate(64px, 0px); }
}

@keyframes hero-rise-front {
  from { transform: rotate(-1.5deg) translateY(10px); }
  to   { transform: rotate(-1.5deg) translateY(0px); }
}

@keyframes hero-float-back {
  0%, 100% { transform: rotate(-11deg) translate(-75px, 5px); }
  50%       { transform: rotate(-11deg) translate(-75px, 1px); }
}

@keyframes hero-float-mid {
  0%, 100% { transform: rotate(8deg) translate(64px, 0px); }
  50%       { transform: rotate(8deg) translate(64px, -5px); }
}

@keyframes hero-float-front {
  0%, 100% { transform: rotate(-1.5deg) translateY(0px); }
  50%       { transform: rotate(-1.5deg) translateY(-6px); }
}

#header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--card-text);
}

#header h2 {
  margin: 0.8rem 0 0;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 500;
  font-style: italic;
  color: rgba(248, 248, 248, 0.75);
}

#story {
  position: relative;
  z-index: 10;
  pointer-events: none;
}

#footer,
#features {
  width: 100%;
  pointer-events: none;
}

#footer > *,
#features > * {
  pointer-events: auto;
}

#footer {
  min-height: 12vh;
  padding: 1.5rem 0.5rem 3rem;
  text-align: center;
  color: #eee;
  font-style: italic;
  font-size: 0.75rem;
  box-sizing: border-box;
}

#footer .back-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: #eee;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-style: normal;
  opacity: 0.75;
  transition: opacity 0.2s;
}

#footer .back-link:hover {
  opacity: 1;
}

#features {
  padding-top: 5vh;
  padding-bottom: 10vh;
}

.step {
  width: min(720px, calc(100vw - 2rem));
  box-sizing: border-box;
  margin: 0 auto 45vh;
  padding: 1.2rem 1.1rem;
  border-radius: 14px;
  background: var(--card-bg);
  backdrop-filter: var(--card-backdrop);
  -webkit-backdrop-filter: var(--card-backdrop);
  border: 1px solid var(--card-border-color);
  box-shadow: var(--card-shadow), var(--card-inset);
  color: var(--card-text);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, color 0.25s;
}

.step:last-child {
  margin-bottom: 20vh;
}

.step.active {
  /* Keep border-color from CSS var; only add the blue focus ring */
  box-shadow: var(--card-shadow), var(--card-inset), 0 0 0 2px rgba(0, 68, 158, 0.22);
}

.step h3 {
  margin-top: 0;
}

.step img {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  margin-bottom: 0.8rem;
}

.chapter-gallery {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  gap: 10px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 20px 20px 20px 20px;
  margin: -10px -10px;
  scroll-snap-type: x mandatory;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}

.chapter-gallery.is-dragging {
  cursor: grabbing;
}

.chapter-gallery-item {
  flex: 0 0 auto;
  margin: 0;
  scroll-snap-align: start;
}

.chapter-gallery-item img {
  display: block;
  width: auto;
  height: 190px;
  max-height: 190px;
  max-width: none;
  object-fit: cover;
  border-radius: 12px;
  margin: 0;
  user-select: none;
  -webkit-user-drag: none;
}

.chapter-gallery::-webkit-scrollbar {
  height: 7px;
}

.chapter-gallery::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 999px;
}

.zoomable-image {
  cursor: zoom-in;
}

.arrow-marker {
  cursor: pointer;
  width: 22px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.arrow-marker svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: filter 0.15s;
}

.arrow-marker:hover svg {
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.55));
}

.fuji-summit-marker {
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.3));
}

body.modal-open {
  overflow: hidden;
}

#image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 12, 0.86);
  backdrop-filter: blur(3px);
  padding: 1rem;
  box-sizing: border-box;
  cursor: zoom-out;
}

#image-modal.is-open {
  display: flex;
}

#image-modal-card {
  background: #ffffff;
  border-radius: 4px;
  padding: 1.25rem 1.25rem 1.6rem;
  max-width: min(92vw, 1100px);
  max-height: 92vh;
  box-sizing: border-box;
  transform: rotate(var(--polaroid-tilt, -0.4deg));
  box-shadow:
    0 26px 45px rgba(35, 25, 18, 0.28),
    0 10px 14px rgba(35, 25, 18, 0.2),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

#image-modal-inner {
  width: fit-content;
  max-width: min(84vw, 1000px);
}

#image-modal img {
  max-width: min(84vw, 1000px);
  max-height: 72vh;
  width: auto;
  height: auto;
  border-radius: 2px;
  display: block;
}

#image-modal-meta {
  margin: 0.7rem 0 0;
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: clamp(0.85rem, 1.2vw, 0.98rem);
  line-height: 1.35;
  color: #555;
  min-height: 0;
  text-align: center;
  overflow-wrap: break-word;
}

#image-modal-meta:empty {
  display: none;
}

#image-modal-note {
  margin: 0.35rem 0 0;
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  line-height: 1.35;
  color: #111;
  min-height: 1.2em;
  text-align: center;
  overflow-wrap: break-word;
}

#image-modal-note:empty {
  display: none;
}

@media (max-width: 700px) {
  #image-modal-card {
    padding: 0.8rem 0.8rem 1rem;
    max-width: 95vw;
    max-height: 95vh;
  }

  #image-modal-inner {
    max-width: 89vw;
  }

  #image-modal img {
    max-width: 89vw;
    max-height: 68vh;
  }
}

.lefty {
  margin-left: 1rem;
  margin-right: auto;
}

.righty {
  margin-left: auto;
  margin-right: 1rem;
}

.centered {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 700px) {
  .step {
    margin-bottom: 35vh;
  }
}

/* ── Thumbnail effects (permanent) ───────────────────────────── */

.chapter-gallery-item {
  transform: rotate(var(--thumb-tilt, 0deg));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chapter-gallery-item img {
  border: 4px solid rgba(255, 255, 255, 0.90);
  border-radius: 3px;
  box-sizing: content-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chapter-gallery-item img:hover,
.chapter-gallery-item.thumb-active img {
  transform: translateY(-7px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.40);
}
