/* jslau.au
   Layout: a page of the book on a screen. A narrow column for reading, wider frames for
   the covers and drawings, everything aligned to one left edge. One light theme on purpose:
   black ink on white paper, the same as the book and its drawings.
   Type: one face (IBM Plex Mono) in four sizes, each with one job:
   display for the page's one headline, heading for section titles and the readers' quotes,
   body for everything you read or press, small for labels, captions and fine print. */
:root {
  --paper: #ffffff;   /* page white, the same as the drawings' paper */
  --ink: #171614;     /* near-black, a touch warm */
  --pencil: #5e5b55;  /* second-level text */
  --rule: #e3e0d9;    /* hairlines and frames */
  --wash: #f6f5f1;    /* quiet panels */
  --lemon: #f2d548;   /* highlighter yellow, after the lemon tree on p. 16 */
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-display: clamp(1.75rem, 1.35rem + 1.8vw, 2.5rem);
  --fs-heading: clamp(1.25rem, 1.15rem + 0.5vw, 1.375rem);
  --fs-body: 1rem;
  --fs-small: 0.8125rem;
  --measure: 38rem;   /* about 62 characters of Plex Mono */
  --wide: 64rem;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (min-width: 48rem) { html { font-size: 106.25%; } }
body {
  margin: 0;
  padding-inline: 16px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-body);
  line-height: 1.65;
}
@media (min-width: 48rem) { body { padding-inline: 32px; } }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { background: var(--lemon); }
:focus-visible { outline: 3px solid var(--lemon); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-heading); }
h3 { font-size: var(--fs-body); }
p { margin: 0; }

.label { font-size: var(--fs-small); letter-spacing: 0.08em; text-transform: uppercase; color: var(--pencil); }
.small, figcaption, .folio, .form-note, .byline { font-size: var(--fs-small); color: var(--pencil); }
.measure { max-width: var(--measure); }
.stack { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.hl { background: linear-gradient(transparent 56%, var(--lemon) 56%, var(--lemon) 90%, transparent 90%); }
/* “J.S. Lau” takes a half-width space: Plex Mono’s full-width space reads as a gap */
.jsl { word-spacing: -0.3em; white-space: nowrap; }

/* header and footer */
.site-header, .site-footer, main { max-width: var(--wide); margin-inline: auto; }
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.5rem; padding-block: 1.1rem; border-bottom: 1px solid var(--rule);
}
.wordmark { font-weight: 600; text-decoration: none; letter-spacing: -0.02em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.25rem; }
.nav a { text-decoration: none; }
.nav a[aria-current="page"] { text-decoration: underline; }
.nav .buy { background: var(--ink); color: var(--paper); padding: 0.3rem 0.85rem; }
.nav .buy:hover { background: var(--lemon); color: var(--ink); }
.site-footer {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--pencil);
}
.draft-bar {
  max-width: var(--wide); margin-inline: auto; padding: 0.5rem 0.75rem; margin-top: 0.75rem;
  background: var(--lemon); color: var(--ink); font-size: var(--fs-small);
}

main { display: grid; gap: clamp(3.5rem, 8vw, 5.5rem); padding-block: clamp(2rem, 5vw, 3.5rem) 4rem; }
section { display: grid; gap: 1.25rem; min-width: 0; }

/* buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn {
  display: inline-block; padding: 0.8rem 1.25rem; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper); font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer; border-radius: 0;
}
.btn:hover { background: var(--lemon); color: var(--ink); }
.btn.quiet { background: transparent; color: var(--ink); }
.btn.quiet:hover { background: var(--lemon); }

/* the book on the left, what it is on the right */
.hero { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 52rem) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 3.5rem; }
  .book-hero, .about-hero { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); align-items: start; }
}
.cover-btn {
  position: relative; display: block; width: 100%; max-width: 30rem; padding: 0; border: 0;
  background: none; cursor: zoom-in; font: inherit; color: inherit;
}
.cover-btn .badge {
  position: absolute; left: 0; bottom: 1.25rem; padding: 0.7rem 1.1rem;
  background: var(--ink); color: var(--paper); font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(23, 22, 20, 0.6);
}
.cover-btn .badge::after { content: " ›"; }
.cover-btn:hover .badge { background: var(--lemon); color: var(--ink); }
.cover-wrap { display: block; max-width: 30rem; width: 100%; }
.cover-wrap:hover { background: none; }
.cover-wrap.narrow { max-width: 22rem; }
.cover { width: 100%; border: 1px solid var(--rule); box-shadow: 0 22px 44px -28px rgba(23, 22, 20, 0.5); background: var(--paper); }
.portrait img { width: 100%; max-width: 22rem; filter: grayscale(1) contrast(1.05); }

