* {
  box-sizing: border-box;
}

:root {
  --paper: #f7f6f2;
  --ink: #222;
  --muted: #666;

  --page-padding: clamp(14px, 2.2vw, 28px);

  /*
    SHARED PAGE ZONES

    These are the master proportions for the site.

    Homepage:
    1. Logo
    2. Image
    3. Image information
    4. Navigation

    Information pages combine zones 2 + 3
    into one scrollable content area.
  */

  --logo-zone: 12%;
  --image-zone: 60%;
  --info-zone: 8%;
  --navigation-zone: 20%;
}


/* ==================================================
   BASIC RESET
   ================================================== */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-weight: 300;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}


/* ==================================================
   SHARED PAGE STRUCTURE
   ================================================== */

.page {
  width: 100%;
  height: 100dvh;
  min-height: 0;

  padding: var(--page-padding);
  padding-bottom: clamp(24px, 4vh, 48px);

  display: grid;

  /*
    Homepage:
      logo / image / info / navigation
  */

  grid-template-rows:
    var(--logo-zone)
    var(--image-zone)
    var(--info-zone)
    var(--navigation-zone);

  overflow: hidden;
}


/* ==================================================
   ZONE 1 — LOGO
   ================================================== */

.site-header {
  min-height: 0;

  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.logo {
  display: block;

  /*
    Logo occupies 75% of the logo zone.
    This makes it responsive to the available space
    rather than giving it a fixed pixel height.
  */

  height: 75%;
  max-height: 100%;

  line-height: 0;
}

.logo img {
  display: block;

  width: auto;
  height: 100%;

  max-width: 70vw;
}


/* ==================================================
   ZONE 2 — IMAGE
   ================================================== */

.poem-area {
  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.image-wrap {
  position: relative;

  width: min(88vw, 100%);
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 0;
}

#poemImage {
  display: block;

  width: auto;
  height: 100%;

  max-width: 88vw;
  max-height: 100%;

  object-fit: contain;

  border-radius: 12px;

  transition: opacity 500ms ease;
}

.image-wrap.is-open #poemImage {
  opacity: 0.3;
}


/* ==================================================
   IMAGE FRAME
   ================================================== */

.image-frame {
  position: relative;

  height: 100%;
  width: auto;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 0;
}


/* ==================================================
   IMAGE INFORMATION OVERLAY
   ================================================== */

.image-frame .overlay {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 5%;

  background: rgba(255, 255, 255, 0.8);

  opacity: 0;
  pointer-events: none;

  transition: opacity 220ms ease;
}

.image-wrap.is-open .overlay {
  opacity: 1;
  pointer-events: auto;
}

.overlay-content {
  width: min(90%, 520px);

  text-align: center;
}

.overlay-content p {
  margin: 0 0 20px;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1.55;
}


/* ==================================================
   ZONE 3 — IMAGE INFORMATION
   ================================================== */

.poem-details {
  min-height: 0;

  width: auto;
  max-width: 88vw;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  /*
    Small, deliberate gap between image
    and title / author.
  */

  padding-top: 8px;

  text-align: center;
}

#poemInfo {
  margin: 0;

  text-align: center;
  line-height: 1.4;
}

#poemTitle {
  font-family: "Libre Baskerville", serif;
  font-size: clamp(15px, 1.8vw, 22px);
}

#poemAuthor {
  margin-left: 8px;

  color: var(--muted);

  font-size: clamp(12px, 1.2vw, 15px);
}


/* ==================================================
   MORE ABOUT THIS
   ================================================== */

.more-area {
  height: 8%;
  flex-shrink: 0;

  display: flex;
  justify-content: center;
  align-items: flex-end;

  padding-top: 6px;
} 

