/* ========== Canvas & Typography (no scroll) ========== */
html, body {
  height: 100svh;
  margin: 0;
  overflow: hidden;                /* museum-like, no page scroll */
  background: #fff;                /* Fallback background */
  color: #111;
  font: 400 17px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}

/* Center content on every page */
main {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

/* ========== Home center text ========== */
.home-center { height: 100%; display: grid; place-items: center; }

.center-phrase {
  background: none; border: 0; cursor: default;
  display: inline-grid; gap: .18rem;
  letter-spacing: .02em; line-height: 1.06;
  font-size: clamp(24px, 4.2vw, 46px);
  will-change: opacity, clip-path, filter;
}

/* Brush-stroke reveal (subtle wipe-in) */
@keyframes brushReveal {
  from { clip-path: inset(0 100% 0 0 round .5rem); filter: blur(4px) saturate(.85); opacity: .92; }
  60%  { clip-path: inset(0 0 0 0 round .5rem);   filter: blur(0)   saturate(1);    opacity: 1;  }
  to   { clip-path: inset(0 0 0 0 round .5rem);   filter: blur(0);                      opacity: 1;  }
}
.brush-reveal { animation: brushReveal 1.6s ease-out 400ms both; }

/* Evaporation to watermark (very slow, uneven) */
@keyframes unevenEvaporate {
  0%   { opacity: 1   }
  100% { opacity: .16 } /* watermark endpoint */
}
.evaporate { animation: unevenEvaporate 60s ease-out 2.2s both; }

/* ========== Edge Navigation (Arrows) ========== */
/* We keep these fixed and "hittable" with a transparent background.
   Without a background or dimensions, hover often fails to trigger. 
*/
/* Unify the edge hit-boxes */
.edge {
  position: fixed;
  z-index: 999; /* Ensure it stays above content */
  top: 0;
  bottom: 0;
  width: 15vw;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: rgba(0,0,0,0); /* Solid hit area but transparent */
}

.edge-left   { top: 0; bottom: 0; left: 0; width: 15vw; }
.edge-right  { top: 0; bottom: 0; right: 0; width: 15vw; }
.edge-top    { top: 0; left: 0; right: 0; height: 10vh; }
.edge-bottom { bottom: 0; left: 0; right: 0; height: 10vh; }

/* Ensure the central poem/text is the top priority for interaction */
.work-body {
  position: relative;
  z-index: 50;
  max-width: 70vw;
  margin: 0 auto;
  pointer-events: auto;
}

.edge .arrow { 
  font-size: 2rem;
  color: #000;
  opacity: 0;                  /* Fully invisible until hover */
  transition: opacity .15s ease; 
}

/* Reveal arrow on hover/focus */
.edge:hover .arrow,
.edge:focus .arrow { 
  opacity: 0.20; 
}

/* Mobile: swipe is primary, so we make the tap-zones even subtler */
@media (max-width: 768px) {
  .edge { width: 10vw; }
  .edge:hover .arrow,
  .edge:focus .arrow { opacity: 0.12; }
}

/* ========== Watermark (global home link) ========== */
.watermark {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  z-index: 60; user-select: none;
}
.wm-link {
  text-decoration: none; color: #000; opacity: .08;
  transition: opacity .18s ease;
  text-align: center;
  display: inline-block;
}
.wm-link:hover, .wm-link:focus { opacity: .22; }
.mark-long { display: none; }
.wm-link:hover .mark-short, .wm-link:focus .mark-short { display: none; }
.wm-link:hover .mark-long,  .wm-link:focus .mark-long  { display: block; }

/* ========== Gradient Background for Collections ========== */
.page-gradient {
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
  box-sizing: border-box;
  /* Dynamic colors injected via inline style in HTML */
  background: linear-gradient(
    135deg,
    var(--collection-color, #f0f0f0) 0%,
    var(--collection-color-light, #ffffff) 100%
  );
  color: #111;
}

/* ========== Hero Popup (Spacebar/Touch) ========== */
#mediaHeroPopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#mediaHeroPopup img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* ========== Accessibility & Utilities ========== */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 1px, 1px); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce){
  .brush-reveal, .evaporate { animation: none !important; }
}