/* a piece, set like a page of the book, with its page number */
.page {
  display: grid; gap: 0.9rem; max-width: var(--measure); min-width: 0;
  padding: clamp(1.25rem, 4vw, 2.5rem); border: 1px solid var(--rule); background: var(--paper);
}
.folio { justify-self: end; }
.quote { border-left: 2px solid var(--lemon); padding-left: 1.25rem; }

/* readers’ quotes */
.praise { max-width: var(--measure); }
.praise figure { gap: 0.75rem; }
.praise blockquote { margin: 0; padding-left: 1.25rem; border-left: 2px solid var(--lemon); }
.praise blockquote p { font-size: var(--fs-heading); line-height: 1.45; font-weight: 500; text-wrap: pretty; }
.praise figcaption { padding-left: 1.25rem; }

/* Look inside: sample pages in a pop-up, one page at a time; the pages fill the space there is */
.look {
  width: min(44rem, calc(100vw - 1.5rem)); height: min(46rem, calc(100dvh - 1.5rem)); max-height: none;
  padding: 0; border: 1px solid var(--ink); background: var(--wash); color: var(--ink);
}
.look[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.look::backdrop { background: rgba(23, 22, 20, 0.62); }
.look-head { display: flex; align-items: center; gap: 0.75rem 1rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule); }
.look-count { margin-left: auto; font-size: var(--fs-small); color: var(--pencil); font-variant-numeric: tabular-nums; white-space: nowrap; }
.look-close { font: inherit; font-size: var(--fs-small); padding: 0.3rem 0.75rem; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.look-close:hover { background: var(--lemon); }
.look-stage { position: relative; min-height: 0; display: grid; }
.look-track {
  display: flex; gap: 1rem; padding: 1rem; height: 100%; min-height: 0;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
}
.look-track::-webkit-scrollbar { display: none; }
.sheet {
  flex: 0 0 100%; height: 100%; min-height: 0; min-width: 0; margin: 0; scroll-snap-align: center;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 0.5rem;
  padding: clamp(1rem, 4vw, 2.25rem);
  background: var(--paper); border: 1px solid var(--rule); box-shadow: 0 14px 30px -24px rgba(23, 22, 20, 0.55);
}
.sheet-text { min-height: 0; overflow-y: auto; display: grid; gap: 0.8rem; align-content: start; padding-bottom: 1rem; }
.sheet-art img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.look-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 2.6rem; height: 2.6rem; padding: 0; border: 1px solid var(--ink); border-radius: 50%;
  background: rgba(255, 255, 255, 0.75); color: var(--ink); font: 600 var(--fs-heading)/1 var(--mono);
  opacity: 0.55; cursor: pointer;
}
.look-arrow:hover, .look-arrow:focus-visible { opacity: 1; background: var(--lemon); }
.look-arrow.prev { left: 0.35rem; }
.look-arrow.next { right: 0.35rem; }
.look-arrow[disabled] { opacity: 0; pointer-events: none; }
.look-foot { display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0 1rem; }
.look-foot .btn[disabled] { opacity: 0.35; cursor: default; background: transparent; }
.look-note { padding: 0.6rem 1rem 1rem; }

