:root {
  --brand: #2f2a65;
  --brand-strong: #1e1a4a;
  --accent: #e36d52;
  --accent-soft: #f9d7ca;
  --teal: #5d9ea8;
  --bg: #f5f1eb;
  --panel: #fffdfb;
  --panel-strong: #ffffff;
  --line: rgba(30, 26, 74, 0.12);
  --text: #1d2433;
  --muted: #5f6472;
  --shadow: 0 20px 40px rgba(34, 29, 66, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(132, 169, 255, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f3ee 0%, #f4efe8 100%);
  color: var(--text);
}

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

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

button,
input,
select,
textarea {
  font: inherit;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(27, 22, 61, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 82px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand__mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #f7c7a7, #f7e7b2 60%, #d5ece9);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.65);
}

.search {
  flex: 1 1 420px;
  display: flex;
  min-width: 220px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  overflow: hidden;
  max-width: 560px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #fff;
  padding: 0 18px;
  min-height: 46px;
}

.search input::placeholder { color: rgba(255,255,255,0.74); }

.search button,
.btn,
button.btn {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.search button {
  background: linear-gradient(135deg, var(--accent), #d96452);
  color: #fff;
  padding: 0 22px;
  min-height: 46px;
  font-weight: 700;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.main-nav a {
  color: rgba(255,255,255,0.9);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.main-nav a:hover {
  background: rgba(255,255,255,0.08);
}

.auth-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f2d7a7, #d2f0d1);
  color: var(--brand-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

.page-shell {
  padding-top: 32px;
  padding-bottom: 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
  padding: 26px 0 12px;
}

.hero__content,
.hero__visual {
  background: rgba(255,255,255,0.42);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

.hero__content {
  padding: clamp(28px, 4vw, 54px);
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand);
}

.hero h1,
.section-heading h2,
.page-shell h1,
.page-shell h2 {
  margin: 0;
  letter-spacing: -0.05em;
  color: var(--brand-strong);
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 0.98;
}

.hero__text {
  margin: 16px 0 24px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
  max-width: 56ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 26px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.btn:hover,
button.btn:hover,
.search button:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  box-shadow: 0 12px 20px rgba(47, 42, 101, 0.2);
}

.btn-secondary {
  background: rgba(47, 42, 101, 0.08);
  color: var(--brand-strong);
  border: 1px solid rgba(47, 42, 101, 0.12);
}

.hero__stats {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero__stats li {
  padding: 14px 12px 10px;
  border-radius: 18px;
  background: rgba(47, 42, 101, 0.04);
  border: 1px solid rgba(47, 42, 101, 0.08);
}

.hero__stats strong {
  display: block;
  font-size: 1.25rem;
  color: var(--brand-strong);
}

.hero__stats span {
  color: var(--muted);
  font-size: 0.8rem;
}

.hero__visual {
  position: relative;
  min-height: 420px;
  background:
    linear-gradient(160deg, rgba(93, 158, 168, 0.28), rgba(227, 109, 82, 0.18)),
    rgba(255,255,255,0.52);
  overflow: hidden;
}

.hero__visual::before {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.32);
  right: -40px;
  top: -40px;
}

.hero__visual::after {
  content: "";
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 180px;
  height: 180px;
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(255,255,255,0.35), rgba(255,255,255,0.08));
  transform: rotate(-18deg);
}

.floating-card {
  position: absolute;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(47, 42, 101, 0.08);
  border-radius: 22px;
  box-shadow: 0 18px 38px rgba(29, 36, 51, 0.12);
}

.book-card-spotlight {
  right: 48px;
  bottom: 52px;
  width: 220px;
  padding: 20px 18px 18px;
  transform: rotate(8deg);
}

.mini-label {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(227, 109, 82, 0.12);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-card-spotlight h3 {
  margin: 0;
  color: var(--brand-strong);
  font-size: 1.55rem;
  line-height: 1.1;
}

.book-card-spotlight p {
  margin: 8px 0 0;
  color: var(--muted);
}

.book-card-pill {
  left: 36px;
  top: 42px;
  padding: 14px 20px;
  font-weight: 700;
  color: var(--brand-strong);
}

.section {
  margin-top: 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.text-link {
  color: var(--brand);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}

.card {
  display: block;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  color: inherit;
  box-shadow: 0 10px 28px rgba(20, 17, 36, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(20, 17, 36, 0.1);
  border-color: rgba(47, 42, 101, 0.18);
}

.card img,
.card .noimg {
  width: 100%;
  aspect-ratio: 2 / 2.8;
  object-fit: cover;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(70, 82, 122, 0.12), rgba(244, 176, 125, 0.2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.1rem;
  color: var(--brand-strong);
}

.card h3 {
  margin: 14px 0 6px;
  color: var(--brand-strong);
  font-size: 1.08rem;
  line-height: 1.35;
}

.card .muted {
  margin: 0 0 12px;
  color: var(--muted);
}

.card .price {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tag.out {
  display: inline-block;
  margin-top: 10px;
  background: rgba(47, 42, 101, 0.06);
  color: var(--muted);
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  background: rgba(255,255,255,0.66);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand-strong);
  font-weight: 600;
}

.chips a:hover {
  border-color: rgba(47, 42, 101, 0.2);
  background: rgba(255,255,255,0.9);
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.pager .btn {
  min-height: 40px;
  padding: 0 18px;
}

form.box,
.box {
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  max-width: 520px;
  box-shadow: var(--shadow);
}

.box.wide { max-width: none; }

label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 700;
  color: var(--brand-strong);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(47, 42, 101, 0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.86);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(93, 158, 168, 0.25);
  border-color: rgba(93, 158, 168, 0.8);
}

.err { color: #b12634; margin: 8px 0; font-weight: 600; }
.ok { color: #1d7a49; }

.detail {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  align-items: start;
}

.detail-cover {
  position: sticky;
  top: 100px;
}

.detail img,
.detail .noimg {
  width: 100%;
  min-height: 420px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.detail-body h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
  color: var(--brand-strong);
}

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

.detail-price-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.price {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.stock-pill.in-stock {
  background: rgba(29, 122, 73, 0.12);
  color: #17613c;
}

.stock-pill.out-stock {
  background: rgba(177, 38, 52, 0.08);
  color: #a82a38;
}

.purchase-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.purchase-box label {
  margin: 0;
  font-size: 0.92rem;
}

.purchase-actions {
  display: flex;
  gap: 12px;
}

.purchase-actions input {
  flex: 1;
  min-width: 0;
}

.purchase-actions .btn {
  flex-shrink: 0;
}

.meta-panel {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: 0 12px 24px rgba(29, 36, 51, 0.04);
}

.meta-panel h2 {
  margin: 0 0 12px;
  font-size: 1.3rem;
  color: var(--brand-strong);
}

.book-description {
  margin: 0;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
}

.book-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 18px;
  margin: 0;
}

.fact-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(47, 42, 101, 0.03);
  border: 1px solid rgba(47, 42, 101, 0.06);
}

.fact-item dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.fact-item dd {
  margin: 0;
  font-weight: 700;
  color: var(--brand-strong);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.32);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 78px;
  flex-wrap: wrap;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--brand);
  font-weight: 700;
}

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .main-nav {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .site-header__inner {
    align-items: stretch;
  }

  .brand {
    width: 100%;
  }

  .search {
    width: 100%;
    max-width: none;
  }

  .detail {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero__stats {
    grid-template-columns: 1fr;
  }
}
