:root {
  --commerce-success: #2f7a55;
  --commerce-error: #a33b36;
  --commerce-surface: #fffdf9;
  --commerce-soft: #f4e9da;
}

.commerce-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 10%, rgba(217, 164, 95, 0.16), transparent 28rem),
    var(--cream);
}

.commerce-page main {
  min-height: calc(100vh - 78px);
}

.commerce-page-header {
  padding: clamp(52px, 7vw, 92px) clamp(20px, 6vw, 92px) 36px;
  color: var(--cream);
  background:
    linear-gradient(120deg, rgba(22, 12, 8, 0.98), rgba(58, 32, 21, 0.94)),
    radial-gradient(circle at 85% 30%, rgba(217, 164, 95, 0.18), transparent 30rem);
}

.commerce-page-header .eyebrow {
  color: var(--gold-2);
}

.commerce-page-header h1 {
  max-width: 850px;
  margin: 0 0 14px;
  color: var(--cream);
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.04;
}

.commerce-page-header > p:last-child {
  max-width: 650px;
  margin: 0;
  color: rgba(255, 248, 239, 0.68);
}

.checkout-layout,
.success-layout,
.auth-shell,
.account-shell,
.article-shell {
  width: min(1220px, calc(100% - 40px));
  margin-inline: auto;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: clamp(34px, 5vw, 72px);
  align-items: start;
  padding: clamp(48px, 7vw, 88px) 0 110px;
}

.checkout-form,
.order-summary,
.auth-card,
.account-content,
.account-sidebar,
.success-card,
.article-body,
.related-posts {
  background: rgba(255, 253, 249, 0.96);
  border: 1px solid rgba(58, 32, 21, 0.1);
  border-radius: 12px;
  box-shadow: 0 22px 64px rgba(27, 15, 10, 0.09);
}

.checkout-form {
  padding: clamp(24px, 4vw, 46px);
}

.checkout-section + .checkout-section {
  padding-top: 34px;
  margin-top: 34px;
  border-top: 1px solid rgba(58, 32, 21, 0.1);
}

.checkout-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.checkout-step {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--ink);
  background: var(--gold-2);
  border-radius: 50%;
  font-weight: 800;
}

.checkout-section h2,
.order-summary h2,
.auth-card h1,
.account-content h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field-full {
  grid-column: 1 / -1;
}

.field label,
.field > span:first-child {
  color: var(--cacao);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(58, 32, 21, 0.2);
  border-radius: 6px;
  outline: 0;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 164, 95, 0.16);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--commerce-error);
  box-shadow: 0 0 0 3px rgba(163, 59, 54, 0.1);
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: var(--commerce-error);
  font-size: 12px;
  line-height: 1.4;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid rgba(58, 32, 21, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.choice-card:hover,
.choice-card:has(input:checked) {
  background: #fffaf2;
  border-color: var(--gold);
  transform: translateY(-1px);
}

.choice-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--cacao);
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.choice-price {
  color: var(--cacao);
  font-weight: 800;
}

.order-summary {
  position: sticky;
  top: 94px;
  padding: 28px;
}

.order-summary h2 {
  margin-bottom: 22px;
  font-size: 30px;
}

.summary-items,
.success-products {
  display: grid;
  gap: 16px;
}

.summary-item,
.success-product {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.summary-item img,
.success-product img {
  width: 66px;
  height: 66px;
  object-fit: cover;
  border-radius: 8px;
}

.summary-item strong,
.summary-item small,
.success-product strong,
.success-product small {
  display: block;
}

.summary-item small,
.success-product small {
  color: var(--muted);
}

.summary-item-price {
  white-space: nowrap;
  font-weight: 800;
}

.summary-totals {
  display: grid;
  gap: 11px;
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid rgba(58, 32, 21, 0.12);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
}

.summary-line.total {
  padding-top: 14px;
  color: var(--ink);
  border-top: 1px solid rgba(58, 32, 21, 0.12);
  font-size: 19px;
  font-weight: 900;
}

.place-order {
  position: relative;
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
}

.place-order[disabled] {
  cursor: wait;
  opacity: 0.72;
}

.button-spinner {
  display: none;
  width: 19px;
  height: 19px;
  border: 2px solid rgba(27, 15, 10, 0.28);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: checkout-spin 0.7s linear infinite;
}

.place-order.is-loading .button-label {
  display: none;
}

.place-order.is-loading .button-spinner {
  display: inline-block;
}

@keyframes checkout-spin {
  to { transform: rotate(360deg); }
}

.secure-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.commerce-empty-page {
  grid-column: 1 / -1;
  padding: 70px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid rgba(58, 32, 21, 0.1);
  border-radius: 12px;
}

.commerce-empty-page h2 {
  margin: 0 0 12px;
  font-size: 38px;
}

.commerce-empty-page p {
  margin: 0 auto 24px;
  color: var(--muted);
}

/* Success page */
.success-layout {
  padding: clamp(54px, 8vw, 100px) 0 110px;
}

.success-card {
  max-width: 900px;
  padding: clamp(28px, 6vw, 64px);
  margin-inline: auto;
}

.success-heading {
  text-align: center;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 22px;
  color: #fff;
  background: var(--commerce-success);
  border-radius: 50%;
  box-shadow: 0 14px 38px rgba(47, 122, 85, 0.24);
  font-size: 38px;
}

.success-heading h1 {
  margin: 0 0 10px;
  font-size: clamp(38px, 5vw, 58px);
}

.success-heading p {
  margin: 0;
  color: var(--muted);
}

.order-code {
  display: inline-flex;
  padding: 8px 14px;
  margin-top: 20px;
  color: var(--cacao);
  background: var(--commerce-soft);
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.success-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  padding-top: 38px;
  margin-top: 38px;
  border-top: 1px solid rgba(58, 32, 21, 0.12);
}

.success-grid h2 {
  margin: 0 0 18px;
  font-size: 25px;
}

.success-meta {
  display: grid;
  gap: 18px;
}

.success-meta article {
  padding: 18px;
  background: #f9f3ea;
  border-radius: 8px;
}

.success-meta strong,
.success-meta span {
  display: block;
}

.success-meta span {
  margin-top: 4px;
  color: var(--muted);
  white-space: pre-line;
}

.success-total {
  display: flex;
  justify-content: space-between;
  padding-top: 18px;
  margin-top: 20px;
  border-top: 1px solid rgba(58, 32, 21, 0.12);
  font-size: 20px;
  font-weight: 900;
}

.success-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 38px;
}

