@font-face {
  font-family: "Space Grotesk Regular";
  src: url("assets/fonts/space-grotesk-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.mark {
  margin: 28px 0 8px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(20, 20, 20, 0.14);
}

.mark h2 {
  max-width: 11ch;
  font-size: clamp(34px, 8vw, 64px);
}

.mark-note,
.mark-samples,
.sign-local,
.book-lab p {
  max-width: 40rem;
  margin: 14px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  color: var(--paper-ink);
}

.mark-samples,
.book-lab p,
.book-note,
.book-nav p,
#sign-preview-caption {
  color: #5e584e;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.45;
  text-transform: uppercase;
}

.mark-open,
#sign-place {
  display: flex;
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: var(--paper-ink);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.book {
  margin-top: 28px;
}

/* Permanent public creator credit beneath the book (not part of page folios). */
.yearbook-creator {
  margin: 40px auto 0;
  max-width: 26rem;
  text-align: center;
}

.yearbook-creator-mark {
  display: block;
  width: auto;
  height: 18px;
  margin: 0 auto 14px;
  opacity: 0.7;
  filter: invert(1);
  mix-blend-mode: multiply;
}

.yearbook-creator-line {
  margin: 0;
  color: rgba(20, 20, 20, 0.52);
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.55;
}

.yearbook-creator-line + .yearbook-creator-line {
  margin-top: 3px;
}

.book-stage {
  margin-top: 18px;
  perspective: 1800px;
}

.book-spread {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  transform-origin: center center;
}

.book-leaf {
  position: relative;
  min-width: 0;
}

.book-paper {
  position: relative;
  container: yearbook-page / size;
  aspect-ratio: 1000 / 1320;
  overflow: hidden;
  background-color: #f6efe2;
  background-image:
    radial-gradient(rgba(110, 82, 40, 0.035) 0.5px, transparent 0.65px),
    linear-gradient(180deg, rgba(255, 252, 246, 0.7), rgba(120, 86, 40, 0.05));
  background-size: 4px 4px, auto;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 14px 30px rgba(48, 36, 18, 0.12);
}

.book-leaf[data-side="left"] .book-paper {
  background-image:
    radial-gradient(rgba(110, 82, 40, 0.035) 0.5px, transparent 0.65px),
    linear-gradient(90deg, rgba(255, 252, 246, 0.35), rgba(70, 48, 24, 0.09));
}

.book-leaf[data-side="right"] .book-paper {
  background-image:
    radial-gradient(rgba(110, 82, 40, 0.035) 0.5px, transparent 0.65px),
    linear-gradient(270deg, rgba(255, 252, 246, 0.35), rgba(70, 48, 24, 0.09));
}

.book-gutter {
  width: 22px;
  background:
    linear-gradient(90deg, rgba(48, 34, 18, 0.22), rgba(246, 239, 226, 0.2) 42%, rgba(246, 239, 226, 0.2) 58%, rgba(48, 34, 18, 0.22));
}

