/* Shared masthead: append after style.css, evolution.css and section-colours.css.
   The handwritten full name is the identity; no separate monogram is added. */
body header.masthead,
body[data-placement="center"] header.masthead {
  --masthead-paper: #e8cbd4;
  --masthead-ink: #42343d;
  --masthead-line: #a68495;
  --masthead-inset: clamp(24px, 5vw, 64px);
  position: relative;
  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 104px var(--masthead-inset) 35px;
  border: 0;
  border-bottom: 1px solid var(--masthead-line);
  background: var(--masthead-paper);
  color: var(--masthead-ink);
  text-align: center;
  isolation: isolate;
}

body header.masthead .masthead-identity,
body[data-placement="center"] header.masthead .masthead-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(680px, 88vw);
  max-width: 100%;
  min-width: 0;
  height: auto;
  margin: 0 auto;
  padding: 0;
  gap: 0;
  grid-column: auto;
  grid-row: auto;
}

/* Higher specificity overrides the older ink-trail header and footer sizing. */
body header.masthead .identity > img.identity-signature,
body[data-weight="inktrail"] header.masthead .identity > img.identity-signature,
body[data-placement="center"] header.masthead .identity > img.identity-signature {
  display: block;
  width: 100%;
  max-width: 680px;
  min-width: 0;
  height: auto;
  max-height: none;
  margin: 0;
  object-fit: contain;
  filter: brightness(0);
  opacity: .8;
}

body header.masthead .identity > span,
body[data-weight="inktrail"] header.masthead .identity > span {
  display: none;
}

body header.masthead .masthead-tagline {
  max-width: 42ch;
  margin: 18px auto 0;
  padding: 0;
  color: var(--masthead-ink);
  font-size: calc(14px * var(--reading-scale, 1));
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: .015em;
  overflow-wrap: normal;
}

body header.masthead .masthead-nav,
body[data-placement="center"] header.masthead .masthead-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1050px;
  min-width: 0;
  margin: 27px auto 0;
  padding: 0;
  gap: 9px clamp(16px, 3vw, 42px);
  order: initial;
  grid-column: auto;
  grid-row: auto;
  font-size: calc(15px * var(--reading-scale, 1));
  line-height: 1.4;
  letter-spacing: 0;
}

body header.masthead .masthead-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid transparent;
  color: var(--masthead-ink);
  font: inherit;
  text-transform: none;
  white-space: nowrap;
  text-decoration: none;
}

body header.masthead .masthead-nav a:hover,
body header.masthead .masthead-nav a[aria-current="page"] {
  border-bottom-color: currentColor;
}

body header.masthead .masthead-tools,
body[data-placement="center"] header.masthead .masthead-tools {
  position: absolute;
  top: 16px;
  right: var(--masthead-inset);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  width: auto;
  max-width: calc(100% - var(--masthead-inset) * 2);
  margin: 0;
  padding: 0;
  gap: 10px 17px;
  grid-column: auto;
  grid-row: auto;
  color: var(--masthead-ink);
}

body header.masthead .reading-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
}

body header.masthead .reading-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--masthead-line);
  border-radius: 50%;
  background: transparent;
  color: var(--masthead-ink);
  font-family: inherit;
  font-size: calc(14px * var(--reading-scale, 1));
  line-height: 1;
  cursor: pointer;
}

body header.masthead .reading-tools button:hover:not(:disabled) {
  background: rgba(255, 255, 255, .25);
}

body header.masthead .reading-tools button:disabled {
  opacity: .45;
  cursor: default;
}

/* Explicitly retain this link when older mobile styles hide .instagram. */
body header.masthead .masthead-tools .instagram {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 0;
  color: var(--masthead-ink);
  font-size: calc(13px * var(--reading-scale, 1));
  line-height: 1.4;
  white-space: nowrap;
}

body header.masthead #reading-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body header.masthead a:focus-visible,
body header.masthead button:focus-visible {
  outline: 2px solid var(--masthead-ink);
  outline-offset: 5px;
}

@media (max-width: 600px) {
  body header.masthead,
  body[data-placement="center"] header.masthead {
    padding-top: 98px;
    padding-bottom: 25px;
  }
  body header.masthead .masthead-tagline {
    margin-top: 15px;
  }
  body header.masthead .masthead-nav,
  body[data-placement="center"] header.masthead .masthead-nav {
    margin-top: 21px;
    gap: 6px 19px;
  }
}

/* At increased reading size, links wrap between complete labels; the tagline
   wraps naturally. Font sizes never shrink to force all five links into a row. */
html.will-introduce:not(.intro-mark-arrived) header.masthead .identity img{opacity:0!important}
.field-note-photo{display:block;width:100%;cursor:zoom-in}.field-note-photo .chapter-image{margin:35px 0}.field-note-photo img{pointer-events:none}
.page-at-the-table .collection{--paper:#40332d;--ink:#f2e9dc;--muted:#d6c6b9;--line:#967d6d;--moss:#f0c5d3;background:var(--paper);color:var(--ink)}
.page-title{font:clamp(46px,5.5vw,82px)/1.05 'Libre Caslon Display',Georgia,serif;letter-spacing:-.03em;font-weight:400;margin:15px 0 25px}
body:has(header.masthead) .landing.is-locking .landing-initial{color:#42343d!important}

/* Keep a quiet keyboard cue without framing the signature. */
body header.masthead .identity:focus-visible{outline:none;box-shadow:0 2px 0 var(--masthead-ink)}
main[tabindex="-1"]:focus{outline:none}
.landing.is-revealing .landing-caret{opacity:0;animation:none}

.landing-name.signature-name{display:block;width:min(86vw,1100px);font-size:0;line-height:0;letter-spacing:0}
.signature-writing{display:block;width:100%;height:auto;overflow:visible}
.signature-pen-stroke{fill:none;stroke:white;stroke-width:19;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1}
.landing.is-typing .signature-pen-stroke{animation:pen-write var(--pen-duration) linear forwards;animation-delay:var(--pen-delay)}
.signature-completion{fill:white;opacity:0}
.landing.is-typing .signature-completion{animation:signature-complete .2s ease forwards;animation-delay:var(--pen-delay)}
@keyframes signature-complete{to{opacity:1}}