.look-teaser { display: grid; gap: 1.5rem; padding: clamp(1.25rem, 4vw, 2.25rem); background: var(--wash); }
@media (min-width: 52rem) { .look-teaser { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; } }
.teaser-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.teaser-strip img { aspect-ratio: 1 / 1; object-fit: contain; background: var(--paper); border: 1px solid var(--rule); padding: 0.4rem; }

/* drawings at full size, captioned like the book */
.drawings { display: grid; gap: 2.5rem 2rem; }
@media (min-width: 44rem) { .drawings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; } }
figure { margin: 0; display: grid; gap: 0.6rem; min-width: 0; }
figure img { width: 100%; }

/* books: covers in a grid; the title carries an arrow so it reads as a link */
.books { display: grid; gap: 2rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); }
.book-card { display: grid; gap: 0.5rem; align-content: start; text-decoration: none; min-width: 0; }
.book-card:hover { background: none; }
.book-card img { width: 100%; aspect-ratio: 4 / 5; object-fit: contain; background: var(--wash); padding: 0.75rem; border: 1px solid var(--rule); }
.book-card h3::after { content: " ›"; }
.book-card:hover h3 { background: var(--lemon); }

/* buying: one card for Australia, one for everywhere else */
.buy-options { display: grid; gap: 1.25rem; }
@media (min-width: 44rem) { .buy-options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.buy-card { display: grid; gap: 0.9rem; align-content: start; padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid var(--ink); min-width: 0; }
.buy-card h3 { font-size: var(--fs-heading); }
.stores { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stores .btn { padding: 0.55rem 0.9rem; }
.buy-dialog { width: min(46rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); padding: 0; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); }
.buy-dialog::backdrop { background: rgba(23, 22, 20, 0.62); }
.buy-dialog .buy-options { padding: 1rem; }
.draft-note { background: var(--lemon); color: var(--ink); padding: 0.4rem 0.6rem; }

/* sign-up */
.signup { border: 1px solid var(--ink); padding: clamp(1.25rem, 4vw, 2.25rem); gap: 1rem; }
.signup-form { display: flex; flex-wrap: wrap; gap: 0.6rem; max-width: var(--measure); }
.signup-form input {
  flex: 1 1 14rem; min-width: 0; padding: 0.8rem 0.9rem; font: inherit;
  color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 0;
}
.form-note { min-height: 1.5em; }
.empty { color: var(--pencil); }

/* preview only: headline options and logo samples */
.option { border-top: 1px solid var(--ink); padding-top: 1.25rem; }
.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; padding: 0.75rem 1rem; border: 1px solid var(--rule); }
.logo-mark { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* phones */
@media (max-width: 40rem) {
  /* the book reads as a book: smaller, centred, with room around it, and Look inside right under it */
  .hero > .cover-btn { max-width: min(15rem, 64vw); margin: 0.5rem auto 0; }
  .cover-btn .badge { position: static; display: block; margin-top: 0.9rem; text-align: center; box-shadow: none; }
  .cover-wrap.narrow { max-width: min(13rem, 56vw); margin-inline: auto; }
  .portrait img { max-width: 14rem; }
  /* other books: a compact list, small cover beside the title */
  .books { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; }
  .book-card { grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: 1rem; align-items: center; padding: 0.6rem; border: 1px solid var(--rule); }
  .book-card img { grid-row: span 2; width: 4.5rem; padding: 0.25rem; }
  /* sample pages use the whole screen */
  .look { width: 100vw; height: 100dvh; max-width: 100vw; margin: 0; border: 0; }
  .look-track { padding: 0.75rem; gap: 0.75rem; }
  .look-foot .btn { padding: 0.6rem 0.9rem; }
  .look-note { display: none; }
  /* smaller arrows at the very edge, so they don't sit on the words */
  .look-arrow { width: 1.9rem; height: 1.9rem; font-size: var(--fs-body); }
  .look-arrow.prev { left: 0; }
  .look-arrow.next { right: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  a, .btn { transition: background-color 0.15s ease, color 0.15s ease; }
}
/* in the Buy box, where you are is the first thing you read */
.buy-dialog .buy-card { gap: 0.75rem; }
