:root {
  --bg: #f4f1ea;
  --bg-soft: #fbf8f2;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #1f1b16;
  --muted: #665f57;
  --line: rgba(71, 56, 40, 0.14);
  --brand: #b44b2d;
  --brand-dark: #91381f;
  --brand-soft: #f8d8c7;
  --accent: #214438;
  --success: #1f7a53;
  --danger: #c23b32;
  --shadow: 0 18px 45px rgba(47, 35, 22, 0.09);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(180, 75, 45, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(33, 68, 56, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f4ee 0%, #f4f1ea 38%, #efe8de 100%);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: rgba(248, 244, 238, 0.78);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  gap: 16px;
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active-nav {
  background: rgba(180, 75, 45, 0.12);
  color: var(--text);
  transform: translateY(-1px);
}

.cart-link {
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.hero {
  padding: 60px 0 36px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.panel,
.auth-card,
.success-card {
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy {
  padding: 42px;
  border-radius: 34px;
}

.hero-badge,
.section-tag {
  display: inline-flex;
  padding: 8px 14px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.hero-copy h1 {
  font-size: clamp(2.3rem, 4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
  margin: 18px 0 16px;
  max-width: 9ch;
}

.hero-copy p {
  max-width: 48ch;
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.hero-panel {
  padding: 18px;
  border-radius: 34px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.hero-card {
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 238, 228, 0.9));
  min-height: 158px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-card-large {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(180, 75, 45, 0.95), rgba(145, 56, 31, 0.95));
  color: #fff;
}

.hero-card p {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.82;
}

.hero-card h3 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.hero-card span {
  font-size: 0.98rem;
  opacity: 0.88;
}

.catalog-section,
.page-shell,
.auth-shell,
.success-shell {
  padding: 24px 0 56px;
}

.section-header,
.page-heading {
  margin-bottom: 24px;
}

.section-header h2,
.page-heading h1,
.auth-card h1,
.success-card h1 {
  font-size: clamp(1.9rem, 2.6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-top: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.4fr 240px;
  gap: 16px;
  margin-bottom: 24px;
}

.search-box input,
.filter-box select,
.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: 15px 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus,
.filter-box select:focus,
.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(180, 75, 45, 0.5);
  box-shadow: 0 0 0 4px rgba(180, 75, 45, 0.14);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}

.book-card,
.cart-item,
.order-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.book-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.book-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #efe6d9;
}

.book-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.book-category {
  color: var(--brand-dark);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.book-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.book-author {
  color: var(--muted);
  font-size: 0.95rem;
}

.book-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.book-price {
  font-size: 1.25rem;
  font-weight: 800;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  padding: 14px 18px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 12px 28px rgba(180, 75, 45, 0.24);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: rgba(33, 68, 56, 0.12);
  color: var(--accent);
}

.btn-outline {
  background: rgba(180, 75, 45, 0.08);
  color: var(--brand-dark);
}

.btn-danger {
  background: rgba(194, 59, 50, 0.12);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.panel {
  border-radius: 30px;
  padding: 24px;
}

.cart-layout,
.checkout-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 22px;
}

.cart-list,
.orders-list,
.checkout-summary-list {
  display: grid;
  gap: 16px;
}

.cart-item,
.order-card {
  padding: 18px;
}

.cart-item {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 16px;
  align-items: center;
}

.cart-thumb {
  width: 92px;
  height: 118px;
  object-fit: cover;
  border-radius: 18px;
}

.cart-meta h3 {
  font-size: 1.08rem;
  margin-bottom: 4px;
}

.cart-meta p {
  color: var(--muted);
}

.quantity-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(180, 75, 45, 0.12);
  color: var(--brand-dark);
  font-size: 1.1rem;
  font-weight: 700;
}

.summary-panel {
  position: sticky;
  top: 98px;
  height: fit-content;
}

.summary-panel h2 {
  margin-bottom: 18px;
  font-size: 1.35rem;
}

.summary-row,
.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.summary-row:last-of-type,
.summary-item:last-child {
  border-bottom: 0;
}

.total-row {
  font-size: 1.12rem;
  font-weight: 800;
}

.checkout-form,
.auth-form {
  display: grid;
  gap: 18px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-group label {
  font-weight: 700;
}

.auth-shell,
.success-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 76px);
}

.auth-card,
.success-card {
  width: min(540px, calc(100% - 32px));
  padding: 34px;
  border-radius: 32px;
  text-align: center;
}

.auth-copy {
  color: var(--muted);
  line-height: 1.7;
  margin: 16px 0 24px;
}

.success-card p {
  color: var(--muted);
}

.success-icon {
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(31, 122, 83, 0.14);
  color: var(--success);
  font-size: 2rem;
  font-weight: 800;
}

.order-id-box {
  margin: 24px 0;
  padding: 18px;
  border-radius: 20px;
  background: rgba(180, 75, 45, 0.08);
  display: grid;
  gap: 8px;
}

.order-id-box strong {
  font-size: 1.3rem;
  color: var(--brand-dark);
}

.page-message {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  line-height: 1.6;
}

.page-message.info {
  background: rgba(33, 68, 56, 0.1);
  color: var(--accent);
}

.page-message.error {
  background: rgba(194, 59, 50, 0.1);
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pending {
  background: rgba(180, 75, 45, 0.12);
  color: var(--brand-dark);
}

.status-delivered {
  background: rgba(31, 122, 83, 0.14);
  color: var(--success);
}

.order-card {
  display: grid;
  gap: 16px;
}

.order-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.order-meta,
.order-items {
  color: var(--muted);
  line-height: 1.7;
}

.order-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer {
  padding: 28px 0 40px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 20px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .hero-grid,
  .cart-layout,
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100% - 20px, 1120px);
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 0;
  }

  .hero-copy,
  .hero-panel,
  .panel,
  .auth-card,
  .success-card {
    border-radius: 24px;
  }

  .hero-copy {
    padding: 28px;
  }

  .book-grid {
    grid-template-columns: 1fr;
  }

  .cart-item {
    grid-template-columns: 1fr;
  }

  .cart-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
  }

  .book-footer,
  .order-actions,
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-card-large {
    grid-column: span 1;
  }
}
