/* The landing screen reads as two leaves from an illustrated old book.
   Text and controls remain HTML; only the paper is a decorative image. */
body.landing-active { background: #151917; }

.landing {
  --leaf-ink: #302b23;
  --leaf-rule: #8d7859;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 40%, #333b34, #1d2420 55%, #121613);
}

.landing-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  gap: .35rem;
  width: min(100%, 61rem);
  aspect-ratio: auto;
  overflow: visible;
  border: 0;
  background: none;
  box-shadow: none;
  isolation: isolate;
}

.landing-stage::before, .landing-stage::after { content: none; }

.landing-leaf, .landing-controls {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: clamp(2rem, 4vw, 3rem);
  color: var(--leaf-ink);
  background: none;
  isolation: isolate;
}

.landing-leaf::before, .landing-controls::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: url("assets/images/antique-book-leaf.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 8px 12px rgb(0 0 0 / .25));
  pointer-events: none;
}

/* A plain-paper base keeps the content legible while the texture loads. */
.landing-leaf::after, .landing-controls::after {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 4% 5%;
  background: #eadfc6;
  pointer-events: none;
}

.landing-controls::before { transform: scaleX(-1); }

.landing-leaf {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .8rem;
}

/* Faded printing belongs to the paper beneath the illustration. */
.landing-plate { margin: 0; min-width: 0; }
.landing-illustration { position: relative; }
.landing-page-text {
  position: absolute;
  z-index: 0;
  inset: -.3rem -1.8rem 0;
  overflow: hidden;
  background: url("assets/images/hero-book-text.svg") top center / 100% auto no-repeat;
  opacity: .3;
  filter: blur(.4px);
  -webkit-mask-image: linear-gradient(transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(transparent, #000 3%, #000 97%, transparent);
  pointer-events: none;
  user-select: none;
}
.plate-heading, .landing-title, .landing-artwork, .landing-leaf figcaption { position: relative; z-index: 1; }

.plate-heading {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-inline: 1.5rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--leaf-rule);
  color: #61513c;
  font-size: 1.3rem;
  line-height: 1.4;
  letter-spacing: .15em;
  text-align: center;
  text-transform: uppercase;
}
.plate-heading > span:last-child { position: absolute; top: .7em; right: 0; font-size: .5em; }

.landing-artwork { display: block; background: transparent; }
.landing-artwork img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: none;
  margin: 0 auto;
  object-fit: contain;
  filter: grayscale(.95) sepia(.24) contrast(1.15) brightness(.76);
}

.landing-leaf figcaption {
  margin: .4rem 0 0;
  padding: 0;
  border: 0;
  color: #61513c;
  text-align: center;
  font-size: .8rem;
  font-style: italic;
  line-height: 1.4;
}

.landing-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: auto;
}

.landing-introduction { margin: 0 0 1.8rem; color: var(--leaf-ink); }
.landing-kicker {
  margin: 0 0 1.2rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--leaf-rule);
  color: #665139;
  font-size: .65rem;
  font-weight: 400;
  letter-spacing: .15em;
  line-height: 1.6;
}

.landing-title {
  margin: .15rem 0 .45rem;
  color: var(--leaf-ink);
  font-family: Georgia, "Times New Roman", "Noto Serif", "DejaVu Serif", serif;
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.035em;
  text-align: center;
  text-wrap: balance;
}

