:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #5e6965;
  --line: #d7ded9;
  --accent: #00796b;
  --paper: #faf8f1;
  --page: #f2f4f1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

.viewer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(10px);
}

.viewer-heading {
  min-width: 0;
}

.overline {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  line-height: 1.05;
}

[data-excerpt-context] {
  max-width: 68rem;
  margin: 0.4rem 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.viewer-actions {
  display: flex;
  flex: 0 1 34rem;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.5rem;
}

.viewer-actions a,
.viewer-actions button {
  flex: 1 1 auto;
  min-height: 2.5rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid #87938e;
  border-radius: 0.25rem;
  color: var(--ink);
  background: white;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.viewer-actions a:hover,
.viewer-actions a:focus-visible,
.viewer-actions button:hover,
.viewer-actions button:focus-visible,
.viewer-actions button[aria-pressed="true"] {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
  outline: none;
}

main {
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.viewer-media {
  position: relative;
  min-height: 14rem;
  margin: 0 auto;
  overflow: auto;
  border: 1px solid #77766f;
  background: var(--paper);
  box-shadow: 0 0.8rem 2.4rem rgb(24 32 29 / 12%);
}

.viewer-media img {
  display: block;
  margin: 0 auto;
  background: var(--paper);
}

.viewer-media[data-zoom="fit"] img {
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.viewer-media[data-zoom="actual"] img {
  width: auto;
  max-width: none;
  height: auto;
}

.viewer-media:not([data-state="ready"]) img {
  visibility: hidden;
}

[data-excerpt-status] {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

[data-excerpt-status][hidden] {
  display: none;
}

footer {
  padding: 0 clamp(1rem, 4vw, 3rem) 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 52rem) {
  .viewer-header {
    position: static;
    display: block;
  }

  .viewer-actions {
    justify-content: start;
    margin-top: 1rem;
  }

}
