:root {
  --ink: #1f1b16;
  --cream: #f7f2e9;
  --paper: #ffffff;
  --accent: #8a3324;
  --accent-dark: #6c271a;
  --line: #e3dac9;
  --muted: #6b6253;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Georgia', 'Iowan Old Style', serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-size: 1.4rem;
  font-weight: bold;
  letter-spacing: 0.02em;
}

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

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.nav-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--muted);
  font-size: 1.05rem;
}

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  margin-top: 2rem;
}

.book-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.book-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  transform: translateY(-3px);
}

.book-cover-link {
  display: block;
}

.book-cover {
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--line);
}

.book-info {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.book-info h2 {
  font-size: 1.25rem;
  margin: 0;
}

.book-info h2 a:hover {
  color: var(--accent);
}

.details-link {
  color: var(--accent);
  font-size: 0.88rem;
  align-self: flex-start;
}

.details-link:hover {
  text-decoration: underline;
}

.book-author {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.book-desc {
  font-size: 0.92rem;
  color: #3a352d;
  flex: 1;
}

.book-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.book-price {
  font-weight: bold;
  font-size: 1.1rem;
}

.add-to-cart {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  text-decoration: none;
}

.add-to-cart:hover { background: var(--accent-dark); }

.add-to-cart:disabled {
  background: var(--muted);
  cursor: default;
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}

/* Checkout page */
.checkout-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.checkout-wrap h1 {
  margin-bottom: 0.25rem;
}

.demo-notice {
  background: #fff7e6;
  border: 1px solid #f0d9a0;
  color: #7a5a13;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 2rem;
}

form.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.checkout-form label {
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  margin-bottom: 0.3rem;
}

.checkout-form input {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row > div { flex: 1; }

.place-order-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.9rem 1.5rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.5rem;
  text-decoration: none;
  text-align: center;
}

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

.download-btn {
  margin-bottom: 0.5rem;
}

.confirmation {
  text-align: center;
  padding: 3rem 1rem;
}

.confirmation h1 {
  color: var(--accent);
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--accent);
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
}

/* Book detail page */
.detail-back {
  display: inline-block;
  max-width: 1000px;
  margin: 1.5rem auto 0;
  padding: 0 2rem;
  width: 100%;
  box-sizing: border-box;
  color: var(--muted);
}

.detail-back:hover {
  color: var(--accent);
}

.book-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
}

.book-detail-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  align-self: start;
  background: var(--line);
}

.book-detail-info h1 {
  margin: 0 0 0.25rem;
  font-size: 2rem;
}

.book-price-large {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 0.75rem 0;
}

.book-detail-info .add-to-cart {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.book-detail-desc p {
  margin: 0 0 1rem;
}

.book-excerpt {
  margin-top: 2.5rem;
}

.book-excerpt h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.book-excerpt blockquote {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--paper);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: #3a352d;
}

.book-excerpt blockquote p {
  margin: 0 0 1rem;
}

.book-excerpt blockquote p:last-child {
  margin-bottom: 0;
}

.excerpt-label {
  font-style: normal;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--accent);
}

@media (max-width: 640px) {
  .book-detail {
    grid-template-columns: 1fr;
  }
  .book-detail-cover {
    max-width: 260px;
    margin: 0 auto;
  }
}

/* Contact page */
.contact-intro {
  color: var(--muted);
  margin-bottom: 2rem;
}

.contact-methods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.contact-method {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
}

.contact-method:hover {
  border-color: var(--accent);
}

.contact-method-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.contact-method-value {
  font-size: 0.95rem;
}

.checkout-form textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
