@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Source+Serif+4:ital,wght@0,400;0,500;0,600;1,400&display=swap");

:root {
  --paper: #faf5ea;
  --paper-alt: #f1e8d6;
  --paper-deep: #e9dcbf;
  --ink: #2a2117;
  --ink-soft: #6b5f4c;
  --ink-faint: #9c8f77;
  --accent: #7c2d2d;
  --accent-dark: #5e2020;
  --accent-soft: #f4e2df;
  --gold: #9c7328;
  --line: #ddd0b0;
  --safety-bg: #fdf3da;
  --safety-border: #c9a13b;
  --safety-ink: #4a3a12;
  --shadow: 0 8px 24px rgba(42, 33, 23, 0.08);
  --shadow-lift: 0 14px 34px rgba(42, 33, 23, 0.14);
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.4em;
  color: var(--ink);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

p {
  margin: 0 0 1em;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand span {
  color: var(--accent);
}

.brand-tagline {
  font-family: "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--ink-faint);
  display: block;
  margin-top: -2px;
}

.site-nav {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 14px;
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Safety banner */
.safety-banner {
  background: var(--safety-bg);
  border: 1px solid var(--safety-border);
  color: var(--safety-ink);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.92rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.safety-banner strong {
  color: var(--accent-dark);
}

.safety-banner .icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Hero / search */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  max-width: 700px;
  margin: 0 auto 0.3em;
}

.hero p.lede {
  color: var(--ink-soft);
  max-width: 560px;
  margin: 0 auto 28px;
  font-size: 1.05rem;
}

.search-bar {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.search-bar input {
  flex: 1 1 220px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.search-bar input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 26px;
  padding: 8px 0 60px;
}

.book-card {
  background: var(--paper-alt);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  text-decoration: none;
}

.book-card .cover {
  aspect-ratio: 2 / 3;
  background: var(--paper-deep) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.85rem;
  text-align: center;
  padding: 10px;
}

.book-card .info {
  padding: 14px 16px 16px;
}

.book-card h3 {
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.book-card .author {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.book-card .prices {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 600;
}

.tag.muted {
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.meta-line {
  color: var(--ink-faint);
  font-size: 0.78rem;
  margin-top: 8px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}

/* Book detail */
.book-detail {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  padding: 36px 0;
}

@media (max-width: 700px) {
  .book-detail {
    grid-template-columns: 1fr;
  }
}

.book-detail .cover {
  aspect-ratio: 2/3;
  background: var(--paper-deep) center/cover no-repeat;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.book-detail h1 {
  font-size: 2.1rem;
}

.book-detail .author {
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin-bottom: 20px;
}

.listing-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.listing-card .row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.listing-card .price-block {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.price-block .amount {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 600;
}

.price-block .label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.listing-card .thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.listing-card .thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-available {
  background: #e4f0e4;
  color: #2e5c34;
}

.status-reserved,
.status-picked_up {
  background: #fbe9d0;
  color: #8a5a1f;
}

.status-sold {
  background: #efe1e1;
  color: var(--accent-dark);
}

/* Forms */
.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 620px;
  margin: 0 auto;
}

.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.field .hint {
  color: var(--ink-faint);
  font-size: 0.82rem;
  margin-top: 4px;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.checkbox-row input {
  width: auto;
}

.radio-group {
  display: flex;
  gap: 18px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.step-number {
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.book-search-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 6px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
}

.book-search-result {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.book-search-result:last-child {
  border-bottom: none;
}

.book-search-result:hover {
  background: var(--paper);
}

.book-search-result img {
  width: 36px;
  height: 52px;
  object-fit: cover;
  background: var(--paper-deep);
  flex-shrink: 0;
}

.selected-book-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
}

.selected-book-preview img {
  width: 48px;
  height: 68px;
  object-fit: cover;
}

.price-preview {
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.price-preview .item .value {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.3rem;
  color: var(--accent-dark);
  font-weight: 600;
}

.price-preview .item .key {
  font-size: 0.76rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

.manage-box {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 14px;
}

.manage-box summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.contact-reveal {
  background: var(--paper);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 10px;
  font-size: 0.95rem;
}

.msg {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.92rem;
  margin: 14px 0;
}

.msg-error {
  background: #f8e3e3;
  color: var(--accent-dark);
  border: 1px solid #e3b6b6;
}

.msg-success {
  background: #e4f0e4;
  color: #2e5c34;
  border: 1px solid #b9d8b9;
}

.wallet-balance {
  text-align: center;
  padding: 30px;
  background: var(--paper-alt);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.wallet-balance .amount {
  font-family: "Fraunces", Georgia, serif;
  font-size: 3rem;
  color: var(--accent);
  font-weight: 700;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.history-table td.amount-positive {
  color: #2e5c34;
  font-weight: 600;
}

.history-table td.amount-negative {
  color: var(--accent-dark);
  font-weight: 600;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 30px 0 50px;
  margin-top: 40px;
  color: var(--ink-faint);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer a {
  color: var(--ink-soft);
}

.spinner-text {
  color: var(--ink-faint);
  padding: 30px 0;
  text-align: center;
}

.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 30px;
  flex-wrap: wrap;
  gap: 12px;
}
