:root {
  --blue: #317aa2;
  --blue-dark: #235d7d;
  --blue-deep: #174a64;
  --blue-pale: #e9f1f4;
  --steel: #b7c3c8;
  --ink: #17313d;
  --muted: #60747d;
  --sand: #d1c5b5;
  --sand-light: #f1eee9;
  --line: #ddd8d1;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(24, 32, 36, 0.12);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #f4f7f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f7f8;
}

a { color: inherit; }

button,
input { font: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  min-height: 88px;
  padding: 18px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 4px solid var(--blue);
  border-bottom: 1px solid #d8e2e6;
  background: var(--white);
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 22px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 118px;
  max-height: 68px;
  height: auto;
}

.brand span {
  padding-left: 22px;
  border-left: 1px solid var(--steel);
  color: var(--blue-dark);
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.main-site-link {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--blue-dark);
}

.main-site-link:hover,
.main-site-link:focus-visible { color: var(--blue); }

.library-hero {
  min-height: 390px;
  padding: 90px clamp(24px, 8vw, 130px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--white);
  background:
    radial-gradient(circle at 82% 18%, rgba(183, 195, 200, 0.55), transparent 34%),
    linear-gradient(110deg, var(--blue-deep) 0%, var(--blue) 64%, #75a4b9 120%);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.library-hero .eyebrow { color: #d9e9ef; }

.library-hero h1,
.viewer-titlebar h1,
.error-main h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.library-hero h1 {
  max-width: 900px;
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.library-hero > p:last-child {
  max-width: 650px;
  margin: 30px 0 0;
  color: #e7f0f3;
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.7;
}

.library-content {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 80px 0 110px;
}

.library-content__heading {
  margin-bottom: 36px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.library-content__heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 400;
}

.library-search {
  width: min(100%, 320px);
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: var(--white);
}

.library-search svg {
  width: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.library-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.spec-card {
  min-height: 290px;
  border-top: 3px solid var(--blue);
  background: var(--white);
  box-shadow: 0 8px 28px rgba(23, 74, 100, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.spec-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.spec-card > a {
  height: 100%;
  padding: 34px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.spec-card__eyebrow {
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.spec-card h2 {
  margin: 25px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 400;
}

.spec-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.spec-card__action {
  margin-top: auto;
  padding-top: 38px;
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 80px 24px;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--white);
}

.empty-state__mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--sand);
  border-radius: 50%;
  color: var(--blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7rem;
}

.empty-state h2 { margin: 0 0 10px; font-weight: 500; }
.empty-state p,
.search-empty { color: var(--muted); }
.search-empty { padding: 40px 0; text-align: center; }

.viewer-main {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.viewer-titlebar {
  margin-bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}

.back-link {
  margin-bottom: 28px;
  display: inline-block;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.back-link:hover { color: var(--blue); }

.viewer-titlebar h1 {
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 1;
  letter-spacing: -0.035em;
}

.viewer-meta { margin: 14px 0 0; color: var(--muted); }

.download-button,
.primary-link {
  padding: 15px 20px;
  flex: none;
  color: var(--white);
  background: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.download-button:hover,
.primary-link:hover { background: var(--blue-dark); }

.viewer-toolbar {
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--white);
  background: var(--blue-deep);
}

.viewer-toolbar__group { display: flex; align-items: center; gap: 12px; }

.viewer-toolbar button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  background: transparent;
  cursor: pointer;
}

.viewer-toolbar button:hover:not(:disabled),
.viewer-toolbar button:focus-visible { border-color: #91bfd7; background: rgba(49, 122, 162, 0.25); }
.viewer-toolbar button:disabled { opacity: 0.35; cursor: default; }
.viewer-toolbar span { min-width: 62px; text-align: center; font-size: 0.8rem; }

.pdf-stage {
  min-height: 70vh;
  padding: 28px 16px 50px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(49, 122, 162, 0.035) 25%, transparent 25%) 0 0 / 20px 20px,
    #dfe8eb;
}

.pdf-stage canvas {
  max-width: none;
  display: block;
  background: var(--white);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.38);
}

.pdf-page-image {
  max-width: none;
  height: auto;
  display: block;
  background: var(--white);
  box-shadow: 0 10px 40px rgba(23, 74, 100, 0.2);
}

.pdf-page-image[hidden] { display: none; }

.pdf-stage canvas[hidden] { display: none; }

.pdf-loading {
  min-height: 55vh;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--blue-deep);
}

.pdf-loading[hidden],
.pdf-error[hidden] { display: none; }

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(49, 122, 162, 0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.pdf-error {
  max-width: 560px;
  margin: 80px auto;
  padding: 40px;
  text-align: center;
  color: var(--ink);
  background: var(--white);
}

.pdf-error a { color: var(--blue-dark); font-weight: 700; }

.error-main {
  min-height: calc(100vh - 180px);
  padding: 100px 24px;
  display: grid;
  place-content: center;
  justify-items: start;
}

.error-main h1 { font-size: clamp(2.8rem, 7vw, 6rem); }
.error-main > p:not(.eyebrow) { margin: 20px 0 34px; color: var(--muted); }

.site-footer {
  min-height: 94px;
  padding: 28px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #e3edf1;
  background: var(--blue-deep);
  font-size: 0.78rem;
}

.site-footer p { margin: 0; }
.site-footer a { color: inherit; text-underline-offset: 3px; }

@media (max-width: 900px) {
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .site-header { min-height: 74px; padding: 14px 18px; }
  .brand { gap: 12px; }
  .brand img { width: 104px; }
  .brand span { padding-left: 12px; font-size: 0.58rem; letter-spacing: 0.12em; }
  .main-site-link { display: none; }
  .library-hero { min-height: 330px; padding: 70px 24px; }
  .library-content { width: min(100% - 32px, 1320px); padding: 58px 0 76px; }
  .library-content__heading { align-items: stretch; flex-direction: column; }
  .library-search { width: 100%; }
  .spec-grid { grid-template-columns: 1fr; }
  .spec-card { min-height: 250px; }
  .spec-card > a { padding: 28px; }
  .viewer-main { width: 100%; padding: 28px 0 0; }
  .viewer-titlebar { padding: 0 20px; align-items: stretch; flex-direction: column; }
  .download-button { align-self: flex-start; }
  .viewer-toolbar { position: sticky; top: 0; z-index: 3; }
  .pdf-stage { min-height: 66vh; padding: 18px 8px 36px; }
  .site-footer { padding: 26px 20px; align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
