:root {
  --paw-mark: url("../assets/theme/paw.webp");
  --puppy-study: url("../assets/images/pawsatyou.gif");
}

/* The index shares the reading surface. A current link gets an underline. */
.masthead-inner {
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  gap: 0 clamp(1rem, 3.45vw, 3.2rem);
}

.archive-name {
  font-weight: 650;
}

.archive-name .icon {
  color: var(--accent-red);
}

.section-index {
  justify-self: center;
  column-gap: clamp(.35rem, 1.55vw, 1.45rem);
}

.section-index a {
  color: var(--text-secondary);
  font-weight: 520;
}

.section-index a:hover,
.section-index a[aria-current="location"] {
  color: var(--accent, var(--text));
}

.section-index a::after {
  inset-inline: .4rem;
  inset-block-end: .65rem;
  block-size: 1px;
}

.search-trigger {
  border: 0;
  padding-inline: .65rem;
  color: var(--text);
  font-weight: 600;
}

.search-trigger .icon {
  color: var(--text-secondary);
}

/* Image and illustration sit on the page as two independent prints. */
.subject {
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  column-gap: clamp(1rem, 4.3vw, 5.2rem);
  padding-block: clamp(2.4rem, 4.15vw, 4.7rem) clamp(2.4rem, 4vw, 4.2rem);
}

.subject-identity {
  min-inline-size: 0;
}

.subject h1 {
  font-weight: 730;
  letter-spacing: -.048em;
  line-height: 1.03;
}

.subject h1::after {
  /* Nonbreaking space keeps the mark with the last word of the name. */
  padding-inline-end: .6em;
  background: var(--paw-mark) right 57% / .58em .58em no-repeat;
  content: "\2060\00a0" / "";
}

.subject p {
  max-inline-size: 42ch;
  line-height: 1.56;
}

.subject-photo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(5rem, .55fr);
  align-items: end;
  gap: clamp(.35rem, .9vw, .8rem);
  inline-size: 100%;
  aspect-ratio: auto;
  overflow: visible;
  background: none;
}

.subject-photo img,
.subject-photo .media-missing {
  grid-area: 1 / 1;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 108 / 64;
  border-radius: var(--corner);
  background: var(--image-mat);
}

.subject-photo .media-missing:not([hidden]) {
  display: grid;
  min-block-size: 5rem;
  place-items: center;
}

.subject-photo::after,
.subject:not(:has(.subject-photo))::after {
  inline-size: 100%;
  max-inline-size: 16rem;
  block-size: clamp(10rem, 15vw, 20rem);
  margin-block-end: -0.16rem;
  background: var(--puppy-study) center bottom / contain no-repeat;
  content: "";
  pointer-events: none;
}

.subject-photo::after {
  grid-area: 1 / 2;
  align-self: end;
  justify-self: center;
  margin-block-end: -.16rem;
}

.subject:not(:has(.subject-photo)) {
  grid-template-columns: minmax(0, 1fr) minmax(6rem, .48fr);
  align-items: end;
}

.subject:not(:has(.subject-photo))::after {
  inline-size: min(100%, 15.5rem);
  justify-self: end;
}

/* Only the transition into the notes gets a chapter rule. */
.chapter {
  border-block-start: 0;
}

.chapter-prose {
  border-block-start: 1px solid var(--line);
}

.chapter-heading h2 {
  font-weight: 700;
  letter-spacing: -.04em;
}

.chapter-prose > .prose {
  max-inline-size: 84rem;
}

.prose :where(h3, h4, h5, h6) {
  font-weight: 665;
}

.reading-note {
  border-block-end: 0;
  border-block-start-color: var(--control-line);
}

.reading-note summary {
  font-weight: 600;
}

/* The active print is distinguished by size and position. */
.media-frame {
  border: 0;
}

.media-frame:hover {
  background: var(--surface-raised);
}

.media-indicator {
  border: 0;
  border-radius: var(--corner);
  background: var(--background);
}

.gallery.is-enhanced .slide:not(.is-current) h3 {
  color: var(--text-secondary);
  font-weight: 575;
}

.slide h3 {
  font-weight: 650;
}

.slide-details summary {
  min-inline-size: min(8rem, 100%);
  max-inline-size: 100%;
}

.icon-button {
  border: 0;
  background: var(--surface-raised);
}

.icon-button[aria-disabled="true"] {
  background: none;
  color: var(--text-muted);
}

.gallery-controls .icon-button:not([aria-disabled="true"]) {
  color: var(--accent, var(--text));
}

.notice {
  border-inline-start-width: 2px;
}

/* A ledger whose rows are grouped by the labels and value spacing. */
.facts {
  align-items: start;
  gap: .75rem clamp(1rem, 2vw, 2rem);
  padding-block: .45rem;
  border-block-start: 1px solid var(--line);
  border-block-end: 0;
  border-inline: 0;
  background: none;
}

.fact {
  background: none;
}

.fact-face {
  min-block-size: 5.3rem;
  padding-inline-start: .55rem;
  border-radius: var(--corner);
}

.fact-face:where(button, summary) {
  padding-inline-end: 2.4rem;
}

.fact-tag {
  border: 0;
  padding-inline: .33rem;
  background: var(--surface-raised);
}

.facts .fact-value-list {
  padding-inline: .55rem;
}

dialog {
  border: 0;
  border-radius: .6rem;
}

.dialog-header h2 {
  font-weight: 680;
}

.search-field {
  border: 0;
  border-block-end: 1px solid var(--control-line);
  border-radius: 0;
  background: var(--surface);
}

.search-results li {
  border-block-start: 0;
}

.search-results a {
  padding-inline: .5rem;
}

@media (45rem < width <=63rem) {
  .subject h1 {
    font-size: clamp(2.4rem, 5.68vw, 3.55rem);
  }
}

@media (max-width: 45rem) {
  .masthead-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .section-index {
    inline-size: 100%;
    justify-self: start;
  }

  .section-index a::after {
    inset-block-end: .3rem;
  }

  .subject {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 1.55rem;
    padding-block: 1.9rem 2.15rem;
  }

  .subject-photo {
    grid-template-columns: minmax(0, 1fr) minmax(4.8rem, .56fr);
    gap: .48rem;
  }
}

@media (max-width: 34rem) {
  .subject:not(:has(.subject-photo)) {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .subject:not(:has(.subject-photo))::after {
    inline-size: min(40%, 9rem);
  }
}