:root {
  color-scheme: light;
  --paper: #f4eddd;
  --paper-light: #fbf6e9;
  --ink: #302b25;
  --muted: #806c54;
  --line: #d9c9a8;
  --blue: #2d61a5;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--ink);
  background: radial-gradient(ellipse at center, rgba(255,255,255,.55), transparent 65%), var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
}

main { width: min(900px, calc(100% - 40px)); min-height: 100vh; margin: 0 auto; padding: clamp(70px, 12vh, 150px) 0 56px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.page-header { width: 100%; min-width: 0; }
h1 { width: 100%; margin: 0; font-family: "Libre Caslon Text", Georgia, serif; font-size: clamp(2.8rem, 6vw, 5.2rem); font-weight: 400; line-height: 1; letter-spacing: -.045em; overflow-wrap: break-word; }
.ornament { display: flex; align-items: center; gap: 12px; width: min(760px, 88%); margin: clamp(36px, 5vh, 56px) auto 0; color: var(--line); }
.ornament::before, .ornament::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.ornament span { width: 12px; height: 12px; border: 2px solid var(--line); border-radius: 50%; transform: rotate(45deg); position: relative; }
.ornament span::after { content: ""; position: absolute; width: 9px; height: 9px; border: 1px solid var(--line); border-radius: 50%; top: -6px; left: 7px; }
.verse-stage { width: 100%; padding: clamp(62px, 9vh, 110px) 0 42px; display: flex; flex-direction: column; align-items: center; }
blockquote { width: 100%; max-width: 760px; min-width: 0; margin: 0; font-family: "Libre Caslon Text", Georgia, serif; font-size: clamp(2rem, 4.3vw, 4rem); line-height: 1.2; letter-spacing: -.03em; text-wrap: wrap; overflow-wrap: break-word; }
.reference { margin: 34px 0 0; color: var(--muted); font-size: .88rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-style: normal; }
.actions { display: flex; justify-content: center; align-items: center; gap: 18px; }
button { border: 0; font: inherit; cursor: pointer; transition: transform .12s ease, filter .12s ease; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid #152f5a; outline-offset: 4px; }
.primary, .secondary { min-height: 56px; border-radius: 7px; }
.primary { min-width: 300px; padding: 14px 28px; color: #fffdf4; background: linear-gradient(#3974bd, var(--blue)); border: 2px solid #1f4e8b; border-top-color: #83b0e5; border-left-color: #6699d3; box-shadow: inset 0 0 0 1px rgba(13, 47, 94, .38), 3px 4px 0 #183f73, 0 6px 10px rgba(64, 45, 22, .14); font-family: Georgia, serif; font-size: 1.18rem; }
.primary:hover { filter: brightness(1.08); }
.primary:active { box-shadow: inset 0 2px 4px rgba(10, 35, 74, .5), 1px 1px 0 #183f73; transform: translate(2px, 3px); }
.primary[aria-busy="true"] { opacity: .72; cursor: wait; }
.secondary { padding: 12px 24px; color: var(--ink); background: rgba(255, 250, 237, .38); border: 2px solid #c6b898; box-shadow: inset 0 0 0 1px rgba(255,255,255,.5); font-family: Georgia, serif; font-size: 1rem; }
.secondary:hover:not(:disabled) { background: var(--paper-light); border-color: var(--muted); }
.secondary:disabled { opacity: .35; cursor: default; }
.translation { margin: 34px 0 0; color: #665b4c; font-family: Georgia, serif; font-size: .95rem; }
.recommendations { width: min(1000px, calc(100vw - 40px)); max-width: none; min-width: 0; align-self: center; margin-top: clamp(76px, 11vh, 120px); padding-top: 34px; border-top: 1px solid var(--line); overflow: hidden; }
.recommendations-heading h2 { margin: 0; font-family: "Libre Caslon Text", Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 400; letter-spacing: -.035em; }
.recommendations-heading .affiliate-disclosure { margin-top: 12px; }
.recommendation-label { color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.recommendation-grid, .bookshelf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 32px; text-align: left; }
.recommendation-grid { grid-template-columns: repeat(3, 320px); justify-content: center; align-items: start; gap: 8px; }
.widget-slot { width: 320px; min-width: 0; min-height: 268px; overflow: hidden; }
.widget-slot > div { width: 320px !important; }
.recommendation-card { display: flex; min-width: 0; flex-direction: column; padding: 22px 20px 20px; color: inherit; background: rgba(255, 250, 237, .34); border: 1px solid var(--line); text-decoration: none; transition: background .12s ease, border-color .12s ease, transform .12s ease; }
.recommendation-card:hover { background: var(--paper-light); border-color: var(--muted); transform: translateY(-2px); }
.recommendation-card:focus-visible, .bookshelf-link:focus-visible, .back-link:focus-visible { outline: 3px solid #152f5a; outline-offset: 4px; }
.recommendation-label { margin-bottom: 16px; }
.recommendation-title { font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.35; }
.recommendation-note { margin-top: 18px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.recommendation-detail { margin-top: 12px; color: #665b4c; font-size: .76rem; line-height: 1.4; }
.bookshelf-link { display: inline-block; margin-top: 28px; color: var(--ink); font-family: Georgia, serif; font-size: 1rem; text-underline-offset: 4px; }
.bookshelf-link span { margin-left: 5px; }
.affiliate-disclosure { margin: 25px auto 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.support-message { margin: 16px auto 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.site-footer { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 0 0 32px; color: var(--muted); font-size: .78rem; letter-spacing: .02em; text-align: center; }
.site-footer a { color: inherit; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--ink); }

.legal-page { align-items: stretch; text-align: left; }
.legal-header { width: 100%; max-width: 720px; margin: 0 auto; }
.back-link { color: var(--muted); font-size: .82rem; text-underline-offset: 3px; }
.back-link:hover { color: var(--ink); }
.legal-header h1 { margin-top: 34px; font-size: clamp(2.5rem, 6vw, 4.5rem); text-align: center; }
.legal-content { width: 100%; max-width: 720px; margin: 58px auto 0; font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.65; }
.legal-content h2 { margin: 2.2em 0 .5em; color: var(--muted); font-family: "DM Sans", system-ui, sans-serif; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; }
.legal-content h2:first-child { margin-top: 0; }
.legal-content p { margin: 0 0 1.1em; }
.legal-content ul { margin: 0 0 1.1em; padding-left: 1.25em; }
.legal-content li { margin: .35em 0; }
.legal-page .site-footer { margin-top: auto; padding-top: 56px; }
.bookshelf-intro { max-width: 520px; margin: 34px auto 0; color: var(--muted); font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.5; }
.bookshelf-page { min-height: auto; min-width: 0; }
.bookshelf-header .affiliate-disclosure { max-width: 560px; margin: 12px auto 0; }
.bookshelf-grid { width: min(648px, calc(100vw - 40px)); max-width: none; min-width: 0; grid-template-columns: repeat(2, 320px); justify-content: center; gap: 28px 8px; margin: 56px auto 0; }
.pocket-note { max-width: 320px; margin: 10px auto 0; color: var(--muted); font-size: .75rem; line-height: 1.45; text-align: center; }

@media (max-width: 640px) {
  main { width: min(900px, calc(100% - 28px)); padding-top: 64px; padding-bottom: 42px; }
  h1 { max-width: 330px; margin-right: auto; margin-left: auto; font-size: clamp(2rem, 9vw, 2.8rem); line-height: 1.08; }
  .ornament { width: 100%; margin-top: 30px; }
  .verse-stage { padding: 58px 0 38px; }
  blockquote { max-width: 340px; font-size: clamp(1.55rem, 7vw, 2.2rem); }
  .actions { width: 100%; flex-direction: column; gap: 14px; }
  .primary, .secondary { width: 100%; }
  .translation { margin-top: 30px; }
  .recommendations { width: 100%; margin-top: 68px; padding-top: 30px; }
  .recommendation-grid, .bookshelf-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 26px; }
  .recommendation-grid { width: 100%; min-width: 0; justify-content: stretch; }
  .widget-slot { width: 100%; max-width: 100%; min-height: 268px; justify-self: stretch; }
  .recommendation-card { padding: 20px 18px 18px; }
  .bookshelf-intro { margin-top: 28px; font-size: 1rem; }
  .bookshelf-grid { width: 100%; grid-template-columns: minmax(0, 320px); justify-content: center; gap: 28px 8px; margin-top: 48px; }
  .pocket-note { margin-top: 10px; }
  .site-footer { width: min(900px, calc(100% - 28px)); padding-bottom: 28px; }
  .legal-content { margin-top: 44px; font-size: 1rem; }
}

@media (min-width: 689px) and (max-width: 1040px) {
  .bookshelf-grid { width: min(648px, calc(100vw - 40px)); grid-template-columns: repeat(2, 320px); }
}

@media (min-width: 641px) and (max-width: 688px) {
  .bookshelf-grid { width: min(320px, calc(100vw - 40px)); grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
