/* ---------------------------------------------------------------
   Poems Written by Ian Zhang
   Plain, utilitarian stylesheet. No frameworks, no webfonts,
   no shadows or gradients. Just cream paper and a serif type.
   ------------------------------------------------------------- */

:root {
  --paper: #f3ecd9;
  --ink: #262019;
  --ink-soft: #55503f;
  --rule: #cabf9e;
  --link: #1a4b8f;
  --link-visited: #6b3f8f;
  --serif: Georgia, "Times New Roman", Times, "Liberation Serif", serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
}

a:visited {
  color: var(--link-visited);
}

a:hover,
a:focus {
  color: var(--ink);
}

/* ---------------- Home page ---------------- */

.home {
  max-width: 40rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
}

.home h1 {
  font-size: clamp(2rem, 5vw + 1rem, 3.4rem);
  line-height: 1.15;
  margin: 0 0 2rem;
  font-weight: normal;
}

.home h1 .byline {
  font-size: 0.6em;
}

.poem-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.poem-list li {
  border-bottom: 1px solid var(--rule);
}

.poem-list a {
  display: block;
  padding: 0.9rem 0.1rem;
  font-size: 1.3rem;
  text-decoration: none;
}

.poem-list a:hover,
.poem-list a:focus {
  text-decoration: underline;
}

/* ---------------- Shared page chrome ---------------- */

.crumbs {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.crumbs a {
  font-size: 0.95rem;
  text-decoration: none;
}

.crumbs a:hover,
.crumbs a:focus {
  text-decoration: underline;
}

.poem-page h1 {
  max-width: 68rem;
  margin: 1.25rem auto 2.5rem;
  padding: 0 1.5rem;
  font-size: clamp(1.6rem, 3vw + 1rem, 2.4rem);
  font-weight: normal;
}

footer.site-footer {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

footer.site-footer a {
  font-size: 0.95rem;
  text-decoration: none;
}

footer.site-footer a:hover,
footer.site-footer a:focus {
  text-decoration: underline;
}

/* ---------------- Poem layout ---------------- */

.poem-body {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  display: flex;
  align-items: stretch;
  gap: 3rem;
}

.poem-text {
  flex: 1 1 55%;
  min-width: 0;
  font-size: 1.15rem;
}

.poem-text p {
  margin: 0 0 1.4em;
}

.poem-text p:last-child {
  margin-bottom: 0;
}

.poem-text-solo {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Photo column: stretches to the same height as the text column
   (flex align-items: stretch on .poem-body), then hands that
   height down to each photo equally, so text and photos always
   run the same length and scroll together as one page. */
.poem-photos {
  flex: 1 1 45%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-frame {
  flex: 1 1 0;
  min-height: 0;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 1px solid var(--rule);
  background: none;
  cursor: zoom-in;
  overflow: hidden;
  font: inherit;
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-frame:hover,
.photo-frame:focus-visible {
  border-color: var(--ink-soft);
}

/* ---------------- Lightbox ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 11, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  z-index: 1000;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(243, 236, 217, 0.55);
  background: none;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: rgba(243, 236, 217, 0.15);
}

body.lightbox-open {
  overflow: hidden;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 800px) {
  .poem-body {
    flex-direction: column;
    gap: 1.5rem;
  }

  .poem-text {
    font-size: 1.1rem;
  }

  /* The text stays a single readable column; photos become a
     horizontally swipeable filmstrip below it instead of a long
     stack of full-width images breaking up the scroll. Each frame
     gets a fixed aspect ratio so row height never depends on a
     photo's own orientation, and the row is left a little short of
     the viewport so the next photo always peeks in as a cue to
     swipe. */
  .poem-photos {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .poem-photos::-webkit-scrollbar {
    display: none;
  }

  .photo-frame {
    flex: 0 0 auto;
    width: 78vw;
    max-width: 22rem;
    aspect-ratio: 4 / 3;
    scroll-snap-align: start;
  }

  .lightbox {
    padding: 1.25rem;
  }
}