.text-button {
  border: 0;
  padding: 0;

  background: transparent;

  cursor: pointer;

  font-size: 13px;
  line-height: 1.4;

  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.text-button:hover,
.text-button:focus-visible,
.logo:hover,
.logo:focus-visible {
  text-decoration-thickness: 2px;
}


/* ==================================================
   ZONE 4 — NAVIGATION
   ================================================== */

.navigation {
  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  /*
    Small gap between:
    "more about this"
    and
    "another random poem?"
  */

  padding-top: 2%;

  gap: 5%;
}


/* ==================================================
   ANOTHER RANDOM POEM?
   ================================================== */

.random-link {
  color: var(--ink);
  border: 0;

  background: transparent;

  padding: 3px 8px;

  cursor: pointer;

  font-size: clamp(14px, 1.4vw, 16px);
  font-weight: 400;

  text-decoration: none;

  transition: opacity 180ms ease;
}

.random-link:hover,
.random-link:focus-visible {
  opacity: 0.6;
}


/* ==================================================
   FOUR PERMANENT NAVIGATION LINKS
   ================================================== */

.secondary-nav {
  width: min(100%, 560px);

  display: grid;
  grid-template-columns: 1fr 1fr;

  align-items: start;

  column-gap: 70px;
  row-gap: 10px;

  /*
    YOUR EXISTING 12px TOP PADDING
    PRESERVED HERE.
  */

  padding-top: 12px;
}

.secondary-nav a {
  color: var(--ink);

  text-decoration: none;

  font-size: clamp(12px, 1.15vw, 14px);
  font-weight: 300;

  transition: opacity 180ms ease;
}


/* Left column */

.secondary-nav a:nth-child(1),
.secondary-nav a:nth-child(3) {
  justify-self: end;
  text-align: right;
}


/* Right column */

.secondary-nav a:nth-child(2),
.secondary-nav a:nth-child(4) {
  justify-self: start;
  text-align: left;
}


.secondary-nav a:hover,
.secondary-nav a:focus-visible {
  opacity: 0.6;
}


/* ==================================================
   INFORMATION PAGE
   ==================================================

   The information page uses exactly the same
   logo and navigation zones.

   Zones 2 + 3 become one middle area.

   This class can be added to the page element
   on the "what is this?" page.
   */

.info-page {
  grid-template-rows:
    minmax(0, var(--logo-zone))
    minmax(0, calc(var(--image-zone) + var(--info-zone)))
    minmax(0, var(--navigation-zone));
}


/* Scrollable middle section */

/* ==================================================
   INFORMATION PAGE
   ==================================================

   Zones 2 + 3 become one middle area.

   The heading remains fixed.
   Only the text underneath scrolls.
   ================================================== */

.info-page {
  grid-template-rows:
    minmax(0, var(--logo-zone))
    minmax(0, calc(var(--image-zone) + var(--info-zone)))
    minmax(0, var(--navigation-zone));
}


/* Middle content area */

.info-content {
  min-height: 0;

  display: flex;
  flex-direction: column;

  overflow: hidden;

  padding: 12px 4vw 0;
}


/* Fixed page heading */

.info-content h1 {
  flex: 0 0 auto;

  margin: 0 0 20px;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.25;

  text-align: center;
}


/* Only this area scrolls */

.info-scroll {
  min-height: 0;
  flex: 1 1 auto;

  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-width: thin;
}


/* Comfortable reading width */

.info-content-inner {
  width: min(100%, 720px);

  margin: 0 auto;

  padding: 0 0 30px;
}


/* Information page body */

.info-content p {
  margin: 0 0 1.4em;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.7;

  text-align: center;
}


/* ==================================================
   MOBILE
   ================================================== */

@media (max-width: 600px) {

  .page {
    padding: 14px;
    padding-bottom: 28px;
  }

  .logo {
    height: 75%;
    max-width: 65vw;
  }

  .secondary-nav {
    width: min(92vw, 420px);

    column-gap: 22px;
    row-gap: 9px;

    padding-top: 12px;
  }

  .secondary-nav a {
    font-size: 12px;
  }

  .info-content {
    padding-left: 3vw;
    padding-right: 3vw;
  }

  .info-content h1 {
    margin-bottom: 16px;
    font-size: clamp(21px, 7vw, 28px);
  }

  .info-content-inner {
    padding-bottom: 24px;
  }

  .info-content p {
    font-size: 15px;
    line-height: 1.65;
  }
}


/* ==================================================
   VERY SHORT SCREENS
   ==================================================

   We don't change the zone proportions.
   We simply reduce outer padding so the same
   shared layout has more usable space.
   */

@media (max-height: 650px) {

  .page {
    padding-top: 10px;
    padding-bottom: 24px;
  }
}


/* ==================================================
   REDUCED MOTION
   ================================================== */

@media (prefers-reduced-motion: reduce) {

  #poemImage,
  .overlay,
  .random-link,
  .secondary-nav a {
    transition: none;
  }
}

/* ==================================================
   SUBMIT PAGE
   ================================================== */

/*
  The Submit page uses the existing .info-page structure.

  Zones 2 + 3 are already combined by .info-page.
  This section only styles the form within that area.
*/


/* ==================================================
   SUBMIT INTRO
   ================================================== */

.submit-form {
  width: min(100%, 600px);

  margin: 0 auto;

  text-align: center;
}


/* ==================================================
   FORM FIELDS
   ================================================== */

.form-field {
  margin-bottom: 22px;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-field label,
.category-field legend {
  margin-bottom: 5px;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(15px, 1.5vw, 19px);
  line-height: 1.4;
}

.form-field input[type="text"],
.form-field textarea {
  width: min(100%, 480px);

  border: 1px solid #bbb;
  border-radius: 3px;

  padding: 8px 10px;

  background: white;
  color: var(--ink);

  font: inherit;
  font-size: 15px;

  outline: none;
}

.form-field textarea {
  min-height: 70px;

  resize: vertical;
}

.form-field input[type="text"]:focus,
.form-field textarea:focus {
  border-color: var(--ink);
}


/* ==================================================
   SMALL FORM NOTES
   ================================================== */

.form-note,
.form-question {
  display: block;

  color: var(--muted);

  font-size: 12px;
  line-height: 1.5;
}

.form-note {
  margin-top: 4px;
}

.form-question {
  margin-bottom: 10px;
}


/* ==================================================
   CATEGORIES
   ================================================== */

.category-field {
  margin: 0 0 22px;
  padding: 0;

  border: 0;
}

.category-field legend {
  width: 100%;

  padding: 0;

  text-align: center;
}


/*
  Three columns on larger screens.

  The six categories therefore occupy
  exactly two rows.
*/

.category-grid {
  width: 100%;

  display: grid;
  grid-template-columns: repeat(3, 1fr);

  column-gap: 18px;
  row-gap: 9px;

  margin-top: 4px;
}

.category-grid label {
  display: flex;
  align-items: center;
  justify-content: flex-start;

  gap: 6px;

  cursor: pointer;

  font-size: 13px;
  line-height: 1.3;

  text-align: left;
}

.category-grid input {
  margin: 0;

  flex: 0 0 auto;
}


/* ==================================================
   IMAGE UPLOAD
   ================================================== */

.form-field input[type="file"] {
  width: min(100%, 480px);

  font: inherit;
  font-size: 13px;
}


/* ==================================================
   MODERATION
   ================================================== */

.moderation-note {
  margin: 4px 0 12px !important;

  color: var(--muted);

  font-size: 12px !important;
  line-height: 1.4 !important;

  font-family: "Inter", sans-serif !important;
}


/* ==================================================
   SUBMIT BUTTON
   ================================================== */

.submit-button {
  border: 0;

  padding: 5px 10px;

  background: transparent;

  color: var(--ink);

  cursor: pointer;

  font-size: 15px;
  font-weight: 400;

  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.submit-button:hover,
.submit-button:focus-visible {
  text-decoration-thickness: 2px;
}


/* ==================================================
   MOBILE
   ================================================== */

@media (max-width: 600px) {

  .submit-form {
    width: min(100%, 480px);
  }

  .form-field {
    margin-bottom: 20px;
  }

  .category-grid {
    grid-template-columns: 1fr;

    row-gap: 8px;

    width: min(100%, 320px);

    margin-left: auto;
    margin-right: auto;
  }

  .category-grid label {
    justify-content: flex-start;
  }
}


/* ==================================================
   REDUCED MOTION
   ================================================== */

@media (prefers-reduced-motion: reduce) {

  .submit-button {
    transition: none;
  }
}

/* ==================================================
   CATEGORY PAGE
   ================================================== */

.category-list {
  width: min(100%, 760px);

  margin: 0 auto;

  padding: 0 10px 30px;

  display: grid;
  grid-template-columns: 1fr 1fr;

  column-gap: 60px;
  row-gap: 34px;
}


/* Individual category */

.category-item {
  display: block;

  padding: 4px 8px 10px;

  color: var(--ink);

  text-decoration: none;

  text-align: center;

  transition: opacity 180ms ease;
}


.category-item h2 {
  margin: 0 0 8px;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(16px, 1.7vw, 21px);
  font-weight: 400;
  line-height: 1.35;
}


.category-item p {
  margin: 0;

  color: var(--muted);

  font-family: "Libre Baskerville", serif;
  font-size: clamp(12px, 1.2vw, 15px);
  line-height: 1.55;
}


.category-item:hover,
.category-item:focus-visible {
  opacity: 0.6;
}


/* ==================================================
   CATEGORY PAGE — MOBILE
   ================================================== */

@media (max-width: 600px) {

  .category-list {
    width: min(100%, 420px);

    grid-template-columns: 1fr;

    row-gap: 28px;

    padding-left: 5px;
    padding-right: 5px;
  }

  .category-item h2 {
    font-size: 17px;
  }

  .category-item p {
    font-size: 13px;
  }

}

/* ==================================================
   HOMEPAGE — PLACE NAVIGATION IN ZONE 4
   ================================================== */

.page:not(.info-page):not(.category-page) .navigation {
  grid-row: 4;
}

/* ==================================================
   CATEGORY POEM VIEWER
   ================================================== */


/* ==================================================
   CATEGORY PAGE STRUCTURE
   ================================================== */

.category-page {
  grid-template-rows:
    var(--logo-zone)
    calc(var(--image-zone) + var(--info-zone))
    var(--navigation-zone);
}


/* ==================================================
   CATEGORY CONTENT AREA
   ================================================== */

.category-poem-area {
  min-height: 0;

  display: grid;

  /*
    The middle area is divided into:

    10%  category title + description
     5%  progress indicator
    60%  poem image
    15%  poem title + author
    10%  more about this
  */

  grid-template-rows:
    13%
    5%
    57%
    15%
    10%;

  align-items: center;

  overflow: hidden;

  position: relative;
}


/* ==================================================
   CATEGORY TITLE + DESCRIPTION
   ================================================== */

.category-heading {
  min-height: 0;

  padding: 4px 20px 6px;

  text-align: center;
}


.category-heading h1 {
  margin: 0 0 5px;

  font-family: "Libre Baskerville", serif;
  font-size: clamp(18px, 2.2vw, 25px);
  font-weight: 400;
  line-height: 1.3;
}


.category-heading p {
  margin: 0;

  color: var(--muted);

  font-family: "Libre Baskerville", serif;
  font-size: clamp(11px, 1.15vw, 14px);
  line-height: 1.45;
}


/* ==================================================
   PROGRESS INDICATOR
   ================================================== */

.category-progress {
  position: relative;

  width: min(55%, 500px);
  height: 12px;

  margin: 0 auto;

  display: flex;
  align-items: center;
}


.progress-line {
  position: absolute;

  left: 0;
  right: 0;

  height: 1px;

  background: rgba(34, 34, 34, 0.5);
}


.progress-marker {
  position: absolute;

  top: 50%;

  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: rgba(34, 34, 34, 0.8);

  transform:
    translate(-50%, -50%);

  transition: left 250ms ease;
}


/* ==================================================
   CATEGORY IMAGE AREA
   ================================================== */

.category-image-area {
  min-height: 0;

  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  position: relative;
}


/*
  The image frame remains tied to the
  actual image dimensions.
*/

.category-image-area .image-wrap {
  height: 100%;
  width: min(88vw, 100%);

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 0;
}


/* ==================================================
   LEFT / RIGHT POINTERS
   ================================================== */

.category-arrow {
  position: absolute;

  top: 50%;

  border: 0;

  padding: 4px 10px;

  background: transparent;

  color: var(--ink);

  font-family: "Inter", sans-serif;

  font-size: clamp(25px, 3vw, 38px);

  font-weight: 300;

  line-height: 1;

  cursor: pointer;

  opacity: 0.45;

  transform: translateY(-50%);

  transition:
    opacity 180ms ease,
    transform 180ms ease;

  z-index: 5;
}


.category-arrow:hover,
.category-arrow:focus-visible {
  opacity: 0.8;
}


.category-arrow-left {
  left: 22%;
}


.category-arrow-right {
  right: 22%;
}


/* ==================================================
   CATEGORY PAGE — POEM INFORMATION
   ================================================== */

.category-poem-area .poem-details {
  width: 100%;
  max-width: none;

  min-height: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding-top: 5px;

  text-align: center;
}


.category-poem-area #poemInfo {
  width: 100%;

  margin: 0;

  text-align: center;
}


.category-poem-area #poemTitle,
.category-poem-area #poemAuthor {
  display: inline;
}


.category-poem-area #poemAuthor {
  margin-left: 8px;
}


/* ==================================================
   CATEGORY PAGE — MORE ABOUT THIS
   ================================================== */

.category-poem-area .more-area {
  height: auto;

  min-height: 26px;

  padding-top: 4px;

  align-items: flex-end;
}


/* ==================================================
   MOBILE
   ================================================== */

@media (max-width: 600px) {

  .category-heading {
    padding-left: 12px;
    padding-right: 12px;
  }


  .category-heading h1 {
    font-size: 18px;
  }


  .category-heading p {
    font-size: 12px;
  }


  .category-progress {
    width: 65%;
  }


  .category-arrow {
    font-size: 28px;

    padding-left: 5px;
    padding-right: 5px;
  }


  .category-arrow-left {
    left: 0;
  }


  .category-arrow-right {
    right: 0;
  }

}