/* Shop / cart / checkout / account / flipbook */

.shop-page {
  padding: calc(var(--header-h) + 2rem) 0 4rem;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(245, 196, 0, 0.12), transparent 35%),
    radial-gradient(circle at 90% 30%, rgba(47, 158, 85, 0.1), transparent 40%),
    var(--paper);
}

.shop-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: 0.5rem;
}

.icon-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}

.icon-link:hover {
  background: rgba(28, 43, 38, 0.06);
  color: var(--ink);
}

.cart-badge {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

.cart-badge.is-empty,
.cart-badge[hidden] {
  display: none !important;
}

.product-layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 2.5rem;
  align-items: start;
}

.product-cover-wrap {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.product-cover {
  width: min(360px, 100%);
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: bookFloat 5s ease-in-out infinite;
}

.product-cover img {
  width: 100%;
  display: block;
}

.product-meta .price-live {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--red);
  margin: 0.4rem 0 1rem;
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0 1.5rem;
}

.format-option {
  cursor: pointer;
}

.format-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.85rem;
  border-radius: 16px;
  border: 2px solid rgba(28, 43, 38, 0.1);
  background: #fff;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  min-height: 110px;
}

.format-option input:checked + .format-card,
.format-option:hover .format-card {
  border-color: var(--green);
  box-shadow: 0 10px 24px rgba(47, 158, 85, 0.15);
  transform: translateY(-2px);
}

.format-card strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.format-card .fmt-price {
  font-weight: 800;
  color: var(--green-dark);
}

.format-card .fmt-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 650;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.trust-row span {
  font-size: 0.8rem;
  font-weight: 800;
  background: var(--soft);
  color: var(--green-dark);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.product-tabs {
  margin-top: 2rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
}

.tab-btns {
  display: flex;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.95rem;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.is-active {
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--red);
}

.tab-panel {
  display: none;
  padding: 1.25rem 1.4rem;
  color: var(--muted);
  font-weight: 600;
}

.tab-panel.is-active {
  display: block;
}

/* Cart */
.cart-table {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cart-line {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 1rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.cart-line:last-child {
  border-bottom: 0;
}

.cart-line img {
  width: 88px;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
}

.cart-line h3 {
  margin: 0 0 0.2rem;
  font-size: 1.2rem;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.qty-controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--soft);
  cursor: pointer;
  font-weight: 800;
}

.cart-summary {
  margin-top: 1.25rem;
  background: #17352c;
  color: #fff;
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.cart-summary .total {
  font-family: var(--font-display);
  font-size: 1.8rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1px dashed rgba(28, 43, 38, 0.2);
}

/* Checkout */
.checkout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
}

.panel {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 1.45rem;
  margin-bottom: 1rem;
}

.field {
  margin-bottom: 0.9rem;
}

.field label {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  border: 2px solid rgba(28, 43, 38, 0.1);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  outline: none;
  background: #fff;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 158, 85, 0.12);
}

.pay-methods {
  display: grid;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}

.pay-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border: 2px solid rgba(28, 43, 38, 0.1);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
}

.pay-option:has(input:checked) {
  border-color: var(--blue);
  background: rgba(47, 143, 214, 0.06);
}

.order-lines {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.order-line {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.order-line img {
  width: 54px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.15rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.form-error {
  color: var(--red);
  font-weight: 700;
  margin: 0.5rem 0;
}

.secure-note {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 650;
  margin-top: 0.75rem;
}

/* Account / library */
.account-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.75rem;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.library-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.library-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.library-card .body {
  padding: 1rem;
  display: grid;
  gap: 0.55rem;
}

.library-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.auth-card {
  max-width: 460px;
  margin: 0 auto;
}

.success-banner {
  background: linear-gradient(135deg, #eef9f2, #fff4ec);
  border: 1px solid rgba(47, 158, 85, 0.25);
  color: var(--green-dark);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  font-weight: 750;
  margin-bottom: 1.25rem;
}

.flipbook-page .site-header {
  background: rgba(16, 38, 31, 0.92);
  backdrop-filter: blur(12px);
}

.flipbook-page .icon-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.flipbook-toolbar {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.flipbook-stage {
  width: min(980px, calc(100% - 1.5rem));
  margin: 0 auto;
  display: grid;
  place-items: center;
}

#flipbook {
  margin: 0 auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.flip-page {
  background: #fffdf8;
  color: #1c2b26;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.flip-page img.full {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flip-page .inner {
  height: 100%;
  padding: 8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 90% 10%, rgba(245, 196, 0, 0.15), transparent 40%),
    radial-gradient(circle at 10% 90%, rgba(47, 158, 85, 0.12), transparent 40%),
    #fffdf8;
}

.flip-page h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 0.75rem;
}

.flip-page p {
  font-weight: 650;
  color: #4d635a;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
}

.sense-page-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.flip-controls {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 1.25rem;
}

@media (max-width: 900px) {
  .product-layout,
  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .product-cover-wrap {
    position: static;
  }

  .format-grid {
    grid-template-columns: 1fr;
  }

  .cart-line {
    grid-template-columns: 72px 1fr;
  }

  .cart-line .line-total {
    grid-column: 2;
  }
}