.book-folio {
  position: absolute;
  bottom: 16px;
  margin: 0;
  color: rgba(20, 20, 20, 0.42);
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.book-leaf[data-side="left"] .book-folio { left: 18px; }
.book-leaf[data-side="right"] .book-folio { right: 18px; }

.book-ink {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  scroll-margin-top: calc(var(--header) + 20px);
}

.book-ink img {
  position: absolute;
  left: var(--ink-x);
  top: var(--ink-y);
  width: var(--ink-w);
  height: var(--ink-h);
  max-width: none;
  background: transparent;
  transform: rotate(var(--tilt));
  pointer-events: none;
}

.book-byline,
.book-time {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  color: #8a7d6e;
  font-family: "Space Grotesk Regular", "Space Grotesk", sans-serif;
  font-size: calc(100cqh * 18.22 / 1320);
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.book-byline {
  top: var(--byline-y);
  height: var(--byline-h);
}

.book-time {
  top: var(--time-y);
  height: var(--time-h);
}

.sign-preview-time {
  margin: 8px 0 0;
  color: #8a7d6e;
  font-family: "Space Grotesk Regular", "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

.book-ink[aria-pressed="true"] img {
  filter: drop-shadow(0 0 0.4px rgba(20, 20, 20, 0.55));
}

.book-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.book-nav button,
.book-lab button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(20, 20, 20, 0.4);
  background: transparent;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.book-nav button:disabled { opacity: 0.35; cursor: default; }

.book-nav p,
.book-note,
.book-status { margin: 0; text-align: center; }

.book-note,
.book-status { margin-top: 12px; min-height: 1.4em; }

.book-status { letter-spacing: 0.04em; text-transform: none; }

.book-lab { margin-top: 22px; }

.book-lab div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.book-lab button[aria-pressed="true"] {
  background: var(--paper-ink);
  color: var(--paper);
  border-color: var(--paper-ink);
}

@media (prefers-reduced-motion: no-preference) {
  .book-spread.is-turning { animation: book-turn 0.46s ease; }
  .book-spread.is-turning[data-dir="prev"] { animation-name: book-turn-back; }
}

@keyframes book-turn {
  from { transform: perspective(1600px) rotateY(-9deg); }
  to { transform: none; }
}

@keyframes book-turn-back {
  from { transform: perspective(1600px) rotateY(9deg); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .book-spread.is-turning { animation: none; }
}

@media (min-width: 800px) {
  .book-spread { grid-template-columns: 1fr 22px 1fr; }
}

#sign-sheet {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--paper-ink);
  color-scheme: light;
}

#sign-sheet::backdrop { background: rgba(20, 20, 20, 0.46); }

.sign-sheet-body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 32px;
}

.sign-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.sign-bar p {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 0.9;
  text-transform: uppercase;
}

.sign-bar button,
.sign-edits button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(20, 20, 20, 0.4);
  background: transparent;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.sign-local { margin-top: 8px; font-size: 15px; }

.sign-stage {
  position: relative;
  height: min(52vh, 460px);
  min-height: 260px;
  margin-top: 16px;
  overflow: hidden;
  background:
    radial-gradient(rgba(110, 82, 40, 0.04) 0.5px, transparent 0.65px),
    linear-gradient(180deg, #fbf7ef, #f3eadc);
  background-size: 4px 4px, auto;
  border: 1px solid rgba(20, 20, 20, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  touch-action: none;
}

.sign-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.sign-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 10%;
  right: 10%;
  bottom: 26%;
  border-top: 1px solid rgba(20, 20, 20, 0.16);
  pointer-events: none;
}

.sign-hint,
.sign-brand {
  position: absolute;
  z-index: 1;
  margin: 0;
  pointer-events: none;
}

.sign-hint {
  left: 10%;
  bottom: calc(26% + 10px);
  color: rgba(20, 20, 20, 0.38);
  font-family: var(--script);
  font-size: 28px;
  line-height: 1;
}

.sign-hint.is-hidden { visibility: hidden; }

.sign-brand {
  top: 12px;
  right: 14px;
  line-height: 0;
}

/* Official brushstroke mark at the prior plain-text footprint (~51×27).
   logo-mark.png is white-on-black; invert + multiply yields black strokes on cream. */
.sign-brand img {
  display: block;
  width: 51px;
  height: auto;
  opacity: 0.18;
  filter: invert(1);
  mix-blend-mode: multiply;
}

.sign-tools { display: grid; gap: 10px; margin-top: 12px; }

.ink-row,
.sign-edits { display: flex; flex-wrap: wrap; gap: 8px; }

.ink-choice {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(20, 20, 20, 0.28);
  background: transparent;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.ink-choice[aria-checked="true"] {
  border-color: var(--paper-ink);
  background: rgba(20, 20, 20, 0.06);
}

.ink-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.sign-edits button:disabled,
.mark-open:disabled,
#sign-place:disabled { opacity: 0.38; cursor: default; }

.sign-fields label:not(.sign-check) {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 6px;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sign-fields label:not(.sign-check) span { letter-spacing: 0.12em; color: #5e584e; }

.sign-fields .sign-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 0;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
  color: var(--paper-ink);
  cursor: pointer;
}

.sign-fields .sign-check span {
  min-width: 0;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper-ink);
}

.sign-fields .sign-disclosure {
  margin: 8px 0 0 26px;
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.4;
  color: #5e584e;
}

.sign-fields .sign-check input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  flex: 0 0 16px;
  accent-color: var(--paper-ink);
}

.sign-fields input[type="text"] {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid rgba(20, 20, 20, 0.35);
  background: transparent;
  padding: 0 0 8px;
  font-family: var(--serif);
  font-size: 18px;
}

.sign-status {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: #5e584e;
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sign-preview img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin-top: 16px;
  background: transparent;
}

#sign-preview-caption { margin-top: 10px; }

#sign-place {
  background: transparent;
  color: var(--paper-ink);
  border: 1px solid var(--paper-ink);
}

.paper-page .mark button:focus-visible,
.paper-page .mark a:focus-visible,
#sign-sheet button:focus-visible,
#sign-sheet input:focus-visible,
.book-ink:focus-visible {
  outline: 2px solid var(--paper-ink);
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .mark-open { width: auto; min-width: 280px; padding: 0 22px; }
  #sign-place { width: 100%; }

  #sign-sheet {
    width: min(760px, calc(100% - 48px));
    height: auto;
    max-height: calc(100% - 48px);
    margin: auto;
    border: 1px solid rgba(20, 20, 20, 0.18);
  }

  .sign-sheet-body { max-height: calc(100vh - 48px); overflow-x: hidden; }
  .sign-stage { height: 420px; }
}
