/* =========================================================
   I am the Comma — a quiet, book-like page
   ========================================================= */

:root {
  --paper:      #f6f1e7;   /* warm cream, like an aged page  */
  --paper-2:    #efe8da;   /* subtle gradient partner        */
  --ink:        #2b2621;   /* soft near-black                */
  --ink-soft:   #6a6055;   /* muted text                     */
  --accent:     #a8452b;   /* faded book-cloth red           */
  --frame:      #ffffff;   /* photo mat                      */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino,
           "Book Antiqua", Georgia, "Times New Roman", serif;

  --measure: 34rem;        /* comfortable reading width      */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #17151a;
    --paper-2:  #1e1b22;
    --ink:      #ece6dc;
    --ink-soft: #a49b8d;
    --accent:   #d9795f;
    --frame:    #24212a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% -10%, var(--paper-2), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Oversized, ghostly comma drifting behind the content ---- */
.comma-mark {
  position: fixed;
  top: -0.35em;
  right: -0.06em;
  font-size: 46vw;
  line-height: 1;
  font-family: var(--serif);
  color: var(--accent);
  opacity: 0.06;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* Layout --------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 62rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 6rem) clamp(1.25rem, 5vw, 3rem) 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vw, 3.5rem);
}

/* Masthead ------------------------------------------------- */
.masthead {
  text-align: center;
  animation: rise 0.9s ease-out both;
}

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.82rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-style: italic;
  font-variant: small-caps
}

.title {
  margin: 0;
  font-weight: 500;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-transform: uppercase;
}

/* Photo ---------------------------------------------------- */
.photo {
  margin: 0;
  width: 100%;
  max-width: 34rem;
  padding: clamp(0.5rem, 1.4vw, 0.9rem);
  background: var(--frame);
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(31, 24, 16, 0.10),
    0 18px 40px -18px rgba(31, 24, 16, 0.45);
  animation: rise 1s ease-out 0.12s both;
}

.photo__btn {
  display: block;
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 2px;
  cursor: zoom-in;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.photo__btn img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.photo__btn:hover img,
.photo__btn:focus-visible img {
  transform: scale(1.03);
}

.photo__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* "Click to explore" cue */
.photo__cue {
  position: absolute;
  bottom: 0.9rem;
  right: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  font-style: normal;
  color: #fff;
  background: rgba(20, 16, 12, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.photo__cue svg { display: block; }

.photo__btn:hover .photo__cue,
.photo__btn:focus-visible .photo__cue {
  opacity: 1;
  transform: translateY(0);
}

/* Show the cue by default on touch devices (no hover) */
@media (hover: none) {
  .photo__cue { opacity: 1; transform: none; }
}

/* Prose ---------------------------------------------------- */
.prose {
  max-width: var(--measure);
  text-align: center;
  animation: rise 1s ease-out 0.24s both;
}

.prose p {
  margin: 0;
  font-size: clamp(1.3rem, 3.4vw, 1.75rem);
  line-height: 1.7;
  font-style: italic;
  color: var(--ink-soft);
  text-wrap: balance;
}

.ellipsis {
  color: var(--accent);
  font-style: normal;
}

/* Footer flourish ----------------------------------------- */
.foot {
  animation: rise 1s ease-out 0.36s both;
}

.rule {
  display: block;
  width: 3.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-soft), transparent);
  opacity: 0.7;
}

/* Motion --------------------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}

/* =========================================================
   Lightbox — full-screen zoomable viewer
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(12, 10, 8, 0.94);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.lightbox[hidden] { display: none; }

.lightbox.is-open { opacity: 1; }

.lightbox__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: zoom-in;
  touch-action: none;          /* we handle all gestures ourselves */
}

.lightbox__stage.is-zoomed { cursor: grab; }
.lightbox__stage.is-panning { cursor: grabbing; }

.lightbox__img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;             /* override the global .photo img rule */
  transform-origin: 0 0;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  visibility: hidden;          /* revealed once measured & fitted */
}

.lightbox__img.is-ready { visibility: visible; }

/* Loading spinner */
.lightbox__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.lightbox__spinner[hidden] { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Close button */
.lightbox__close {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox__close:hover { background: rgba(255, 255, 255, 0.2); transform: rotate(90deg); }
.lightbox__close svg { display: block; }

/* Zoom controls */
.lightbox__controls {
  position: absolute;
  left: 50%;
  bottom: max(1.6rem, calc(env(safe-area-inset-bottom) + 1rem));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox__controls button {
  min-width: 42px;
  height: 38px;
  padding: 0 0.85rem;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1;
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox__controls button:hover { background: rgba(255, 255, 255, 0.16); }
.lightbox__controls button:active { background: rgba(255, 255, 255, 0.26); }
.lightbox__controls button[data-zoom="reset"] { font-size: 0.85rem; letter-spacing: 0.02em; }

/* Hint line */
.lightbox__hint {
  position: absolute;
  left: 50%;
  top: max(1.1rem, calc(env(safe-area-inset-top) + 0.5rem));
  transform: translateX(-50%);
  margin: 0;
  padding: 0 1rem;
  max-width: min(90vw, 640px);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Fold the hint away when it would crowd the controls */
@media (max-width: 640px), (max-height: 520px) {
  .lightbox__hint { display: none; }
}