/* Auth */
.auth-page {
  background:
    linear-gradient(90deg, rgba(20, 10, 7, 0.94), rgba(20, 10, 7, 0.62)),
    url("assets/images/catalog-hero.jpg") center / cover fixed;
}

.auth-page main {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 78px);
  padding: 60px 0;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(340px, 0.7fr);
  gap: clamp(40px, 7vw, 100px);
  align-items: center;
}

.auth-intro {
  color: var(--cream);
}

.auth-intro h1 {
  margin: 0 0 20px;
  color: var(--cream);
  font-size: clamp(45px, 6vw, 76px);
  line-height: 1.02;
}

.auth-intro p {
  max-width: 550px;
  color: rgba(255, 248, 239, 0.7);
}

.auth-card {
  padding: clamp(26px, 4vw, 44px);
}

.auth-card > p {
  margin: 8px 0 26px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form .btn {
  min-height: 52px;
  margin-top: 6px;
}

.terms-field {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 13px;
}

.terms-field input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--cacao);
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 20px;
  color: var(--cacao);
  font-size: 13px;
  font-weight: 800;
}

.form-message {
  display: none;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.form-message.is-visible {
  display: block;
}

.form-message[data-type="error"] {
  color: #721e1b;
  background: #f9dcd9;
}

.form-message[data-type="success"] {
  color: #1f5e41;
  background: #dbf0e4;
}

/* Account */
.account-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
  padding: 46px 0 110px;
}

.account-sidebar {
  position: sticky;
  top: 94px;
  overflow: hidden;
}

.account-user {
  padding: 26px;
  color: var(--cream);
  background: linear-gradient(135deg, var(--ink), var(--cacao));
}

.account-user-avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 14px;
  color: var(--ink);
  background: var(--gold-2);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 800;
}

.account-user strong,
.account-user small {
  display: block;
}

.account-user small {
  color: rgba(255, 248, 239, 0.58);
}

.account-nav {
  display: grid;
  padding: 12px;
}

.account-nav button {
  padding: 13px 14px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 750;
}

.account-nav button:hover,
.account-nav button.is-active {
  color: var(--cacao);
  background: var(--commerce-soft);
}

.account-content {
  min-height: 520px;
  padding: clamp(24px, 4vw, 44px);
}

.account-panel[hidden] {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid rgba(58, 32, 21, 0.1);
}

.panel-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  padding: 24px;
  background: linear-gradient(145deg, #fffaf2, #f3e4cf);
  border: 1px solid rgba(217, 164, 95, 0.22);
  border-radius: 9px;
}

.stat-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--cacao);
  font-family: var(--serif);
  font-size: 34px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-note {
  padding: 24px;
  margin-top: 20px;
  background: #fff;
  border: 1px solid rgba(58, 32, 21, 0.1);
  border-radius: 9px;
}

.orders-list,
.address-list,
.wishlist-grid {
  display: grid;
  gap: 14px;
}

.order-row,
.address-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(58, 32, 21, 0.11);
  border-radius: 8px;
}

.order-row small,
.order-row strong,
.address-card small,
.address-card strong {
  display: block;
}

.order-row small,
.address-card small {
  color: var(--muted);
}

.order-status {
  display: inline-flex;
  width: max-content;
  padding: 5px 9px;
  color: #6c4a12;
  background: #f6e5b8;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.account-empty {
  padding: 52px 22px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed rgba(58, 32, 21, 0.2);
  border-radius: 9px;
}

.account-empty strong {
  display: block;
  margin-bottom: 8px;
  color: var(--cacao);
  font-size: 20px;
}

.wishlist-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wishlist-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(58, 32, 21, 0.11);
  border-radius: 8px;
}

.wishlist-card img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 7px;
}

