/* Hearth Goods — simple ecommerce demo */
:root {
  --cream: #faf8f5;
  --cream-dark: #f0ebe3;
  --brown: #2d2420;
  --brown-soft: #5c4f48;
  --terra: #c4694a;
  --terra-dark: #a85538;
  --sage: #6b7f6e;
  --serif: "Libre Baskerville", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 72px;
  --promo-h: 40px;
  --container: min(1140px, calc(100% - 2.5rem));
  --radius: 14px;
  --shadow: 0 16px 48px rgba(45, 36, 32, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--brown);
  background: var(--cream);
  overflow-x: hidden;
}

body.has-promo {
  --header-offset: calc(var(--header-h) + var(--promo-h));
}

body:not(.has-promo) {
  --header-offset: var(--header-h);
}

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

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

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

ul {
  list-style: none;
}

fieldset {
  border: none;
  margin-bottom: 1.25rem;
}

legend {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brown-soft);
  margin-bottom: 0.75rem;
}

/* Promo bar */
.promo {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 210;
  height: var(--promo-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--brown);
  color: var(--cream);
  font-size: 0.78rem;
}

.promo[hidden] {
  display: none;
}

.promo strong {
  color: var(--terra);
  letter-spacing: 0.05em;
}

.promo button {
  position: absolute;
  right: 1rem;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.7;
}

.promo button:hover {
  opacity: 1;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 0.65rem;
}

h1, h2, h3 {
  font-family: var(--serif);
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
}

h1 em {
  font-style: italic;
  color: var(--terra);
}

h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 999px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s, background 0.3s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--terra);
  color: white;
  box-shadow: 0 8px 24px rgba(196, 105, 74, 0.3);
}

.btn--primary:hover:not(:disabled) {
  background: var(--terra-dark);
  transform: translateY(-2px);
}

.btn--outline {
  border: 2px solid var(--terra);
  color: var(--terra);
  margin-top: 1rem;
}

.btn--outline:hover {
  background: rgba(196, 105, 74, 0.08);
}

.btn--full {
  width: 100%;
}

.btn--add {
  width: 100%;
  padding: 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--brown);
  color: var(--cream);
  border-radius: 8px;
  margin-top: 0.75rem;
  transition: background 0.25s, transform 0.2s;
}

.btn--add:hover {
  background: var(--terra);
  transform: translateY(-1px);
}

/* Header — always visible */
.header {
  position: fixed;
  top: var(--promo-h);
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--header-h);
  transition: background 0.35s, box-shadow 0.35s, top 0.3s;
}

body:not(.has-promo) .header {
  top: 0;
}

.header--solid {
  background: rgba(250, 248, 245, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(45, 36, 32, 0.06);
}

.nav {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__logo {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

.nav__logo span {
  font-weight: 400;
  color: var(--terra);
}

.nav__links {
  display: flex;
  gap: 1.75rem;
}

.nav__links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--brown-soft);
  transition: color 0.25s;
}

.nav__links a:hover {
  color: var(--terra);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-wrap input {
  width: 160px;
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--cream-dark);
  border-radius: 999px;
  background: white;
  transition: border-color 0.25s, width 0.3s;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--terra);
  width: 200px;
}

.cart-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--brown);
  color: var(--cream);
  border-radius: 999px;
  transition: background 0.25s, transform 0.2s;
}

.cart-btn:hover {
  background: var(--terra);
}

.cart-btn__count {
  min-width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  background: var(--terra);
  border-radius: 999px;
}

.cart-btn__count.pop {
  animation: pop 0.4s var(--ease);
}

@keyframes pop {
  50% { transform: scale(1.3); }
}

.nav__menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}

.nav__menu span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--brown);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

.nav__menu[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__menu[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav__menu[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

main {
  padding-top: var(--header-offset);
}

/* Hero */
.hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.hero__inner {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 2.5rem;
}

.hero__lead {
  color: var(--brown-soft);
  margin: 1rem 0 1.75rem;
}

.hero__banner img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

/* Shop */
.shop {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.shop__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--cream-dark);
  color: var(--brown-soft);
  transition: all 0.25s;
}

.filter:hover {
  border-color: var(--terra);
  color: var(--terra);
}

.filter.is-active {
  background: var(--brown);
  color: var(--cream);
  border-color: var(--brown);
}

.sort {
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.82rem;
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  background: white;
}

.shop__count {
  font-size: 0.85rem;
  color: var(--brown-soft);
  margin-bottom: 1.25rem;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--brown-soft);
}

.product {
  position: relative;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(45, 36, 32, 0.06);
  transition: transform 0.35s var(--ease), box-shadow 0.35s;
}

.product:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.product__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem;
  background: var(--terra);
  color: white;
  border-radius: 4px;
}

.product__qv {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  padding: 0.35rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}

.product:hover .product__qv {
  opacity: 1;
  transform: translateY(0);
}

.product__qv:hover {
  background: var(--brown);
  color: white;
}

.product__img {
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--cream-dark);
}

.product__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.product:hover .product__img img {
  transform: scale(1.06);
}

.product__body {
  padding: 1rem 1.1rem 1.15rem;
}

.product__cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
}

.product h3 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.product__price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--terra);
}

/* About */
.about {
  background: white;
  padding: 5rem 0;
}

.about__grid {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about__copy p {
  color: var(--brown-soft);
  margin-bottom: 1rem;
}

.about__list li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--brown-soft);
}

.about__list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--sage);
  font-weight: 700;
}

.about__imgs {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
}

