/* The search surface. Reading and book details retain their existing layout. */
:root {
  --paper: #fff;
  --ink: #1b1b1b;
  --muted: #707070;
  --line: #e7e7e7;
  --accent: #222;
  background: var(--paper);
}

body { min-height: 100dvh; }

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 5;
  padding: 12px 16px;
  border: 1px solid var(--ink);
  background: white;
  transform: translateY(-180%);
}
.skip-link:focus { transform: none; }

.site-header {
  display: flex;
  justify-content: center;
  max-width: none;
  padding: 76px 24px 0;
  border: 0;
}
.wordmark {
  font: 400 clamp(36px, 4.2vw, 54px)/1.15 var(--serif);
  letter-spacing: -2.2px;
  color: #181818;
}
main { max-width: 1280px; padding: 0 48px; }
.search-area { max-width: 640px; margin: 29px auto 42px; }
.search-intro { text-align: center; margin: 0 0 23px; }
.search-intro h1 { max-width: none; margin: 0 0 7px; font: 400 24px/1.3 var(--serif); letter-spacing: -.5px; }
.search-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.search-guide { text-align: center; margin: 15px auto 0; font-size: 12px; color: #666; }
.search-guide summary { cursor: pointer; display: inline-block; padding: 7px 10px; text-decoration: underline; text-underline-offset: 3px; }
.search-guide summary:focus-visible { outline: 2px solid #222; outline-offset: 3px; }
.search-guide-copy { text-align: left; padding: 6px 20px 12px; margin-top: 8px; border: 1px solid #e7e7e4; border-radius: 14px; background: #fafaf8; line-height: 1.7; }
.search-guide-copy strong { color: #30302c; font-weight: 500; }
.preview-guide { display: flex; align-items: center; justify-content: center; gap: 6px; margin: -27px 0 27px; font-size: 12px; color: #707070; }
.preview-guide-mark { display: inline-grid; place-items: center; border: 1px solid #ddd; border-radius: 50%; width: 21px; height: 21px; font: 500 17px/1 var(--serif); color: #222; }
#browse-instead { display: block; margin: 15px auto 0; color: #666; border: 0; text-decoration: underline; text-underline-offset: 4px; }
#search-form { position: relative; z-index: 4; }
.search-autocomplete {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 7px;
  list-style: none;
  border: 1px solid #dedede;
  border-radius: 18px;
  background: white;
  box-shadow: 0 12px 32px #00000012;
}
.search-autocomplete [role="option"] {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  min-height: 48px;
  border-radius: 11px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.search-autocomplete [role="option"]:hover,
.search-autocomplete [aria-selected="true"] { background: #f1f1ef; }
.autocomplete-label { font-size: 14px; line-height: 1.35; color: #252525; }
.autocomplete-detail { font-size: 11px; line-height: 1.35; color: #737373; }
.search-autocomplete [data-type="query"] .autocomplete-label { font-style: normal; }
.example-searches { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 15px; }
.example-pill {
  min-height: 35px;
  padding: 7px 12px;
  border: 1px solid #e8e8e5;
  border-radius: 22px;
  background: #fafaf8;
  color: #64645d;
  font-size: 12px;
}
.example-pill:hover { background: #f1f1ee; border-color: #cececa; }
.availability-filter { display: flex; justify-content: center; margin-top: 12px; }
.availability-filter .pill { min-height: 32px; font-size: 11px; }
.availability-filter .pill[aria-pressed="true"]::before { content: '✓'; }
.collection { position: relative; }
.search-progress {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: -32px auto 20px;
  color: #707070;
  font-size: 12px;
  pointer-events: none;
}
.collection:has(.book-grid:empty) { min-height: 180px; }
.progress-dot { width: 5px; height: 5px; border-radius: 50%; background: #999; animation: progress-breathe 1.3s ease-in-out infinite alternate; }
.book-open { display: flex; flex-direction: column; align-items: stretch; width: 100%; padding: 0; text-align: left; }
.book-card:focus-visible { outline: 2px solid #222; outline-offset: 5px; }
.match-details-open { align-self: flex-start; padding: 6px 0; min-height: 28px; font-size: 10px; line-height: 1.4; color: #707070; text-decoration: underline; text-underline-offset: 3px; }
.match-details-open:hover { color: #222; }
.search-field {
  position: relative;
  min-height: 58px;
  gap: 15px;
  padding: 6px 8px 6px 21px;
  border: 1px solid #dcdcdc;
  border-radius: 32px;
  background: #fff;
  box-shadow: 0 2px 6px #00000004;
}
.search-field:hover { border-color: #c8c8c8; }
.search-field:focus-within {
  border-color: #b6b6b6;
  box-shadow: 0 2px 10px #0000000a;
}
.search-field > svg { color: #888; width: 21px; height: 21px; }
#book-query { padding: 10px 0; font-size: 16px; line-height: 1.5; }
#book-query::placeholder { color: #707070; }
.search-clear {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 40px;
  padding: 0;
  font-size: 22px;
  color: #707070;
}
.search-submit {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f4f4f4;
  color: #333;
}
.search-submit:hover { background: #eaeaea; }
.search-area:has(#search-state.busy) .search-submit {
  background: #ededed;
}
.search-area:has(#search-state.busy) .search-submit::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-top-color: #707070;
  border-radius: 50%;
  animation: search-turn .9s linear infinite;
}
.search-area:has(#search-state.busy) .search-submit svg { opacity: .4; }
.search-bottom.sr-only,
.collection-heading.sr-only,
.match-summary.sr-only { margin: 0; padding: 0; border: 0; }
.refinement-area { gap: 8px; margin-top: 14px; }
.pill-row { justify-content: center; gap: 7px; }
.suggestion-line { display: block; }
.pill {
  min-height: 34px;
  padding: 7px 12px;
  border-color: #e6e6e6;
  background: #fff;
  color: #636363;
  font-size: 12px;
}
.pill.active { border-color: #e2e2e2; background: #f5f5f5; color: #333; }
.pill:hover { border-color: #bdbdbd; background: #f3f3f3; }
.pill-count { color: #707070; }
.service-notice {
  margin: 16px 8px 0;
  padding: 0;
  border: 0;
  color: #666;
  text-align: center;
  font-size: 12px;
}

.book-grid {
  grid-template-columns: repeat(auto-fit, minmax(0, calc((100% - 160px) / 6)));
  justify-content: center;
  gap: 40px 32px;
  align-items: start;
}
.book-card { border-radius: 2px; animation-name: cover-enter; }
.book-card .cover-stage { margin: 0; transition: none; }
.cover-stage img {
  border-radius: 1px;
  box-shadow: 1px 2px 4px #00000014, 3px 5px 12px #00000008;
  transition: opacity .48s;
}
.cover-stage > img { width: var(--cover-width, 100%); height: auto; }
.book-card:hover .cover-stage { transform: none; }
.book-card:hover .cover-stage img {
  box-shadow: 1px 2px 4px #00000014, 3px 5px 12px #00000008;
}
.cover-stage::after { display: none; }
.cover-fallback {
  flex-direction: column;
  background: #f0efec;
  color: #52514d;
  border-color: #e3e2df;
  font-size: clamp(15px, 1.65vw, 23px);
  padding: 16px;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.cover-stage:has(img:not(.loaded):not(.failed)) .cover-fallback {
  background: #f3f3f1;
  animation: none;
}
.book-title,
.book-author,
.book-tag,
.book-availability,
.book-match:not(.possible) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.book-match.possible {
  margin-top: 8px;
  color: #707070;
  font-size: 10px;
  line-height: 1.4;
}
.book-match.possible::before { content: none; }
.preview-badge {
  position: absolute;
  z-index: 2;
  bottom: 7px;
  right: calc(var(--cover-inset, 0%) + 7px);
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #0000000d;
  border-radius: 50%;
  background: #fffffff5;
  color: #222;
  box-shadow: 0 1px 4px #0000001a;
  font: 500 19px/1 var(--serif);
  pointer-events: none;
}
.preview-badge svg { display: block; width: 16px; height: 16px; }
.preview-badge img {
  position: static;
  transform: none;
  display: block;
  width: 16px;
  height: 16px;
  opacity: 1;
  box-shadow: none;
  border-radius: 0;
}
.load-more {
  margin: 44px auto 0;
  border-color: #dedede;
  border-radius: 24px;
  padding: 12px 22px;
  font-size: 13px;
}
.load-more:hover { background: #f5f5f5; }
.load-more span { margin-left: 12px; }
.empty-state, .load-error { padding: 28px 12px 48px; }
.empty-state h3, .load-error h3 {
  font: 400 18px/1.45 var(--ui);
  letter-spacing: -.3px;
}
.empty-state p, .load-error p { line-height: 1.6; }
.site-footer {
  justify-content: center;
  margin: 72px auto 0;
  padding: 24px 24px 32px;
  border: 0;
  font-size: 12px;
}
.site-footer nav { display: flex; gap: 26px; }
.site-footer a { padding: 10px 0; text-underline-offset: 4px; }
.site-footer a:hover { text-decoration: underline; }
.match-details { background: #f8f8f6; border-color: #e4e4e0; }
@keyframes cover-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes search-turn { to { transform: rotate(360deg); } }
@keyframes progress-breathe { to { opacity: .3; } }

@media (max-width: 1000px) {
  main { padding-inline: 32px; }
  .book-grid { grid-template-columns: repeat(auto-fit, minmax(0, calc((100% - 84px) / 4))); gap: 34px 28px; }
}
@media (max-width: 600px) {
  .site-header { padding: 43px 20px 0; }
  .wordmark { font-size: 38px; letter-spacing: -1.7px; }
  .search-intro { margin-bottom: 19px; }
  .search-intro h1 { font-size: 21px; }
  .search-intro p { font-size: 12px; }
  .preview-guide { margin-top: -14px; margin-bottom: 23px; font-size: 11px; }
  main { padding-inline: 20px; }
  .search-area { margin: 23px auto 40px; }
  .search-field { min-height: 54px; gap: 11px; padding: 5px 6px 5px 16px; }
  .search-field > svg { width: 19px; height: 19px; }
  #book-query { padding: 9px 0; }
  .search-submit { width: 40px; height: 40px; }
  .search-clear { width: 26px; }
  .search-autocomplete [role="option"] { padding: 9px 12px; min-height: 47px; }
  .example-searches { gap: 6px; margin-top: 12px; }
  .example-pill { font-size: 11px; padding-inline: 10px; }
  .search-progress { margin-top: -18px; font-size: 11px; }
  .book-grid { grid-template-columns: repeat(auto-fit, minmax(0, calc((100% - 36px) / 3))); gap: 27px 18px; }
  .cover-fallback { font-size: 16px; padding: 10px; }
  .preview-badge { width: 23px; height: 23px; bottom: 5px; right: calc(var(--cover-inset, 0%) + 5px); font-size: 17px; }
  .book-match.possible { font-size: 10px; }
  .site-footer { margin-top: 44px; padding-bottom: 25px; }
  .site-footer nav { gap: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-card, .cover-stage img, .search-submit::after, .progress-dot { animation: none; transition: none; }
}

.site-header { flex-direction:column; align-items:center; gap:19px; }
.browse-surface-nav { display:flex; gap:22px; color:#7a7770; font-size:12px; }
.browse-surface-nav a { text-decoration:none; padding:5px 0; }
.browse-surface-nav [aria-current] { color:#2b2925; border-bottom:1px solid #2b2925; padding:5px 0; }
.reading-paths { display:flex; flex-wrap:wrap; gap:7px; justify-content:center; margin-top:21px; }
.reading-paths[hidden], .reading-path-note[hidden] { display:none; }
.reading-path-pill { border:1px solid #e0ddd6; border-radius:24px; background:white; color:#746f65; padding:9px 15px; min-height:38px; font:12px/1.2 var(--ui); }
.reading-path-pill[aria-pressed="true"] { background:#f0eee8; color:#28251f; border-color:#c7c2b7; }
.reading-path-pill:focus-visible { outline:2px solid #222; outline-offset:3px; }
.reading-path-note { text-align:center; color:#827c70; font-size:12px; line-height:1.5; margin:9px 0 0; }
.search-controls { display:flex; align-items:flex-start; justify-content:center; gap:12px; margin-top:12px; }
.search-controls .availability-filter, .search-controls .refinement-area { margin-top:0; }
#active-filters:empty { display:none; }
.refinement-menu summary { cursor:pointer; list-style:none; color:#707070; font-size:12px; padding:8px 5px; min-height:32px; }
.refinement-menu summary::-webkit-details-marker { display:none; }
.refinement-menu summary::after { content:' +'; }
.refinement-menu[open] summary::after { content:' −'; }
.refinement-menu[open] { max-width:350px; }
.refinement-menu .suggestion-line { padding:8px 0; }
@media(max-width:600px) { .reading-paths { margin-top:15px; gap:5px; } .reading-path-pill { padding:8px 9px; min-height:34px; font-size:11px; } }
.book-match-reason { color:#655f55; font:14px/1.6 var(--serif); }
.cover-stage:has(img.failed) .cover-fallback::after { content:'Cover unavailable'; display:block; font:10px/1.4 var(--ui); margin-top:12px; color:#928f87; }
@media(max-width:600px) { .site-header { gap:14px; } .browse-surface-nav { font-size:11px; } .reading-path-pill { padding:8px 9px; font-size:11px; } }

/* The approved search-first hero. The existing reading and details surfaces
   continue to use their original typography and controls. */
@font-face { font-family: Bricolage; src: url('/fonts/bricolage-variable-latin.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: Playfair; src: url('/fonts/playfair-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
:root { --paper:#eef0f2; --ink:#121319; --muted:#4c515a; --line:#16171b29; --accent:#121319; }
.site-header { max-width:1280px; flex-direction:row; justify-content:space-between; align-items:center; padding:24px 44px 0; gap:15px; }
.wordmark { font:600 23px/1.2 Playfair,Georgia,serif; letter-spacing:.005em; white-space:nowrap; }
.browse-surface-nav { font-size:13px; gap:24px; color:var(--muted); }
.browse-surface-nav a { min-height:44px; display:flex; align-items:center; }
main { max-width:948px; padding-inline:44px; }
.search-area { max-width:760px; margin:39px auto 28px; }
.search-intro { margin-bottom:28px; }
.search-intro h1 { max-width:700px; margin:0 auto; font:800 64px/.96 Bricolage,system-ui,sans-serif; letter-spacing:-.035em; text-wrap:balance; font-style:normal; }
.search-intro p { max-width:650px; margin:22px auto 0; font:400 18px/1.5 Spectral,Georgia,serif; color:var(--muted); text-wrap:pretty; }
#search-form { max-width:720px; margin:auto; }
.search-label { display:block; margin:0 0 10px; text-align:center; font:500 13.5px/1.4 Bricolage,system-ui,sans-serif; }
.search-field { min-height:70px; padding:12px 10px 12px 17px; gap:12px; border-radius:24px; border-color:var(--line); box-shadow:none; }
.search-field:focus-within { border-color:var(--ink); box-shadow:0 0 0 4px #16171b0b; }
.search-field>svg { width:18px; height:18px; color:var(--muted); }
#book-query { display:block; resize:none; min-height:25px; max-height:163px; padding:1px 0; overflow-y:hidden; font:400 16px/1.45 Bricolage,system-ui,sans-serif; }
#book-query::placeholder { color:var(--muted); opacity:1; }
.search-clear { width:28px; height:44px; }
.search-submit { position:relative; width:44px; height:44px; background:var(--ink); color:white; }
.search-submit:hover { background:#34383e; }
.search-area:has(#search-state.busy) .search-submit { background:#34383e; }
.search-area:has(#search-state.busy) .search-submit::after { border-top-color:white; }
.example-searches { margin-top:18px; gap:8px; }
.example-label { flex-basis:100%; margin-bottom:2px; text-align:center; color:var(--muted); font:400 12px/1.5 Bricolage,system-ui,sans-serif; }
.example-pill { max-width:100%; min-height:40px; padding:9px 15px; border:1px solid var(--line); background:#ffffff9e; color:var(--ink); font:500 13px/1.35 Bricolage,system-ui,sans-serif; text-align:left; transition:background .18s,color .18s,border-color .18s; }
.example-pill:hover { background:var(--ink); color:var(--paper); border-color:var(--ink); }
.query-hint { margin:15px 2px 0; color:var(--muted); text-align:center; font:400 12px/1.5 Bricolage,system-ui,sans-serif; }
.search-guide { margin-top:8px; }
.search-guide summary { font-size:11px; color:var(--muted); }
.search-area:has(#search-clear[hidden]) .search-guide { display:none; }
.search-area:has(#search-clear[hidden]) .search-controls { display:none; }
.preview-guide { margin:0 0 18px; justify-content:flex-start; color:var(--muted); font:400 12px/1.5 Bricolage,system-ui,sans-serif; }
.preview-guide-mark { background:white; border-color:var(--line); font-family:Playfair,Georgia,serif; }
.book-grid { grid-template-columns:repeat(6,minmax(0,1fr)); gap:30px 22px; }
.book-grid[data-count="3"] { grid-template-columns:repeat(3,minmax(0,1fr)); max-width:420px; margin-inline:auto; }
.book-card { animation-duration:.45s; }
.cover-stage img { box-shadow:2px 7px 16px #14161e26; }
.book-card:hover .cover-stage img { box-shadow:2px 9px 20px #14161e30; }
.book-open:focus-visible { outline:2px solid var(--ink); outline-offset:5px; }
.site-footer { justify-content:space-between; max-width:948px; padding-inline:44px; gap:16px; font:400 12px/1.5 Bricolage,system-ui,sans-serif; }
.site-footer nav { gap:22px; }
.site-footer>span { padding:10px 0; }
@keyframes cover-enter { from { opacity:0; transform:translateY(18px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@media(max-width:760px) {
  .site-header { padding:18px 22px 0; }
  .wordmark { font-size:22px; }
  .browse-surface-nav { font-size:12px; gap:14px; }
  .browse-surface-nav a[href="/about"] { display:none; }
  main { padding-inline:22px; }
  .search-area { margin:42px auto 27px; }
  .search-intro { margin-bottom:28px; }
  .search-intro h1 { font-size:clamp(36px,10.4vw,48px); line-height:.98; text-align:left; margin:0; }
  .search-intro p { font-size:16px; margin:18px 0 0; text-align:left; }
  .search-label,.example-label,.query-hint { text-align:left; }
  .search-field { padding:12px 10px 12px 13px; gap:8px; }
  #book-query { min-height:67px; padding:1px 0; }
  .search-clear { width:22px; }
  .example-searches { justify-content:flex-start; margin-top:17px; }
  .example-pill { min-height:44px; padding:10px 14px; }
  .book-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px 14px; }
  .book-grid[data-count="3"] { max-width:400px; }
  .preview-guide { font-size:11px; margin-bottom:17px; }
  .site-footer { padding-inline:22px; flex-wrap:wrap; font-size:11px; }
  .site-footer nav { gap:20px; }
}
@media(max-width:375px) {
  main,.site-footer { padding-inline:17px; }
  .site-header { padding-inline:17px; }
  .wordmark { font-size:21px; }
  .example-pill { font-size:12.5px; }
  .book-grid { column-gap:12px; }
}
@media(prefers-reduced-motion:reduce) {
  .example-pill,.search-field { transition:none; }
  .book-card { animation:none; }
}
