@font-face {
  font-family: "Bebas Neue";
  src: url('/spri-nyt/fonts/BebasNeue-Regular.woff2') format('woff2'),
       url('/spri-nyt/fonts/BebasNeue-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Kollektif";
  src: url('/spri-nyt/fonts/Kollektif.woff2') format('woff2'),
       url('/spri-nyt/fonts/Kollektif.woff') format('woff');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Open Sauce One";
  src: url('/spri-nyt/fonts/OpenSauceOne-Regular.woff2') format('woff2'),
       url('/spri-nyt/fonts/OpenSauceOne-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --green: #008037;
  --blue: #5271ff;
  --ink: #1f1f1f;
  --muted: #555;
  --line: #d9d9d9;
  --paper: #fff;
  --soft: #f5f7f6;
  --error: #8f1d1d;

  --title-font: "Bebas Neue", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  --subtitle-font: "Open Sauce One", "Open Sans", "Segoe UI", Arial, sans-serif;
  --heading-font: "Kollektif", "Avenir Next", "Segoe UI", Arial, sans-serif;
  --body-font: "Open Sauce One", "Open Sans", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: #eeeeee;
}

body {
  margin: 0;
  background: #eeeeee;
  color: var(--ink);
  font-family: var(--body-font);
}

button {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  padding: 0.55rem 0.85rem;
  font: 700 0.95rem var(--heading-font);
  cursor: pointer;
}

button + button { margin-left: 0.4rem; }

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.screen-tools {
  max-width: 8.5in;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
}

.screen-tools p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  max-width: 8.5in;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  color: var(--error);
  background: #fff;
  border: 1px solid #e0b8b8;
  white-space: pre-wrap;
}

.pages {
  display: grid;
  gap: 1rem;
  max-width: 8.5in;
  margin: 0 auto 2rem;
}

.book-page {
  display: flex;
  flex-direction: column;
  min-height: 11in;
  padding: 0.45in;
  background: var(--paper);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.page-header {
  display: flex;
  align-items: center;
  gap: 0.22in;
  flex: 0 0 auto;
  padding-bottom: 0.16in;
  border-bottom: 0.045in solid var(--green);
}

.library-logo {
  width: 1.1in;
  height: auto;
  flex: 0 0 auto;
}

.header-copy h1,
.header-copy p,
.list-heading h2,
.book-title,
.author,
.call-number,
.description,
.digital-options { margin: 0; }

.header-copy h1 {
  color: var(--green);
  font-family: var(--title-font);
  font-size: 0.55in;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.9;
}

.header-copy p {
  color: var(--blue);
  font-family: var(--subtitle-font);
  font-size: 0.15in;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 0.14in 0 0.1in;
}

.list-heading h2 {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 0.22in;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  grid-auto-flow: column;
  gap: 0.05in;
  flex: 1 1 auto;
  min-height: 0;
}

.book-card {
  display: grid;
  grid-template-columns: 0.72in minmax(0, 1fr);
  gap: 0.06in;
  min-width: 0;
  min-height: 0;
  padding: 0.08in;
  background: #fff;
  overflow: hidden;
}

.cover,
.cover-placeholder {
  width: 0.72in;
  height: 1.08in;
  background: var(--soft);
}

.cover {
  display: block;
  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  place-items: center;
  padding: 0.05in;
  color: var(--muted);
  font-size: 0.08in;
  text-align: center;
}

.book-copy {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.025in;
  overflow: hidden;
}

.book-title {
  font-family: var(--heading-font);
  font-size: 0.125in;
  font-weight: 800;
  line-height: 1.15;
}

.author {
  color: var(--muted);
  font-size: 0.095in;
  font-weight: 700;
  line-height: 1.2;
}

.call-number {
  color: var(--green);
  font-family: var(--heading-font);
  font-size: 0.085in;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.description {
  color: #333;
  font-size: 0.088in;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.digital-options {
  color: var(--blue);
  font-size: 0.082in;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: auto;
}

.loading-line {
  height: 0.08in;
  margin: 0.04in 0;
  background: var(--soft);
}

.loading-line.short { width: 50%; }
.loading-line.medium { width: 75%; }
.loading-line.long { width: 95%; }

@media (max-width: 760px) {
  .screen-tools,
  .error,
  .pages { max-width: none; margin-left: 0.75rem; margin-right: 0.75rem; }
  .book-page { min-height: auto; padding: 1rem; }
  .book-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-flow: row;
  }
}

@media print {
  @page {
    size: letter portrait;
    margin: 0.25in;
  }

  html,
  body {
    width: auto;
    height: auto;
    margin: 0;
    background: #fff;
  }

  .screen-tools,
  .error { display: none !important; }

  .pages {
    display: block;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .book-page {
    width: 100%;
    height: 10.5in;
    min-height: 0;
    max-height: 10.5in;
    padding: 0;
    margin: 0;
    background: #fff;
    box-shadow: none;
    overflow: hidden;
    page-break-after: always;
    break-after: page;
  }

  .book-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .page-header {
    gap: 0.16in;
    padding-bottom: 0.1in;
    border-bottom-width: 0.035in;
  }

  .library-logo {
    width: 0.82in;
  }

  .header-copy h1 {
    font-size: 0.43in;
  }

  .header-copy p {
    font-size: 0.12in;
  }

  .list-heading {
    padding: 0.1in 0 0.075in;
  }

  .list-heading h2 {
    font-size: 0.18in;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 0.065in;
    height: calc(10.5in - 1.08in);
    min-height: 0;
    border-bottom: 0.045in solid var(--green);
  }

  .book-card {
    grid-template-columns: 1in minmax(0, 1fr);
    gap: 0.065in;
    padding: 0.055in;
    min-height: 0;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .cover,
  .cover-placeholder {
    width: 1in;
    height: 1.4in;
  }

  .book-copy {
    gap: 0.02in;
  }

  .book-title {
    font-size: 0.177in;
    line-height: 1.1;
  }

  .author {
    font-size: 0.135in;
    line-height: 1.12;
  }

  .call-number {
    font-size: 0.1275in;
  }

  .description {
    font-size: 0.1245in;
    line-height: 1.18;
    -webkit-line-clamp: 5;
  }

  .digital-options {
    font-size: 0.1245in;
    line-height: 1.12;
  }
}