.about__imgs img {
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.about__imgs img:first-child {
  grid-row: span 2;
  aspect-ratio: 3/4;
}

.about__imgs img:last-child {
  aspect-ratio: 1;
}

/* Features */
.features {
  padding: 4rem 0 5rem;
}

.features__grid {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.feature {
  text-align: center;
  padding: 1.5rem 1rem;
  background: white;
  border-radius: var(--radius);
  border: 1px solid rgba(45, 36, 32, 0.05);
  transition: transform 0.3s var(--ease);
}

.feature:hover {
  transform: translateY(-4px);
}

.feature span {
  font-size: 1.75rem;
  display: block;
  margin-bottom: 0.5rem;
}

.feature h3 {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feature p {
  font-size: 0.82rem;
  color: var(--brown-soft);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2.5rem 1.25rem;
  border-top: 1px solid var(--cream-dark);
  background: white;
}

.footer__brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.footer__note {
  font-size: 0.8rem;
  color: var(--brown-soft);
  margin-bottom: 1rem;
}

.footer__note a {
  color: var(--terra);
  text-decoration: underline;
}

.footer__back {
  font-size: 0.8rem;
  font-weight: 600;
}

.footer__back:hover {
  color: var(--terra);
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(45, 36, 32, 0.45);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.4s;
}

.overlay.is-open {
  opacity: 1;
}

/* Cart drawer */
.cart {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 301;
  width: min(400px, 100%);
  height: 100%;
  background: white;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.45s var(--ease);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
}

.cart.is-open {
  transform: translateX(0);
}

.cart__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--cream-dark);
}

.cart__head h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
}

.cart__head button {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--brown-soft);
}

.cart__items {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--cream-dark);
  animation: slideIn 0.35s var(--ease);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.cart-item__img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream-dark);
}

.cart-item__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.cart-item p {
  font-size: 0.85rem;
  color: var(--terra);
  font-weight: 600;
}

.qty {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  overflow: hidden;
}

.qty button {
  width: 28px;
  height: 28px;
  font-size: 1rem;
  background: var(--cream);
  transition: background 0.2s;
}

.qty button:hover {
  background: var(--cream-dark);
}

.qty span {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 1.25rem;
  text-align: center;
}

.cart-item__remove {
  font-size: 1.25rem;
  color: var(--brown-soft);
  padding: 0.25rem;
}

.cart-item__remove:hover {
  color: var(--terra);
}

.cart__empty {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--brown-soft);
}

.cart__foot {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--cream-dark);
}

.cart__row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.cart__row--muted {
  color: var(--brown-soft);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Checkout */
.checkout {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 302;
  width: min(880px, calc(100% - 2rem));
  max-height: 90vh;
  overflow-y: auto;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: white;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2);
}

.checkout::backdrop {
  display: none;
}

.checkout__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cream);
}

.checkout__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}

.checkout__form-wrap {
  padding: 2rem;
}

.checkout__sub {
  font-size: 0.85rem;
  color: var(--brown-soft);
  margin-bottom: 1.5rem;
}

.form-row {
  margin-bottom: 0.85rem;
}

.form-row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--brown-soft);
}

.form-row input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font: inherit;
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  background: var(--cream);
}

.form-row input:focus {
  outline: none;
  border-color: var(--terra);
}

.form-row--half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.checkout__summary {
  padding: 2rem;
  background: var(--cream);
  border-left: 1px solid var(--cream-dark);
}

.checkout__summary h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
}

.co-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(45, 36, 32, 0.06);
}

.co-line--muted {
  color: var(--brown-soft);
}

.co-line--total {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--cream-dark);
  font-weight: 600;
}

.co-line--total strong {
  font-size: 1.2rem;
  color: var(--terra);
}

/* Quick view */
.quick-view {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 301;
  width: min(720px, calc(100% - 2rem));
  background: white;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0;
  transition: transform 0.45s var(--ease), opacity 0.45s;
  box-shadow: var(--shadow);
}

.quick-view.is-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.qv__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 50%;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qv__img {
  aspect-ratio: 1;
  background: var(--cream-dark);
}

.qv__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qv__body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.qv__body h2 {
  font-size: 1.35rem;
  margin: 0.35rem 0;
}

.qv__body p {
  font-size: 0.9rem;
  color: var(--brown-soft);
  margin: 0.75rem 0 1.25rem;
}

/* Hidden elements — display rules must not override the hidden attribute */
.success[hidden],
.overlay[hidden],
.cart[hidden],
.quick-view[hidden] {
  display: none !important;
}

/* Success overlay */
.success {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 36, 32, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.35s ease;
}

.success__box {
  background: white;
  padding: 2.5rem;
  border-radius: 20px;
  text-align: center;
  max-width: 360px;
  margin: 1rem;
  animation: modalIn 0.5s var(--ease);
}

.success__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  background: var(--sage);
  border-radius: 50%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  z-index: 500;
  padding: 0.85rem 1.5rem;
  background: var(--brown);
  color: var(--cream);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  transform: translateX(-50%) translateY(100px);
  opacity: 0;
  transition: transform 0.45s var(--ease), opacity 0.45s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Reveal */
.reveal {
  opacity: 1;
  transform: none;
}

.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}

.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 900px) {
  .about__grid,
  .checkout__grid,
  .quick-view {
    grid-template-columns: 1fr;
  }

  .checkout__summary {
    border-left: none;
    border-top: 1px solid var(--cream-dark);
  }

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

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

  .about__imgs img:first-child {
    grid-row: span 1;
    aspect-ratio: 16/10;
  }
}

@media (max-width: 768px) {
  .nav__links {
    position: fixed;
    top: var(--header-offset);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 1.25rem;
    padding: 2rem;
    background: rgba(250, 248, 245, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cream-dark);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s var(--ease), opacity 0.4s, visibility 0.4s;
  }

  .nav__links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav__menu {
    display: flex;
  }

  .search-wrap {
    display: none;
  }

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

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