.wishlist-card h3 {
  margin: 0 0 5px;
  font-size: 18px;
}

.wishlist-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.small-button {
  padding: 8px 11px;
  color: var(--cacao);
  background: var(--commerce-soft);
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.small-button.danger {
  color: var(--commerce-error);
  background: #fae8e6;
}

.address-form {
  padding: 20px;
  margin-bottom: 20px;
  background: #fbf6ef;
  border-radius: 8px;
}

.address-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.order-detail {
  display: none;
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid rgba(58, 32, 21, 0.1);
}

.order-row.is-open .order-detail {
  display: block;
}

/* Blog article */
.article-hero {
  position: relative;
  min-height: 570px;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: var(--cream);
  background: var(--ink);
}

.article-hero img,
.article-hero::after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.article-hero img {
  object-fit: cover;
}

.article-hero::after {
  content: "";
  background: linear-gradient(0deg, rgba(18, 9, 6, 0.96), rgba(18, 9, 6, 0.18) 76%);
}

.article-hero-content {
  position: relative;
  z-index: 1;
  width: min(1000px, calc(100% - 40px));
  padding: 90px 0 58px;
  margin-inline: auto;
}

.article-hero h1 {
  max-width: 920px;
  margin: 12px 0 20px;
  color: var(--cream);
  font-size: clamp(44px, 7vw, 82px);
  line-height: 1.02;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: rgba(255, 248, 239, 0.66);
  font-size: 13px;
}

.article-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 42px;
  align-items: start;
  padding: 70px 0 110px;
}

.article-body {
  padding: clamp(28px, 5vw, 58px);
}

.article-body > p:first-child {
  color: var(--cacao);
  font-family: var(--serif);
  font-size: clamp(23px, 3vw, 31px);
  line-height: 1.45;
}

.article-body h2 {
  margin: 42px 0 15px;
  font-size: 32px;
}

.article-body p,
.article-body li {
  color: #55453b;
  font-size: 17px;
  line-height: 1.85;
}

.article-body blockquote {
  padding: 24px 28px;
  margin: 34px 0;
  color: var(--cacao);
  background: var(--commerce-soft);
  border-left: 3px solid var(--gold);
  font-family: var(--serif);
  font-size: 23px;
}

.related-posts {
  position: sticky;
  top: 96px;
  padding: 22px;
}

.related-posts h2 {
  margin: 0 0 18px;
  font-size: 25px;
}

.related-post-link {
  display: grid;
  gap: 7px;
  padding: 14px 0;
  border-top: 1px solid rgba(58, 32, 21, 0.1);
}

.related-post-link small {
  color: var(--gold);
  font-weight: 800;
  text-transform: uppercase;
}

.related-post-link strong {
  line-height: 1.35;
}

/* Account dropdown and richer search */
.account-menu {
  position: fixed;
  top: 72px;
  right: clamp(18px, 4vw, 72px);
  z-index: 80;
  width: min(300px, calc(100% - 36px));
  padding: 18px;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid rgba(217, 164, 95, 0.32);
  border-radius: 9px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.account-menu[hidden] {
  display: none;
}

.account-menu strong,
.account-menu small {
  display: block;
}

.account-menu small {
  color: var(--muted);
}

.account-menu-links {
  display: grid;
  gap: 6px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid rgba(58, 32, 21, 0.1);
}

.account-menu a,
.account-menu button {
  width: 100%;
  padding: 9px 10px;
  color: var(--cacao);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-weight: 750;
}

.account-menu a:hover,
.account-menu button:hover {
  background: var(--commerce-soft);
}

.popular-searches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}

.popular-searches button {
  padding: 7px 11px;
  color: var(--cacao);
  background: var(--commerce-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.popular-searches button:hover {
  border-color: var(--gold);
}

@media (max-width: 980px) {
  .checkout-layout,
  .success-grid,
  .auth-shell,
  .article-shell {
    grid-template-columns: 1fr;
  }

  .order-summary,
  .related-posts {
    position: static;
  }

  .account-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .overview-stats,
  .wishlist-grid {
    grid-template-columns: 1fr;
  }

  .order-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .checkout-layout,
  .success-layout,
  .auth-shell,
  .account-shell,
  .article-shell {
    width: min(100% - 28px, 1220px);
  }

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

  .field-full {
    grid-column: auto;
  }

  .summary-item,
  .success-product {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .summary-item img,
  .success-product img {
    width: 56px;
    height: 56px;
  }

  .summary-item-price {
    grid-column: 2;
  }

  .account-shell {
    grid-template-columns: 1fr;
    padding-top: 24px;
  }

  .account-sidebar {
    position: static;
  }

  .account-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 480px) {
  .commerce-page-header {
    padding-inline: 14px;
  }

  .checkout-form,
  .order-summary,
  .auth-card,
  .account-content,
  .success-card,
  .article-body {
    padding: 22px 18px;
  }

  .choice-card {
    grid-template-columns: auto 1fr;
  }

  .choice-price {
    grid-column: 2;
  }

  .success-actions,
  .success-actions .btn {
    width: 100%;
  }

  .account-nav {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button-spinner {
    animation-duration: 1.5s;
  }
}
