/*
  Style 2 ("Library"): a reading room. Peach and plum, a contents sidebar, bold grotesque headings
  and serif reading text. Its display name is set in content/site.yaml. Scoped to :root[data-style="style2"].
*/

:root[data-style="style2"] {
  --bg: #FCF6F1;
  --side: #F8ECE4;
  --peach: #F6D8C7;
  --peach-soft: #FBEEE6;
  --active: #F5D5C3;
  --hover: rgba(245, 213, 195, .55);
  --plum-ink: #360D30;
  --plum: #6B2358;
  --plum-hover: #561B47;
  --text: #3E2A3A;
  --muted: #6F5B69;
  --gold: #C79A43;
  --line: #E6D3C8;
  --line-strong: #CFB6A9;
  --side-w: 276px;

  --c-bg: var(--bg);
  --c-ink: var(--text);
  --c-focus: var(--gold);
  --f-sans: "Schibsted Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;
  --f-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --wrap: 1120px;
  --gutter: clamp(1.25rem, 4.5cqi, 3rem);
  color-scheme: light;

  :focus-visible { border-radius: 6px; outline-width: 2.5px; }
  .hand { font-family: var(--f-hand); font-weight: 500; line-height: 1; }

  .eyebrow {
    margin: 0 0 1.1rem;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--plum);
  }
  .i-arrow { width: 1.1em; height: .7em; flex: none; transition: transform .2s ease; }

  .btn-solid {
    display: inline-flex; align-items: center; gap: .75rem;
    padding: .95rem 1.6rem;
    border: 0;
    border-radius: 8px;
    background: var(--plum);
    color: #FFF7F2;
    font-size: 1.05rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease;
  }
  .btn-solid:hover { background: var(--plum-hover); }
  .btn-solid:disabled { opacity: .6; cursor: progress; }
  .text-link {
    display: inline-flex; align-items: center; gap: .6rem;
    padding-bottom: .2rem;
    border-bottom: 1px solid var(--plum);
    font-size: 1.02rem;
    color: var(--plum-ink);
    text-decoration: none;
  }
  .text-link:hover .i-arrow { transform: translateX(3px); }

  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: 8px;
    background: none;
    color: var(--plum-ink);
    cursor: pointer;
  }
  .icon-btn svg { width: 22px; height: 22px; }
  .icon-btn:hover { background: rgba(107, 35, 88, .08); }

  .soon-pill {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--peach);
    font-family: var(--f-sans);
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    line-height: 1.4;
    color: var(--plum);
  }

  /* ---------- App shell ---------- */
  .shell {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns .3s ease;
  }
  &.contents-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
  .page { min-width: 0; container: main / inline-size; }

  .contents-nav {
    position: sticky; top: 0;
    height: 100vh; height: 100dvh;
    overflow: hidden;
    background: var(--side);
    border-right: 1px solid var(--line);
    transition: visibility .3s;
  }
  &.contents-collapsed .contents-nav { visibility: hidden; }
  .contents-inner {
    display: flex; flex-direction: column;
    width: var(--side-w);
    height: 100%;
    padding: calc(1.6rem + env(safe-area-inset-top, 0px)) 1.1rem 1.3rem;
    overflow-y: auto;
  }
  .side-head { display: flex; align-items: center; gap: .75rem; padding-inline: .45rem; }
  .side-mark { width: 40px; height: 28px; flex: none; }
  .side-title { flex: 1; margin: 0; font-size: 1.08rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; color: var(--plum-ink); }
  .contents-close { margin-right: -.35rem; }
  .side-sub { margin: .5rem 0 0; padding-inline: .45rem; font-size: .95rem; color: var(--muted); }

  .side-search {
    display: flex; align-items: center; gap: .65rem;
    width: 100%; height: 44px;
    margin: 1.3rem 0 1.2rem;
    padding: 0 .7rem 0 .85rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, .35);
    font-size: .9rem;
    color: var(--muted);
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
  }
  .side-search:hover { border-color: var(--plum); background: rgba(255, 255, 255, .6); }
  .side-search svg { width: 19px; height: 19px; flex: none; color: var(--plum-ink); }
  .side-search span { flex: 1; }
  @media (hover: none) { .side-search kbd { display: none; } }
  .side-search kbd {
    padding: 0 .4rem;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    font-family: var(--f-sans);
    font-size: .75rem;
    line-height: 1.5;
  }

  .side-nav, .side-sublinks, .chapters { list-style: none; margin: 0; padding: 0; }
  .side-nav > li + li { margin-top: .35rem; }
  .side-link {
    display: flex; align-items: center; gap: .9rem;
    width: 100%;
    padding: .72rem .8rem;
    border: 0; border-radius: 10px;
    background: none;
    font-size: 1.04rem;
    font-weight: 500;
    color: var(--plum-ink);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }
  .side-link svg { width: 22px; height: 22px; flex: none; }
  .side-link:hover { background: var(--hover); }
  .side-link[aria-current="page"] { background: var(--active); }
  .side-link .chev { width: 18px; height: 18px; margin-left: auto; transition: transform .25s ease; }
  .side-link[aria-expanded="false"] .chev { transform: rotate(-90deg); }
  .side-sublinks a {
    display: block;
    padding: .4rem .8rem .4rem 3.05rem;
    border-radius: 8px;
    font-size: .95rem;
    color: var(--text);
    text-decoration: none;
  }
  .side-sublinks a:hover { background: var(--hover); color: var(--plum-ink); }

  .chapters-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s ease; }
  .chapters-wrap.is-closed { grid-template-rows: 0fr; }
  .chapters-wrap > ol { overflow: hidden; }
  .chapters-wrap.is-closed > ol { visibility: hidden; }
  .chapters a {
    display: grid; grid-template-columns: 1.9rem minmax(0, 1fr) auto; align-items: baseline; gap: .2rem;
    padding: .46rem .8rem .46rem 1.35rem;
    border-radius: 8px;
    font-size: .98rem;
    line-height: 1.3;
    color: var(--text);
    text-decoration: none;
  }
  .chapters a:hover { background: var(--hover); color: var(--plum-ink); }
  .chapters a[aria-current="page"] { background: var(--active); color: var(--plum-ink); }
  .chapters .n { font-family: var(--f-serif); font-size: 1rem; color: var(--muted); }
  .chapters .soon-pill { align-self: center; padding: .1rem .45rem; font-size: .6rem; }

  .contents-scrim { display: none; }

  /* ---------- Top bar ---------- */
  .site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgba(252, 246, 241, .92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .header-inner { display: flex; align-items: center; gap: 1rem; height: 84px; }
  .contents-btn {
    display: none; align-items: center; gap: .5rem;
    height: 42px; margin-left: -.4rem; padding: 0 .8rem 0 .6rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 10px;
    background: none;
    font-size: .92rem;
    font-weight: 500;
    color: var(--plum-ink);
    cursor: pointer;
  }
  .contents-btn svg { width: 22px; height: 22px; }
  .contents-btn:hover { background: var(--hover); }
  .brand { display: flex; align-items: center; gap: .85rem; margin-right: auto; text-decoration: none; }
  .brand-mark { width: 58px; height: 40px; flex: none; }
  .brand-name {
    font-size: clamp(1.4rem, 3.4cqi, 1.85rem);
    font-weight: 800;
    letter-spacing: -.035em;
    color: var(--plum-ink);
    white-space: nowrap;
  }
  .nav { display: flex; align-items: center; gap: 1.8rem; }
  .nav a { font-size: 1.02rem; color: var(--plum-ink); text-decoration: none; }
  .nav a:not(.btn-outline):hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 6px; }
  .btn-outline {
    padding: .55rem 1.1rem;
    border: 1.5px solid var(--plum);
    border-radius: 8px;
    font-weight: 500;
    transition: background-color .2s ease, color .2s ease;
  }
  .btn-outline:hover { background: var(--plum); color: #FFF7F2; }
  .menu-toggle { display: none; }

  /* ---------- Hero: Meet Tom ---------- */
  .hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .95fr);
    align-items: center;
    gap: clamp(2rem, 4cqi, 3rem);
    padding-block: .5rem clamp(2.5rem, 5cqi, 3.5rem);
  }
  .hero h1 {
    margin: 0 0 1.6rem;
    font-size: clamp(2.6rem, 7cqi, 4.4rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.05em;
    color: var(--plum-ink);
  }
  .hl {
    position: relative;
    display: inline-block;
    padding-bottom: .12em;
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.1em;
    letter-spacing: -.025em;
  }
  .hl-line { position: absolute; left: -1%; bottom: -.08em; width: 102%; height: .28em; overflow: visible; color: var(--gold); }
  .hero-body p { margin: 0 0 1rem; max-width: 52ch; font-size: 1.04rem; line-height: 1.6; color: var(--text); }
  .hero-body p:first-child {
    max-width: 34ch;
    margin-bottom: 1.4rem;
    font-size: clamp(1.15rem, 2.2cqi, 1.3rem);
    line-height: 1.45;
    color: var(--plum-ink);
  }
  .hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem; }

  .hero-art {
    position: relative;
    display: grid; place-items: center;
    width: 100%; max-width: 440px;
    aspect-ratio: 425 / 480;
    margin: 0;
    justify-self: end;
    border-radius: 18px;
    background: radial-gradient(90% 70% at 60% 35%, #FAE3D5 0%, rgba(250, 227, 213, 0) 70%), var(--peach);
  }
  .hero-art img {
    width: 64%; height: auto;
    aspect-ratio: 1;
    padding: 9px;
    border: 1.5px solid var(--gold);
    background: var(--peach-soft);
    object-fit: cover;
    box-shadow: 0 22px 36px -24px rgba(54, 13, 48, .5);
    transform: rotate(-2.5deg);
  }
  .paperclip {
    position: absolute; top: 12%; right: 23%; z-index: 2;
    width: 32px; height: 84px;
    color: var(--gold);
    transform: rotate(16deg);
    filter: drop-shadow(1px 2px 1.5px rgba(54, 13, 48, .28));
  }
  .hand-note {
    position: absolute; left: 7%; bottom: 8%;
    display: flex; align-items: flex-end; gap: .15em;
    font-size: clamp(1.6rem, 3.4cqi, 2rem);
    color: var(--plum);
    white-space: nowrap;
    transform: rotate(-6deg);
  }
  .hand-note span { display: block; }
  .hand-note svg { width: 1.4em; height: 1.1em; margin-bottom: .45em; transform: scale(-1, -1); }

  /* ---------- Reading section: The Projects ---------- */
  .prose-section { padding-block: clamp(2.8rem, 6cqi, 4rem); border-top: 1px solid var(--line); }
  .prose-inner { display: grid; grid-template-columns: minmax(0, 44rem); }
  .prose-aside { margin-bottom: 1.6rem; }
  .prose-section h2, .band h2, .projects h2 {
    margin: 0;
    font-size: clamp(2.1rem, 5.4cqi, 3rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.05em;
    color: var(--plum-ink);
  }

  /* Long-form text, on the home page and project pages */
  .prose { font-family: var(--f-serif); font-size: 1.2rem; line-height: 1.65; color: var(--text); }
  .prose > :first-child { margin-top: 0; }
  .prose p { margin: 0 0 1.1em; }
  .prose-section .prose > p:first-child::first-letter {
    float: left;
    margin: .06em .12em 0 0;
    font-size: 4.2em;
    font-weight: 500;
    line-height: .8;
    color: var(--plum);
  }
  .prose .lede { font-size: clamp(1.3rem, 2.6cqi, 1.5rem); line-height: 1.45; color: var(--plum-ink); }
  .prose h2 {
    margin: 2.2em 0 .7em;
    font-family: var(--f-sans);
    font-size: clamp(1.5rem, 3.4cqi, 1.9rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.035em;
    color: var(--plum-ink);
  }
  .prose h2::before { content: ""; display: block; width: 44px; height: 2px; margin-bottom: 1rem; background: var(--gold); }
  .prose ul { list-style: none; margin: 0 0 1.4em; padding: 0; }
  .prose ul li { position: relative; margin-bottom: .9em; padding-left: 1.5rem; }
  .prose ul li::before {
    content: ""; position: absolute; left: .15rem; top: .62em;
    width: .42rem; height: .42rem;
    border-radius: 2px;
    background: var(--plum);
    transform: rotate(45deg);
  }
  .prose a { color: var(--plum); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .prose blockquote { margin: 1.6em 0; padding-left: 1.2em; border-left: 2px solid var(--gold); font-style: italic; }

  /* ---------- Note: Apologies ---------- */
  .band { padding: 0 var(--gutter) clamp(3rem, 6cqi, 4rem); }
  .band-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(1.75rem, 4cqi, 3rem);
    max-width: calc(var(--wrap) - 2 * var(--gutter));
    padding: clamp(1.9rem, 4.5cqi, 2.8rem) clamp(1.5rem, 4.5cqi, 3rem);
    border-radius: 18px;
    background: var(--peach);
  }
  .band-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
  .band-top .brand-mark { width: 52px; height: 36px; }
  .band-top .eyebrow { margin: 0; }
  .band-rule { align-self: stretch; background: rgba(107, 35, 88, .55); }
  .band-body p { margin: 0 0 1rem; max-width: 46ch; font-size: 1.05rem; line-height: 1.55; }
  .band blockquote { margin: 1.4rem 0 0; }
  .band blockquote p {
    margin: 0;
    max-width: 24ch;
    font-size: clamp(1.35rem, 3cqi, 1.7rem);
    line-height: 1.28;
    letter-spacing: -.015em;
    color: var(--plum-ink);
    text-indent: -.45em;
  }

  /* ---------- Projects: a numbered list ---------- */
  .projects { padding-block: 0 clamp(3rem, 6cqi, 4rem); }
  .projects-head { margin-bottom: 1.4rem; }
  .projects-intro { max-width: 44rem; margin-top: 1rem; font-family: var(--f-serif); font-size: 1.15rem; }
  .project-grid { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-strong); }
  .project-card { border-bottom: 1px solid var(--line-strong); transition: background-color .2s ease, opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
  .project-card:hover { background: rgba(246, 216, 199, .38); }
  .project-link {
    display: grid;
    grid-template-columns: clamp(3.4rem, 11cqi, 7rem) minmax(0, 1fr) auto;
    column-gap: 1rem;
    padding: 1.4rem clamp(.5rem, 2.5cqi, 1.6rem);
    color: var(--plum-ink);
    text-decoration: none;
  }
  .project-link > * { grid-column: 2; }
  .project-num {
    grid-column: 1; grid-row: 1 / span 5;
    font-family: var(--f-serif);
    font-size: clamp(1.6rem, 4cqi, 2.2rem);
    line-height: 1;
    color: var(--plum);
  }
  .project-card .eyebrow { display: none; }
  .project-card h3 { margin: 0; font-size: clamp(1.2rem, 2.6cqi, 1.45rem); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
  .project-card .soon-pill { justify-self: start; margin-top: .45rem; }
  .project-sub { margin: .3rem 0 0; font-family: var(--f-serif); font-style: italic; font-size: 1.08rem; color: var(--muted); }
  .project-summary { margin: .5rem 0 0; max-width: 60ch; font-size: .98rem; line-height: 1.5; color: var(--text); }
  .is-soon h3 { color: var(--muted); }
  .project-link .text-link {
    grid-column: 3; grid-row: 1 / span 5; align-self: center;
    padding: 0; border: 0;
    font-size: 0;
  }
  .project-link .text-link .i-arrow { width: 1.3rem; height: .9rem; color: var(--plum); }
  .project-card:hover .text-link .i-arrow { transform: translateX(4px); }

  /* ---------- The book: a peach hardback, turned to show its spine ---------- */
  .book-feature { padding-block: clamp(2.8rem, 6cqi, 4rem); border-top: 1px solid var(--line); }
  .book-inner {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 4cqi, 3rem);
  }
  .book-art { order: -1; }
  .book-feature h2 {
    margin: 0;
    font-size: clamp(2.1rem, 5.4cqi, 3rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.05em;
    color: var(--plum-ink);
  }
  .book-subtitle { margin: .6rem 0 1.4rem; font-family: var(--f-serif); font-style: italic; font-size: clamp(1.2rem, 2.4cqi, 1.45rem); color: var(--plum); }
  .book-body p { margin: 0 0 1rem; max-width: 46ch; font-family: var(--f-serif); font-size: 1.15rem; line-height: 1.6; color: var(--text); }
  .book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 1.8rem; }

  .book-art {
    position: relative;
    display: grid; place-items: center;
    width: 100%; max-width: 440px;
    aspect-ratio: 425 / 480;
    margin: 0;
    border-radius: 18px;
    overflow: hidden;
    background: radial-gradient(90% 70% at 60% 35%, #FAE3D5 0%, rgba(250, 227, 213, 0) 70%), var(--peach);
  }
  /* A view-transition-name would flatten the 3D book, so the stage carries it in this style */
  .book-art, .project-hero-book { view-transition-name: book-cover; }
  .book { view-transition-name: none; }
  .book {
    position: relative;
    width: 54%;
    aspect-ratio: 1 / 1.4;
    margin: -6% 0 0 10%;
    container-type: inline-size;
    transform-style: preserve-3d;
    transform: perspective(1100px) rotateY(34deg) rotateX(3deg);
    transition: transform .9s cubic-bezier(.2, .7, .2, 1);
  }
  .book-art:hover .book, .project-hero-book:hover .book { transform: perspective(1100px) rotateY(18deg) rotateX(2deg); }
  .book-front, .book-spine { position: absolute; top: 0; height: 100%; backface-visibility: hidden; }
  .book-front {
    inset: 0;
    display: flex; flex-direction: column; align-items: center;
    padding: 9cqw 8cqw 8.5cqw;
    text-align: center;
    color: var(--plum-ink);
    border-radius: 2px 4px 4px 2px;
    background:
      linear-gradient(90deg, rgba(90, 40, 30, .22) 0, rgba(90, 40, 30, .04) 3%, rgba(255, 255, 255, .25) 4.5%, rgba(255, 255, 255, 0) 9%),
      linear-gradient(165deg, #F7D2B8 0%, #EFC0A2 55%, #E6B093 100%);
    box-shadow: inset 0 0 0 1px rgba(120, 60, 40, .12);
    transform: translateZ(8.5cqw);
  }
  .book-front::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px);
  }
  .cover-title, .cover-sub, .cover-author { margin: 0; }
  .cover-title { font-family: var(--f-serif); font-size: 17cqw; line-height: .92; letter-spacing: -.02em; text-wrap: balance; }
  .cover-sub { margin-top: 4.5cqw; font-family: var(--f-serif); font-size: 5.8cqw; line-height: 1.3; text-wrap: balance; }
  .cover-frame {
    position: relative;
    width: 62%; aspect-ratio: 1.33;
    margin-top: 7cqw;
    border: 1px solid rgba(54, 13, 48, .75);
  }
  .cover-frame i { position: absolute; display: block; }
  .cover-frame .sq1 { left: 13%; top: 30%; width: 42%; height: 58%; background: rgba(214, 140, 118, .5); }
  .cover-frame .sq2 { left: 40%; top: 9%; width: 46%; height: 62%; background: rgba(164, 102, 116, .38); }
  .cover-frame .dot { left: 48.5%; top: 43%; width: 8%; aspect-ratio: 1; border-radius: 50%; background: var(--plum-ink); transform: translate(-50%, -50%); }
  .cover-author { margin-top: auto; font-family: var(--f-serif); font-size: 7cqw; letter-spacing: .06em; text-transform: uppercase; }
  .book-spine {
    left: 0; width: 17cqw;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    padding: 6cqw 0;
    background: linear-gradient(90deg, #D9A084 0%, #E8B597 45%, #DFA88A 100%);
    color: var(--plum-ink);
    transform: rotateY(-90deg) translateZ(8.5cqw);
  }
  .book-spine span { flex: none; writing-mode: vertical-rl; font-family: var(--f-serif); white-space: nowrap; line-height: 1; }
  .spine-title { font-size: 7.4cqw; }
  .spine-dot { flex: none; width: 2.6cqw; height: 2.6cqw; border-radius: 50%; background: var(--plum-ink); }
  .spine-author { font-size: 4cqw; letter-spacing: .1em; text-transform: uppercase; }
  .book-ribbon {
    position: absolute; left: 9%; top: 97%;
    width: 5cqw; height: 13cqw;
    background: var(--plum);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
    transform: translateZ(6cqw) rotate(10deg);
    transform-origin: top center;
  }
  .book-shadow {
    position: absolute; left: 50%; top: 79%;
    width: 62%; height: 9%;
    transform: translateX(-42%);
    background: radial-gradient(closest-side, rgba(92, 45, 40, .38), transparent);
    filter: blur(6px);
  }
  .book-caption { position: absolute; right: 5%; bottom: 3.6%; margin: 0; font-size: .74rem; color: #6B5160; }

  /* ---------- Newsletter ---------- */
  .signup { border-top: 1px solid var(--line); }
  .signup-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 5cqi, 4rem);
    padding-block: clamp(3rem, 6cqi, 4rem);
  }
  .signup h2 { margin: 0 0 .8rem; font-size: clamp(2rem, 5cqi, 2.8rem); font-weight: 800; line-height: 1; letter-spacing: -.05em; color: var(--plum-ink); }
  .signup-blurb { margin: 0; max-width: 34ch; font-size: 1.1rem; line-height: 1.45; }
  .signup-form { position: relative; }
  .signup-row { display: flex; flex-wrap: wrap; gap: .75rem; }
  .signup-row input {
    flex: 1 1 14rem; min-width: 0; height: 52px;
    padding: 0 1rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, .55);
    font-size: 1rem;
    color: var(--plum-ink);
  }
  .signup-row input::placeholder { color: var(--muted); }
  .signup-row input:focus-visible { outline: none; border-color: var(--plum); box-shadow: 0 0 0 3px rgba(107, 35, 88, .15); }
  .signup-row input[aria-invalid="true"] { border-color: #A3324B; }
  .form-msg { min-height: 1.5em; margin: .8rem 0 0; font-size: .95rem; color: var(--plum); }
  .form-msg.is-error { color: #A3324B; }
  .signup-aside { margin: .2rem 0 0; font-size: 1.45rem; color: var(--plum); transform: rotate(-2deg); transform-origin: left; }
  .signup-aside svg { display: none; }

  /* ---------- Footer ---------- */
  .footer-inner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem 2rem;
    padding-block: 1.2rem calc(1.8rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(107, 35, 88, .5);
    font-size: .9rem;
    color: var(--plum-ink);
  }
  .footer-name { font-weight: 700; }
  .footer-nav { display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; }
  .footer-nav a { text-decoration: none; }
  .footer-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
  .site-footer small { font-size: .85rem; margin-right: 4.5rem; }

  /* ---------- Project pages ---------- */
  .project-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2rem;
    padding-block: .5rem clamp(2rem, 4cqi, 3rem);
  }
  .back-link {
    display: inline-flex; align-items: center; gap: .55rem;
    margin-bottom: 1.6rem;
    font-size: .95rem;
    font-weight: 500;
    color: var(--plum);
    text-decoration: none;
  }
  .back-link .i-arrow { transform: scaleX(-1); }
  .back-link:hover .i-arrow { transform: scaleX(-1) translateX(3px); }
  .project-page h1 {
    margin: 0;
    font-size: clamp(2.6rem, 7cqi, 4.4rem);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.05em;
    color: var(--plum-ink);
  }
  .project-hero .project-sub { margin-top: .9rem; font-size: clamp(1.25rem, 2.6cqi, 1.55rem); }
  .project-hero-art {
    display: grid; place-items: center;
    width: clamp(190px, 26cqi, 290px);
    aspect-ratio: 1;
    padding: 1.6rem;
    border-radius: 18px;
    background: radial-gradient(90% 70% at 60% 35%, #FAE3D5 0%, rgba(250, 227, 213, 0) 70%), var(--peach);
  }
  .project-hero-book { aspect-ratio: 425 / 480; padding: 0; overflow: hidden; }
  .project-hero-book .book { width: 50%; margin: -4% 0 0 8%; }
  .art { width: 100%; height: auto; overflow: visible; }
  .art-hand { font-family: var(--f-hand); font-size: 34px; }
  .knob { transition: transform 1s cubic-bezier(.3, 1.3, .4, 1); }
  .art-dot, .art-goal { transform-box: fill-box; transform-origin: center; }
  .art-trail { stroke-dasharray: 1; }

  .project-layout {
    display: grid;
    grid-template-columns: minmax(0, 44rem);
    padding-block: clamp(2rem, 4cqi, 3rem) clamp(3rem, 6cqi, 4rem);
    border-top: 1px solid var(--line);
  }
  .project-layout.has-toc { grid-template-columns: 12rem minmax(0, 44rem); column-gap: clamp(2rem, 5cqi, 4rem); }
  .toc { position: sticky; top: 100px; align-self: start; }
  .toc .eyebrow { margin-bottom: .7rem; }
  .toc ol { margin: 0; padding: 0; list-style: none; }
  .toc a {
    display: block;
    padding: .46rem .8rem;
    border-radius: 8px;
    font-size: .95rem;
    line-height: 1.3;
    color: var(--text);
    text-decoration: none;
  }
  .toc a:hover { background: var(--hover); color: var(--plum-ink); }
  .toc a.is-current { background: var(--active); color: var(--plum-ink); }

  .coming-soon {
    margin: 2rem 0 1rem;
    padding: 1.4rem 1.6rem;
    border: 1.5px dashed var(--line-strong);
    border-radius: 14px;
    background: var(--peach-soft);
  }
  .coming-soon .hand { margin: 0; font-size: 1.9rem; color: var(--plum); }

  .documents { margin-top: 3rem; }
  .doc-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-strong); }
  .doc-list li { margin: 0; padding: 0; }
  .doc-list li::before { display: none; }
  .doc-list a {
    display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; align-items: center; gap: 1rem;
    padding: .95rem .6rem;
    border-bottom: 1px solid var(--line-strong);
    font-family: var(--f-sans);
    color: var(--plum-ink);
    text-decoration: none;
    transition: background-color .2s ease;
  }
  .doc-list a:hover { background: rgba(246, 216, 199, .38); }
  .doc-kind { font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--plum); }
  .doc-title { font-size: 1.08rem; }
  .doc-list a:hover .i-arrow { transform: translateX(3px); }

  .project-pager { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0 clamp(3rem, 6cqi, 4rem); }
  .project-pager a {
    display: flex; flex: 0 1 22rem; flex-direction: column; gap: .3rem;
    padding: 1.1rem 1.3rem;
    border-radius: 14px;
    background: var(--peach-soft);
    color: var(--plum-ink);
    text-decoration: none;
    transition: background-color .2s ease;
  }
  .project-pager a:hover { background: var(--peach); }
  .project-pager .eyebrow { margin: 0; }
  .pager-next { align-items: flex-end; text-align: right; }
  .pager-title { font-size: clamp(1.15rem, 2.4cqi, 1.35rem); font-weight: 700; letter-spacing: -.02em; }

  /* ---------- Settings button + panel ---------- */
  .settings-btn {
    width: 3.5rem; height: 3.5rem; padding: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 14px;
    background: #FFF9F5;
    color: var(--plum-ink);
    box-shadow: 0 14px 30px -14px rgba(54, 13, 48, .4);
    transition: transform .3s cubic-bezier(.3, 1.5, .5, 1), background-color .3s ease;
  }
  .cog { width: 2.1rem; height: 2.1rem; overflow: visible; transition: transform .9s cubic-bezier(.3, 1.3, .4, 1); }
  .cog-wheel { transform-box: view-box; transform-origin: 20px 20px; }
  .settings-btn:hover { transform: translateY(-2px); }
  .settings-btn:hover .cog { transform: rotate(60deg); }
  .settings-btn[aria-expanded="true"] { background: var(--active); }
  .settings-btn[aria-expanded="true"] .cog { transform: rotate(135deg); }
  .settings-hint { margin-right: .2rem; font-size: 1.4rem; color: var(--plum); transform: rotate(-6deg); }
  .settings-hint svg { display: inline-block; width: 1.2em; height: 1em; margin-left: .15em; vertical-align: -.7em; transform: scaleX(-1) rotate(-25deg); }

  .settings-panel {
    padding: 1.2rem 1.1rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #FFF9F5;
    color: var(--text);
    box-shadow: 0 18px 36px -16px rgba(54, 13, 48, .4);
  }
  .settings-panel .eyebrow { margin: 0 0 .9rem .2rem; }
  .settings-panel legend { margin-bottom: .45rem; padding-left: .2rem; font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .style-option { gap: .8rem; padding: .6rem .7rem; border-radius: 10px; transition: background-color .2s ease; }
  .style-option:not(.is-soon):hover { background: var(--hover); }
  .style-option:has(input:checked) { background: var(--active); }
  .style-option:has(input:focus-visible) { outline: 2.5px solid var(--gold); outline-offset: 1px; }
  .style-option.is-soon { opacity: .55; }
  .swatches i { width: .95rem; height: .95rem; border: 1px solid rgba(54, 13, 48, .2); }
  .swatches i + i { margin-left: -.3rem; }
  .style-name { font-size: 1rem; font-weight: 500; color: var(--plum-ink); }
  .soon {
    margin-left: auto;
    padding: .15rem .5rem;
    border-radius: 999px;
    background: var(--peach);
    font-family: var(--f-sans);
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    line-height: 1.4;
    color: var(--plum);
  }
  .size-picker { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
  .size-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .size-options button {
    height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: none;
    font-family: var(--f-serif);
    color: var(--plum-ink);
  }
  .size-options button:hover { background: var(--hover); }
  .size-options button[aria-pressed="true"] { background: var(--plum); border-color: var(--plum); color: #FFF7F2; }

  /* ---------- Search ---------- */
  .search-dialog {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #FFF9F5;
    color: var(--text);
    box-shadow: 0 30px 60px -30px rgba(54, 13, 48, .55);
  }
  .search-dialog::backdrop { background: rgba(54, 13, 48, .3); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .search-head { padding: .75rem .75rem .75rem 1.2rem; border-bottom: 1px solid var(--line); }
  .search-icon { width: 1.3rem; height: 1.3rem; flex: none; color: var(--plum-ink); }
  .search-head input { padding: .35rem 0; font-size: 1.2rem; color: var(--plum-ink); }
  .search-head input::placeholder { color: var(--muted); }
  .search-results { padding: .4rem; }
  .search-results a { padding: .8rem .9rem; border-radius: 10px; transition: background-color .15s ease; }
  .search-results a:hover, .search-results a:focus-visible { background: var(--hover); }
  .result-where { display: block; margin-bottom: .2rem; font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .result-title { display: block; font-size: 1.1rem; font-weight: 700; letter-spacing: -.015em; color: var(--plum-ink); }
  .result-snippet { display: block; margin-top: .25rem; font-family: var(--f-serif); font-size: 1rem; line-height: 1.45; }
  .search-results mark { padding: 0 .1em; border-radius: 3px; background: rgba(199, 154, 67, .3); color: inherit; }
  .search-empty { padding: .9rem .9rem 1.1rem; font-size: .98rem; color: var(--muted); }

  /* ---------- Responsive: main column ---------- */
  @container main (max-width: 900px) {
    .project-layout.has-toc { grid-template-columns: minmax(0, 44rem); }
    .toc { position: static; margin-bottom: 2rem; }
  }
  @container main (max-width: 820px) {
    .hero-inner { grid-template-columns: minmax(0, 1fr); }
    .hero-art { order: -1; max-width: 400px; justify-self: start; }
    .book-inner { grid-template-columns: minmax(0, 1fr); }
    .book-art { max-width: 400px; }
    .signup-inner { grid-template-columns: minmax(0, 1fr); }
  }
  @container main (max-width: 720px) {
    .band-inner { grid-template-columns: minmax(0, 1fr); }
    .band-rule { height: 1px; }
    .project-hero-inner { grid-template-columns: minmax(0, 1fr); }
    .project-hero-art { width: 160px; padding: 1rem; }
    .project-hero-book { width: 220px; padding: 0; }
  }
  @container main (max-width: 600px) {
    .nav { display: none; }
    .brand-mark { width: 46px; height: 32px; }
    .hero-actions .btn-solid { flex: 1 1 100%; justify-content: center; }
    .project-link { grid-template-columns: 2.6rem minmax(0, 1fr) auto; column-gap: .6rem; padding-inline: .25rem; }
    .project-pager { flex-direction: column; }
    .project-pager a { flex-basis: auto; }
    .doc-list a { grid-template-columns: minmax(0, 1fr) auto; row-gap: .2rem; }
    .doc-kind { grid-column: 1 / -1; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
  }
  @container main (max-width: 400px) {
    .contents-btn span { display: none; }
    .contents-btn { padding: 0 .55rem; }
    .brand-name { font-size: 1.3rem; }
  }

  /* ---------- Responsive: the sidebar becomes a drawer ---------- */
  @media (max-width: 1099px) {
    .shell { display: block; }
    .contents-nav {
      position: fixed; z-index: 70; left: 0; top: 0; bottom: 0;
      width: min(300px, 86vw); height: auto;
      visibility: hidden;
      transform: translateX(-102%);
      transition: transform .3s ease, visibility .3s;
      box-shadow: 18px 0 40px -20px rgba(54, 13, 48, .45);
    }
    .contents-inner { width: 100%; }
    &.contents-open .contents-nav { visibility: visible; transform: none; }
    .contents-scrim {
      display: block;
      position: fixed; inset: 0; z-index: 65;
      background: rgba(54, 13, 48, .32);
      opacity: 0;
      pointer-events: none;
      transition: opacity .3s ease;
    }
    &.contents-open .contents-scrim { opacity: 1; pointer-events: auto; }
    &.contents-open body { overflow: hidden; }
    .contents-btn { display: inline-flex; }
  }
  @media (min-width: 1100px) {
    .contents-close { display: inline-flex; }
    &.contents-collapsed .contents-btn { display: inline-flex; }
  }

  /* ---------- Motion ---------- */
  @media (prefers-reduced-motion: no-preference) {
    /* Home hero: the framed photo drops onto the page, gets clipped, and the headline is underlined */
    .hero-copy > * { animation: s2-rise .8s cubic-bezier(.2, .7, .2, 1) both; }
    .hero-copy > :nth-child(2) { animation-delay: .07s; }
    .hero-copy > :nth-child(3) { animation-delay: .14s; }
    .hero-copy > :nth-child(4) { animation-delay: .21s; }
    .hero-art { animation: s2-fade 1s ease both; }
    .hero-art img { animation: s2-drop 1.1s cubic-bezier(.2, .8, .25, 1) .2s both; }
    .paperclip { animation: s2-clip .6s cubic-bezier(.3, 1.5, .5, 1) 1.1s both; }
    .hl-line { animation: s2-write 1s cubic-bezier(.6, .1, .2, 1) .6s both; }
    .hand-note span { animation: s2-write 1s steps(14) 1.6s both; }
    .hand-note svg { stroke-dasharray: 1; animation: s2-draw .5s ease-out 2.5s both; }

    /* The book swings round to face you as it scrolls into view */
    .book-art.is-visible .book { animation: s2-swing 1.3s cubic-bezier(.2, .7, .2, 1) .15s backwards; }

    .project-hero-copy > * { animation: s2-rise .7s cubic-bezier(.2, .7, .2, 1) both; }
    .project-hero-copy > :nth-child(3) { animation: none; }
    .project-hero-art { animation: s2-fade .9s ease .1s both; }
    .project-hero-art .knob { animation: s2-turn 1.6s cubic-bezier(.3, 1.3, .4, 1) .3s both; }
    .project-hero-art .art-trail { animation: s2-draw 1.4s ease-in-out .4s both; }
    .art-dot { animation: s2-bounce 1.4s ease-in-out infinite; }
    .art-dot:nth-child(2) { animation-delay: .18s; }
    .art-dot:nth-child(3) { animation-delay: .36s; }

    .cog-wheel { animation: s2-tick 9s ease-in-out 3s infinite; }
    .settings-btn.is-hopping .cog-wheel { animation: s2-spin .9s cubic-bezier(.3, 1.2, .4, 1); }
    .settings-hint:not([hidden]) { animation: s2-write .9s steps(12) both; }
    .settings-hint.is-leaving { opacity: 0; transition: opacity .6s ease; }

    .settings-panel {
      transition: opacity .25s ease, transform .3s cubic-bezier(.2, .7, .2, 1), display .3s allow-discrete, overlay .3s allow-discrete;
    }
    .settings-panel:not(:popover-open) { opacity: 0; transform: translateY(10px) scale(.98); }
    @starting-style { .settings-panel:popover-open { opacity: 0; transform: translateY(10px) scale(.98); } }
    .search-dialog[open] { animation: s2-rise .3s cubic-bezier(.2, .7, .2, 1); }
  }
  @media (prefers-reduced-motion: reduce) {
    .shell, .contents-nav, .contents-scrim, .chapters-wrap { transition: none; }
  }
}

@keyframes s2-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes s2-fade { from { opacity: 0; } }
@keyframes s2-swing { from { transform: perspective(1100px) rotateY(75deg) rotateX(3deg); } }
@keyframes s2-drop { from { opacity: 0; transform: translateY(-26px) rotate(4deg); } }
@keyframes s2-clip { from { opacity: 0; transform: translateY(-18px) rotate(16deg); } }
@keyframes s2-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes s2-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes s2-turn { from { transform: rotate(var(--turn)); } }
@keyframes s2-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes s2-tick { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(14deg); } 96% { transform: rotate(-4deg); } }
@keyframes s2-spin { to { transform: rotate(360deg); } }
