@font-face {
  font-family: "Site Display";
  src: url("../assets/fonts/oswald-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Site Body";
  src: url("../assets/fonts/inter-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Site Body";
  src: url("../assets/fonts/inter-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --red: #e83630;
  --yellow: #fcc926;
  --ink: #231f20;
  --paper: #f9e6e3;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Site Body", system-ui, sans-serif;
}

.site-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.5rem;
  text-align: center;
}

.site-title {
  font-family: "Site Display", sans-serif;
  font-weight: 700;
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  color: var(--red);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 4px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 4px 3rem;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg, var(--red));
  outline-offset: -3px;
  transition: transform 0.15s ease, z-index 0s;
}

.tile:hover, .tile:focus-visible {
  transform: scale(1.04);
  z-index: 2;
  outline: 2px solid var(--ink);
}

.tile-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.tile-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.5em;
  pointer-events: none;
}

.tile-num {
  font-family: "Site Display", sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--fg, var(--yellow));
  align-self: flex-end;
  opacity: 0.85;
}

.tile-teaser {
  font-family: "Site Display", sans-serif;
  font-weight: 700;
  font-size: clamp(0.55rem, 1.3vw, 0.8rem);
  line-height: 1.15;
  color: var(--fg, var(--yellow));
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile.is-blank .tile-teaser,
.tile.is-blank .tile-num,
.tile[data-kind="colophon"] .tile-teaser {
  display: none;
}

/* page 1's art is a yellow dome over a red field; its title/number would
   sit invisible (yellow-on-yellow) at the top like every other tile, so
   pack them at the bottom instead, where the art is red */
.tile[data-kind="cover"] .tile-info {
  justify-content: flex-end;
  align-items: center;
  text-align: center;
  gap: 0.3em;
}
.tile[data-kind="cover"] .tile-teaser {
  -webkit-line-clamp: 2;
}

.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

.site-footer a {
  color: var(--ink);
}

.pdf-links {
  margin-top: 0.4rem;
}

/* modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 15, 10, 0.72);
}

.modal-page {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
}

.modal-sheet {
  position: relative;
  width: min(86vw, 86vh, 640px);
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-content {
  position: absolute;
  inset: 0;
  padding: 6% 8%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.modal-num {
  font-family: "Site Display", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--fg, var(--yellow));
  text-align: right;
  opacity: 0.85;
}

.modal-title {
  font-family: "Site Display", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: clamp(1.1rem, 3.4vw, 1.8rem);
  color: var(--fg, var(--yellow));
  margin: 0.2em 0 0.6em;
  line-height: 1.1;
}

.modal-stanzas {
  color: var(--fg, var(--yellow));
  font-size: clamp(0.72rem, 1.7vw, 0.98rem);
  line-height: 1.45;
}

.modal-stanzas p {
  margin: 0 0 1em;
}

.modal-note {
  margin-top: auto;
  padding-top: 1em;
  color: var(--fg, var(--yellow));
  font-size: 0.78em;
  font-style: italic;
  opacity: 0.85;
}

.modal-note p { margin: 0; }

/* same yellow-on-yellow dome issue as the grid tile, at modal scale */
.modal-sheet[data-kind="cover"] .modal-content {
  justify-content: flex-end;
  align-items: center;
  text-align: center;
}
.modal-sheet[data-kind="cover"] .modal-title {
  margin: 0;
}

.modal-close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  transform: translate(50%, -50%);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.modal-nav {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.3rem;
  cursor: pointer;
}

.modal-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

@media (max-width: 640px) {
  .modal-page {
    flex-direction: column;
    gap: 0.75rem;
  }
  .modal-nav { width: 2.25rem; height: 2.25rem; }
}