.landing-title span { display: block; color: #643d30; }
.landing-title em {
  display: block;
  margin: .45rem 0;
  color: #75634a;
  font-size: .4em;
  letter-spacing: .04em;
}

.landing-introduction > p:last-child {
  margin: 0 auto;
  max-width: 28rem;
  color: #554836;
  font-size: .94rem;
  line-height: 1.65;
  text-wrap: pretty;
}

.landing-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.landing-control {
  position: relative;
  inset: auto;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: .8rem .6rem;
  border: 1px solid #837052;
  border-radius: 2px;
  background: transparent;
  color: var(--leaf-ink);
  box-shadow: none;
  text-shadow: none;
  font: 400 .9rem/1.3 Georgia, "Times New Roman", "Noto Serif", "DejaVu Serif", serif;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.landing-control:not(:disabled):hover { filter: none; background-color: rgb(107 81 49 / .09); }
.landing-control:not(:disabled):active { transform: translateY(1px); box-shadow: none; }
.landing-control:focus-visible { outline: 3px solid #74422c; outline-offset: 4px; }
.landing-control[aria-pressed="true"] { outline: 2px solid #5b4430; outline-offset: 3px; box-shadow: none; }
.landing-role {
  --role-ink: #f6ebd6;
  --role-paper: #704336;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: 1.25rem .9rem 1.15rem;
  border: 0;
  border-radius: 0;
  color: var(--role-ink);
  background: transparent;
  box-shadow: none;
  text-align: center;
  isolation: isolate;
  filter: drop-shadow(0 2px 2px rgb(61 43 23 / .28));
}

/* Sample inside the book leaf so its pale backing layers cannot rim the buttons. */
.landing-role::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 0;
  background-color: var(--role-paper);
  background-image: url("assets/images/paper-fibres.svg"), url("assets/images/antique-book-leaf.webp");
  background-position: center;
  background-size: 160px 160px, 112% 112%;
  background-repeat: repeat, no-repeat;
  background-blend-mode: soft-light, multiply;
  clip-path: polygon(1.2% 1%, 15% .4%, 28% 1.1%, 43% .5%, 57% 1%, 72% .3%, 87% .8%, 99% .5%, 99.5% 15%, 98.9% 31%, 99.6% 46%, 99% 61%, 99.7% 77%, 99% 98.8%, 85% 99.4%, 70% 98.9%, 54% 99.6%, 39% 99%, 24% 99.5%, 1% 99%, .4% 84%, 1.1% 68%, .5% 53%, 1% 38%, .3% 22%);
  box-shadow: inset 0 0 12px rgb(75 53 30 / .16);
  filter: contrast(1.08);
  pointer-events: none;
}

.landing-role::before {
  content: "";
  display: block;
  position: static;
  flex: 0 0 4rem;
  width: 4rem;
  height: 4rem;
  border: 0;
  border-radius: 0;
  background: var(--role-icon) center / contain no-repeat;
  box-shadow: none;
}

.landing-role[data-role="moby"] { --role-icon: url("assets/images/role-icon-moby-engraved.webp"); }
.landing-role[data-role="moby"]::before { width: 6rem; }
.landing-role[data-role="ahab"] { --role-ink: #704735; --role-paper: #efdbd4; --role-icon: url("assets/images/role-icon-ahab-engraved.webp"); }
.landing-role:not(:disabled):hover { background: transparent; filter: drop-shadow(0 3px 3px rgb(61 43 23 / .35)); }
.landing-role:not(:disabled):hover::after { filter: contrast(1.08) brightness(1.04); }
.landing-role[aria-pressed="true"] { background: transparent; outline: none; }
.landing-role[aria-pressed="true"]::after { filter: contrast(1.12) brightness(.94); }
.landing-role:focus-visible { outline: 3px solid var(--role-ink); outline-offset: 5px; }
.landing-role .role-name::after {
  content: "";
  position: absolute;
  top: .75rem;
  right: .85rem;
  width: 1.2rem;
  height: 1.2rem;
  background: currentColor;
  -webkit-mask: url("assets/images/role-icon-ahab.png") center / contain no-repeat;
  mask: url("assets/images/role-icon-ahab.png") center / contain no-repeat;
  opacity: 0;
}
.landing-role[aria-pressed="true"] .role-name::after { opacity: 1; }
.landing-role .role-copy { position: static; transform: none; gap: .25rem; width: 100%; }
.landing-role small { margin: 0; color: #67543b; font-size: .59rem; font-weight: 400; letter-spacing: .2em; line-height: 1.4; text-transform: uppercase; }
.landing-role .role-name { font-size: 1.18rem; font-weight: 600; font-variant-caps: small-caps; letter-spacing: .015em; line-height: 1.25; }
.landing-role .role-objective { margin: .15rem auto 0; padding-top: .4rem; border-top: 1px solid rgb(125 100 64 / .4); color: #59472f; font-size: .74rem; font-style: italic; font-weight: 400; line-height: 1.4; }
.landing-role[data-role="moby"] small, .landing-role[data-role="moby"] .role-objective { color: #f3e4c9; }
.landing-role[data-role="moby"] .role-objective { border-top-color: rgb(243 228 201 / .35); }
.landing-role[data-role="moby"]:focus-visible { outline-color: #5b3a2b; }

.landing-status, .landing-status.show {
  position: static;
  width: 100%;
  min-height: 2.8em;
  margin: .85rem 0 .5rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #554836;
  font-size: .79rem;
  line-height: 1.4;
  text-align: center;
  opacity: 1;
  visibility: visible;
  transform: none;
}
.landing .landing-status:empty { min-height: 0; margin: 1rem 0 0; }

.landing-begin {
  --hunt-paper: #683d2c;
  width: 100%;
  min-height: 4.2rem;
  padding: 1.15rem 1.4rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff4db;
  font-size: 1.16rem;
  font-weight: 700;
  font-variant-caps: small-caps;
  letter-spacing: .09em;
  line-height: 1.4;
  text-shadow: 0 1px 1px rgb(30 16 10 / .4);
  isolation: isolate;
  filter: drop-shadow(0 3px 2px rgb(65 40 21 / .25));
  transition: color .15s ease, transform .15s ease;
}
.landing-begin::before {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: var(--hunt-paper) url("assets/images/antique-book-leaf.webp") center / 112% 112% no-repeat;
  background-blend-mode: multiply;
  clip-path: polygon(1.2% 8%, 13% 5%, 25% 7%, 38% 3%, 49% 5%, 64% 2%, 77% 5%, 89% 3%, 98.7% 7%, 100% 40%, 99.3% 70%, 98.4% 94%, 84% 97%, 70% 95%, 56% 98%, 41% 95%, 28% 98%, 14% 95%, 1% 97%, 0% 69%, .7% 35%);
  box-shadow: inset 0 0 14px rgb(46 24 12 / .2);
  pointer-events: none;
  transition: background-color .15s ease;
}
.landing-begin:not(:disabled):hover {
  --hunt-paper: #7b4933;
  background: transparent;
  filter: drop-shadow(0 4px 3px rgb(65 40 21 / .3));
  transform: translateY(-1px);
}
.landing-begin:not(:disabled):active {
  --hunt-paper: #583222;
  transform: translateY(1px);
  filter: drop-shadow(0 1px 1px rgb(65 40 21 / .25));
}
.landing-begin:disabled {
  --hunt-paper: #f3ead7;
  background: transparent;
  color: #6a5438;
  text-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  filter: drop-shadow(0 1px 1px rgb(65 40 21 / .16));
}
.landing-how::before, .landing-about::before { content: none; }

.guided-choice {
  min-height: 44px;
  margin: .75rem auto 0;
  padding: .2rem;
  gap: .65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #463c2e;
  font-size: .81rem;
}
input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid #806447;
  border-radius: 2px;
  background: #f0e3c9;
  color: #fff0d2;
  cursor: pointer;
}
input[type="checkbox"]::before {
  content: "";
  width: 1.2rem;
  height: 1.2rem;
  background: currentColor;
  -webkit-mask: url("assets/images/role-icon-ahab.png") center / contain no-repeat;
  mask: url("assets/images/role-icon-ahab.png") center / contain no-repeat;
  opacity: 0;
}
input[type="checkbox"]:checked { background: #704336; border-color: #5b3a2b; }
input[type="checkbox"]:checked::before { opacity: 1; }
input[type="checkbox"]:focus-visible { outline: 2px solid #74422c; outline-offset: 3px; }
.guided-choice strong { font-weight: 400; }
.guided-choice small { color: #665944; font-size: .67rem; }
.guided-choice:focus-within { outline: 2px solid #74422c; outline-offset: 4px; }

.landing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-top: 1.1rem;
  padding-top: .6rem;
  border-top: 1px solid var(--leaf-rule);
}
.landing-how, .landing-about { border: 0; padding: .5rem .2rem; min-height: 44px; font-size: .82rem; text-decoration: underline; text-decoration-color: #a9987c; text-underline-offset: .3em; }
.landing-footer.site-credit-bar { color: #c0c1ad; }
.landing-footer.site-credit-bar a { color: #dedcc9; }
.landing-footer.site-credit-bar a:hover { color: #fff3db; }

.landing-dialog {
  color: #2d211b;
  background: #e8dfc7;
  border: 1px solid #5b3a2b;
  text-align: center;
  box-shadow: 0 18px 60px rgb(0 0 0 / .5);
}
.landing-dialog::backdrop { background: rgb(0 0 0 / .74); backdrop-filter: blur(2px); }
.landing-dialog h2 { margin: .1rem 0 .7rem; }
.landing-dialog p { line-height: 1.55; }
.landing-dialog button { padding: .7rem 1rem; border: 1px solid #5b3a2b; background: #f3ead6; font-weight: 700; cursor: pointer; }

@media (max-width: 760px) {
  .landing { justify-content: flex-start; gap: .5rem; padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .landing-stage { grid-template-columns: minmax(0, 1fr); width: min(100%, 30rem); gap: 0; }
  .landing-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("assets/images/antique-book-leaf.webp") center / 100% 100% no-repeat; filter: drop-shadow(0 8px 12px rgb(0 0 0 / .25)); pointer-events: none; }
  .landing-stage::after { content: ""; position: absolute; inset: 4% 5%; z-index: -2; background: #eadfc6; pointer-events: none; }
  .landing-leaf::before, .landing-leaf::after, .landing-controls::before, .landing-controls::after { content: none; }
  .landing-leaf { padding: 2rem 1.65rem .7rem; gap: .4rem; }
  .landing-page-text { inset: -.2rem -.5rem 0; }
  .plate-heading { padding-bottom: .35rem; font-size: 1.14rem; }
  .landing-artwork img { width: auto; max-height: min(44svh, 25rem); max-width: 100%; height: auto; }
  .landing-leaf figcaption { margin-top: .35rem; font-size: .7rem; }
  .landing-controls { padding: .8rem 1.65rem 2.1rem; }
  .landing-introduction { margin-bottom: .9rem; }
  .landing-kicker { margin-bottom: .75rem; padding-bottom: .4rem; font-size: .57rem; }
  .landing-title { margin: .3rem 0 .6rem; font-size: 1.85rem; }
  .landing-title em { margin: .2rem 0; }
  .landing-introduction > p:last-child { font-size: .79rem; line-height: 1.5; }
  .landing-introduction > p:last-child br { display: none; }
  .landing-roles { gap: .65rem; }
  .landing-role { padding: 1.05rem .7rem .95rem; gap: .45rem; }
  .landing-role::before { display: block; flex-basis: 3.5rem; width: 3.5rem; height: 3.5rem; }
  .landing-role[data-role="moby"]::before { width: 5.25rem; }
  .landing-role .role-name { font-size: 1.02rem; }
  .landing-role .role-objective { font-size: .7rem; }
  .landing-status, .landing-status.show { margin-top: .6rem; margin-bottom: .35rem; font-size: .73rem; }
  .landing-begin { grid-column: auto; grid-row: auto; min-height: 3.8rem; padding: .9rem 1.1rem; font-size: 1.05rem; }
  .guided-choice { margin-top: .5rem; }
  .landing-actions { margin-top: .6rem; padding-top: .25rem; }
}

@media (max-width: 360px) {
  .landing-controls { padding-inline: 1.35rem; }
  .landing-role .role-name { font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .landing, .landing-control, .landing-status, .landing-begin::before { transition: none; }
  .landing .side-choice.attention { animation: none; }
}

@media (forced-colors: active) {
  input[type="checkbox"] { forced-color-adjust: none; background: Canvas; border-color: ButtonText; color: CanvasText; }
  input[type="checkbox"]:checked { background: Highlight; border-color: Highlight; color: HighlightText; }
  input[type="checkbox"]:focus-visible { outline-color: Highlight; }
  .landing-role .role-name::after { background: CanvasText; forced-color-adjust: none; }
  .landing-stage::before, .landing-leaf::before, .landing-controls::before, .landing-page-text { display: none; }
  .landing-control { border: 1px solid ButtonText; }
  .landing-control[aria-pressed="true"] { outline: 3px solid Highlight; }
  .landing-role::before { background: CanvasText; forced-color-adjust: none; }
  .landing-role, .landing-role:not(:disabled):hover { filter: none; }
  .landing-role::after, .landing-role:not(:disabled):hover::after, .landing-role[aria-pressed="true"]::after { background: Canvas; border: 1px solid ButtonText; filter: none; clip-path: none; box-shadow: none; }
  .landing-begin, .landing-begin:not(:disabled):hover, .landing-begin:not(:disabled):active { background: ButtonFace; color: ButtonText; border: 2px solid ButtonText; filter: none; text-shadow: none; }
  .landing-begin:disabled { color: GrayText; border-color: GrayText; }
  .landing-begin::before { display: none; }
  .landing-leaf, .landing-controls { background: Canvas; }
}
