@layer components.root {
  .poem-wrapper {
    box-sizing: border-box;
    color: #000;
    --_bg-color: var(--bg-color, antiquewhite);
    --_title-color: var(--title-color, #000);
    --_stanza-color: var(--stanza-color, #000);
    --_img-color: var(--img-color, var(--_title-color));
    --border-theme: var(--card-border-color, oklch(from var(--_bg-color) calc(l * .65) calc(c * 1.2) h));
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
  }

  .poem-wrapper h1 {
    color: var(--_title-color);
    font-family: "Kalam", var(--font-humanist);
  }

  .poem-wrapper h2 {
    color: var(--_title-color);
    font-family: "Kalam", var(--font-humanist);
  }

  .poem-wrapper img {
    border: .2rem solid var(--_img-color);
    border-radius: var(--radius-2);
  }

  .poem-card {
    background-color: var(--_bg-color);
    border: var(--border-size-3, 3px) solid var(--border-theme);
    border-radius: var(--radius-2, 12px);
    flex-direction: column;
    display: flex;
    overflow: hidden;
  }

  .row-header {
    font-family: var(--font-handwritten, sans-serif);
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 1rem .5rem;
    display: flex;
  }

  .poem-title {
    text-align: center;
    max-width: 50%;
    font-family: "Kalam", var(--font-humanist);
    color: var(--_title-color);
    flex-shrink: 0;
    margin: 0;
  }

  .header-left-images, .header-right-images {
    flex: 1 1 0;
    align-items: center;
    min-width: 120px;
    display: flex;
  }

  .header-title-text {
    justify-content: center;
    width: 50%;
    display: flex;
  }

  .header-title-text h1 {
    max-width: 100%;
  }

  .header-title-text h2 {
    max-width: 100%;
  }

  .small-title h1 {
    font-size: var(--font-size-fluid-1);
  }

  .small-title h2 {
    font-size: var(--font-size-fluid-1);
  }

  .poem-wrapper .no-border img {
    border: none;
  }

  .row-header .header-title-images {
    flex: 1;
    margin: 0;
  }

  .row-header .header-title-images picture img {
    border: none;
    max-width: 50%;
    margin-inline: auto;
  }

  .header-right-images {
    justify-content: flex-end;
  }

  .header-left-images div, .header-right-images div {
    align-items: center;
    width: 100%;
    display: flex;
  }

  .header-right-images div {
    justify-content: flex-end;
  }

  .header-left-images div img:nth-child(2), .header-left-images div picture:nth-child(2) {
    margin-inline: auto;
  }

  .header-right-images div img:nth-child(2), .header-right-images div picture:nth-child(2) {
    order: -1;
    margin-inline: auto;
  }

  .header-left-images div svg {
    margin-inline: auto;
  }

  .header-right-images div svg {
    order: -1;
    margin-inline: auto;
  }

  .row-header img, .row-header picture img {
    object-fit: contain;
    flex-shrink: 0;
    width: auto;
    max-width: 120px;
    height: 120px;
  }

  .grid-body {
    font-family: "Kalam", var(--font-humanist);
    grid-template-columns: 15% 1fr minmax(0, 200px) 1fr 15%;
    align-items: start;
    gap: 1rem;
    padding: 1rem;
    display: grid;
  }

  .wide .grid-body {
    grid-template-columns: 1% 1fr minmax(0, 200px) 1fr 15%;
  }

  .wide-text .grid-body {
    grid-template-columns: 10% 1fr minmax(0, 160px) 1fr 10%;
    gap: .75rem;
  }

  .no-middle-images .grid-body {
    grid-template-columns: 20% 1fr 1fr 20%;
    gap: 1rem;
  }

  .no-middle-images .grid-body .col-mid-pics {
    display: none;
  }

  .no-middle-images .grid-body .col-left-pics > div {
    align-items: center;
  }

  .no-middle-images .grid-body .col-right-pics > div {
    align-items: center;
  }

  .no-middle-images .grid-body .col-outer img {
    width: auto;
    max-width: 200px;
    height: auto;
  }

  .col-outer, .col-inner {
    height: 100%;
  }

  .col-inner {
    justify-content: center;
    display: flex;
  }

  .col-inner div {
    margin-block: auto;
  }

  .col-outer.col-left-pics div, .col-inner.col-mid-pics div, .col-outer.col-right-pics div {
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    display: flex;
  }

  .col-mid-pics img, .col-mid-pics picture img {
    object-fit: contain;
    width: 100%;
    max-width: 200px;
    max-height: 200px;
    margin: 0 auto;
  }

  .grid-body img {
    object-fit: contain;
    width: 100%;
    max-width: 180px;
    height: auto;
    margin-block: var(--size-2);
    border-radius: 4px;
    display: block;
  }

  .col-left-text p, .col-right-text p {
    white-space: normal;
    color: var(--_stanza-color);
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: max(.8rem, min(2vw, 1.2rem));
    line-height: 1.7;
  }

  :is(.col-left-text p, .col-right-text p) br {
    content: "";
    margin: 0;
  }

  .small .col-left-text p, .small .col-right-text p {
    font-size: var(--font-fluid-size-0);
  }

  .grid-straddle-signature {
    text-align: left;
    grid-column: 4 / 6;
    margin-top: 1rem;
    padding-left: 2rem;
  }

  .signature {
    font-style: italic;
    font-weight: bold;
    font-size: var(--font-size-fluid-1);
    margin: 0;
  }

  .poem-navigation {
    margin-top: var(--size-4, 2rem);
    padding-top: var(--size-2, 1rem);
    border-top: 1px solid oklch(from var(--_bg-color) calc(l * .8) c h);
    justify-content: space-between;
    align-items: center;
    width: 100%;
    display: flex;
  }

  .poem-navigation .nav-link {
    font-family: sans-serif;
    font-size: var(--font-size-1, .95rem);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--_title-color, #1a365d);
    font-weight: bold;
    text-decoration: none;
    transition: color .2s;
  }

  .poem-navigation .nav-link:hover {
    color: oklch(from var(--_title-color) calc(l * 1.4) c h);
  }

  .poem-navigation .nav-disabled {
    visibility: hidden;
  }

  @media (max-width: 1024px) {
    .row-header {
      flex-direction: column;
      gap: 1rem;
    }

    .header-title-text, .header-left-images, .header-right-images {
      justify-content: center;
      width: 100% !important;
      max-width: 100% !important;
    }

    :is(.header-title-text, .header-left-images, .header-right-images) div {
      justify-content: center;
    }

    .row-header .header-title-images picture img {
      max-width: 120px;
    }

    .grid-body, .wide .grid-body, .wide-text .grid-body, .no-middle-images .grid-body {
      grid-template-columns: 1fr 2fr !important;
      gap: 1.5rem 1rem !important;
    }

    .col-left-pics {
      grid-area: 1 / 1;
    }

    .col-left-pics div {
      gap: var(--size-2) !important;
      flex-direction: column !important;
    }

    .col-left-text {
      grid-area: 1 / 2;
    }

    .col-right-pics {
      grid-area: 2 / 2;
    }

    .col-right-pics div {
      gap: var(--size-2) !important;
      flex-direction: column !important;
    }

    .col-right-text {
      grid-area: 2 / 1;
    }

    .col-mid-pics {
      grid-area: 3 / 1 / auto / -1;
      gap: 1rem;
      flex-flow: wrap !important;
      justify-content: center !important;
    }

    .col-mid-pics div {
      flex-flow: wrap !important;
      justify-content: center !important;
    }

    .no-middle-images .col-mid-pics {
      display: none !important;
    }

    .grid-straddle-signature {
      text-align: center;
      grid-area: 4 / 1 / auto / -1;
      margin-top: 1.5rem;
      padding-left: 0;
    }

    .poem-navigation {
      flex-direction: row;
      justify-content: space-around;
      gap: 2rem;
    }
  }
}
