:root {
  --juniper: #3F5B4A;
  --juniper-dark: #344C3D;
  --cream: #F7F1E6;
  --cream-deep: #EFE6D6;
  --honey: #C98B3A;
  --charcoal: #2E2A26;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif; overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }

.font-display { font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif; }

[hidden] { display: none !important; }
.hidden-el { display: none !important; }

:focus-visible { outline: 2px solid var(--honey); outline-offset: 3px; border-radius: 6px; }

/* Views */
.view { display: none; animation: fadeUp .45s ease both; }
.view.is-active { display: block; }

/* Nav */
.main-nav { display: none; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem;
  font-size: .95rem; font-weight: 500; color: var(--charcoal); border-radius: 999px;
  transition: background-color .15s, color .15s; background: none; border: 0; cursor: pointer;
}
.nav-link:hover { background: rgba(63, 91, 74, .08); color: var(--juniper); }
.nav-link.is-current { color: var(--juniper); background: rgba(63, 91, 74, .1); }
.user-chip { display: inline-flex; align-items: center; gap: .25rem; padding-left: .5rem; }

@media (min-width: 768px) {
  .main-nav { display: flex; align-items: center; gap: .25rem; }
}
@media (max-width: 767px) {
  .main-nav.is-open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--cream); border-bottom: 1px solid rgba(46, 42, 38, .1);
    padding: .5rem 1.25rem 1rem; box-shadow: 0 12px 24px rgba(46, 42, 38, .08);
  }
  .main-nav.is-open .user-chip { justify-content: space-between; padding: 0 .9rem; }
}

/* Cart badge */
.cart-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px;
  background: var(--honey); color: #fff; font-size: .75rem; font-weight: 700;
}
.cart-badge.bump { animation: bump .45s cubic-bezier(.3, 1.6, .5, 1); }

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .8rem 1.6rem; border-radius: 999px;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: background-color .2s, transform .15s, box-shadow .2s, color .2s;
}
.btn-primary { background: var(--juniper); color: var(--cream); border: 1px solid var(--juniper); }
.btn-primary:hover { background: var(--juniper-dark); box-shadow: 0 6px 18px rgba(63, 91, 74, .25); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: transparent; color: var(--juniper); border: 1px solid rgba(63, 91, 74, .4); }
.btn-secondary:hover { background: rgba(63, 91, 74, .07); }
.btn-add.is-added { background: var(--honey); border-color: var(--honey); color: #fff; }

.spinner { display: none; width: 1rem; height: 1rem; border: 2px solid rgba(247, 241, 230, .4); border-top-color: var(--cream); border-radius: 50%; animation: spin .7s linear infinite; }
.is-loading .spinner { display: inline-block; }

/* Hero */
.hero { background: radial-gradient(ellipse at 80% 20%, rgba(201, 139, 58, .14), transparent 55%), linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%); border-bottom: 1px solid rgba(46, 42, 38, .08); }
.flame { transform-origin: 160px 110px; animation: flicker 2.6s ease-in-out infinite; }

.placeholder-note {
  display: inline-flex; align-items: flex-start; gap: .5rem; max-width: 26rem;
  font-size: .875rem; line-height: 1.5rem; color: #6b4a1c;
  background: rgba(201, 139, 58, .12); border: 1px dashed rgba(201, 139, 58, .55);
  padding: .6rem .9rem; border-radius: .75rem;
}
.placeholder-note svg { flex-shrink: 0; margin-top: .25rem; }

/* Product card */
.product-card {
  background: #fffdf9; border: 1px solid rgba(46, 42, 38, .08); border-radius: 1.25rem;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .3s ease, box-shadow .3s ease;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 18px 36px -14px rgba(46, 42, 38, .25); }
.product-media { position: relative; aspect-ratio: 1 / 1; }
.product-media svg { width: 100%; height: 100%; display: block; }
.ph-badge {
  position: absolute; top: .75rem; left: .75rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(247, 241, 230, .92); color: var(--charcoal);
  border: 1px dashed rgba(46, 42, 38, .35); padding: .25rem .55rem; border-radius: 999px;
}
.ph-text { font-style: italic; color: rgba(46, 42, 38, .62); }

/* Steps */
.step-card { background: #fffdf9; border: 1px solid rgba(46, 42, 38, .08); border-radius: 1.25rem; padding: 1.75rem; }
.step-num { display: inline-flex; width: 2.25rem; height: 2.25rem; align-items: center; justify-content: center; border-radius: 50%; background: var(--juniper); color: var(--cream); font-weight: 700; margin-bottom: 1rem; }

/* Cards / forms */
.summary-card, .form-card, .empty-state, .order-card, .cart-line {
  background: #fffdf9; border: 1px solid rgba(46, 42, 38, .09); border-radius: 1.25rem;
}
.summary-card { padding: 1.5rem; }
@media (min-width: 1024px) { #view-cart .summary-card, #view-request .summary-card { position: sticky; top: 6.5rem; } }
.form-card { padding: 1.5rem; }
@media (min-width: 640px) { .form-card { padding: 2rem; } }
.empty-state { padding: 2.5rem 1.5rem; text-align: center; }
.order-card { padding: 1.5rem; }
.cart-line { padding: 1rem; display: grid; grid-template-columns: 72px 1fr; gap: 1rem; align-items: center; }
@media (min-width: 640px) { .cart-line { grid-template-columns: 88px 1fr auto; } }
.cart-thumb { width: 100%; aspect-ratio: 1/1; border-radius: .75rem; overflow: hidden; }
.cart-thumb svg { width: 100%; height: 100%; display: block; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.field label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .4rem; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--charcoal);
  background: #fff; border: 1px solid rgba(46, 42, 38, .2); border-radius: .75rem;
  padding: .75rem .9rem; min-height: 48px; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--juniper); box-shadow: 0 0 0 3px rgba(63, 91, 74, .18); }
.field input[aria-invalid="true"] { border-color: #b4412f; }
.field-err { font-size: .85rem; color: #b4412f; margin-top: .35rem; min-height: 0; }
.field-err:not(:empty)::before { content: "⚠ "; }
.req { color: #b4412f; }
.form-error {
  background: #fbeae6; color: #8a2f20; border: 1px solid #efc3b9; border-radius: .75rem;
  padding: .75rem 1rem; margin-bottom: 1rem; font-size: .95rem;
}
.form-error::before { content: "⚠ "; }

.notice {
  display: flex; gap: .9rem; padding: 1.1rem 1.25rem; border-radius: 1rem;
  background: rgba(63, 91, 74, .08); border: 1px solid rgba(63, 91, 74, .25); color: var(--charcoal);
}
.notice svg { color: var(--juniper); }

.qty { display: inline-flex; align-items: center; border: 1px solid rgba(46, 42, 38, .2); border-radius: 999px; overflow: hidden; background: #fff; }
.qty button { width: 40px; height: 40px; font-size: 1.15rem; background: none; border: 0; cursor: pointer; color: var(--charcoal); transition: background-color .15s; }
.qty button:hover { background: rgba(63, 91, 74, .08); }
.qty input { width: 2.75rem; height: 40px; text-align: center; border: 0; font: inherit; font-weight: 600; background: transparent; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.link-remove { font-size: .875rem; color: #8a2f20; background: none; border: 0; cursor: pointer; padding: .5rem; min-height: 40px; border-radius: .5rem; }
.link-remove:hover { text-decoration: underline; background: rgba(180, 65, 47, .06); }

/* Tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--cream-deep); border-radius: 999px; padding: .3rem; }
.tab { min-height: 44px; border-radius: 999px; border: 0; background: none; font-weight: 600; cursor: pointer; color: rgba(46, 42, 38, .7); transition: background-color .2s, color .2s; }
.tab:hover { color: var(--juniper); }
.tab.is-active { background: #fffdf9; color: var(--juniper); box-shadow: 0 2px 6px rgba(46, 42, 38, .08); }

/* Skeleton */
.skeleton { border-radius: 1.25rem; background: linear-gradient(90deg, #eee5d4 25%, #f6efe2 50%, #eee5d4 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

/* Confirmation */
.confirm-glow { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 14px rgba(63, 91, 74, .08), 0 0 0 28px rgba(201, 139, 58, .07); animation: softPop .7s ease both; }
.check-path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw .6s .35s ease forwards; }

/* Status pill */
.status-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .25rem .65rem; border-radius: 999px; background: rgba(201, 139, 58, .15); color: #6b4a1c; }

.status-pill.is-confirmed { background: rgba(63, 91, 74, .14); color: var(--juniper-dark); }
.status-pill.is-shipped { background: var(--juniper); color: var(--cream); }

/* Free-shipping note */
.ship-note {
  display: flex; align-items: flex-start; gap: .5rem; margin-top: 1rem;
  font-size: .9rem; line-height: 1.4rem; padding: .7rem .9rem; border-radius: .75rem;
  background: rgba(201, 139, 58, .12); border: 1px dashed rgba(201, 139, 58, .55); color: #6b4a1c;
}
.ship-note.is-free { background: rgba(63, 91, 74, .1); border: 1px solid rgba(63, 91, 74, .3); color: var(--juniper-dark); }
.ship-note:empty { display: none; }

/* Order number on confirmation */
.order-number {
  display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: center;
  padding: .6rem 1.1rem; border-radius: 999px; background: #fffdf9;
  border: 1px solid rgba(46, 42, 38, .12); font-size: .95rem; color: rgba(46, 42, 38, .75);
}
.order-number strong { font-size: 1.1rem; color: var(--charcoal); letter-spacing: .04em; }

/* Owner orders */
.owner-meta { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
@media (min-width: 768px) { .owner-meta { grid-template-columns: 1fr 1fr; } }
.owner-meta h3 { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(46, 42, 38, .6); }
.owner-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid rgba(46, 42, 38, .1); }
.btn-status {
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; cursor: pointer;
  background: transparent; color: var(--juniper); border: 1px solid rgba(63, 91, 74, .4);
  transition: background-color .15s, color .15s;
}
.btn-status:hover { background: rgba(63, 91, 74, .08); }
.btn-status[aria-pressed="true"] { background: var(--juniper); color: var(--cream); border-color: var(--juniper); }
.btn-status:disabled { opacity: .55; cursor: not-allowed; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem);
  background: var(--charcoal); color: var(--cream); padding: .8rem 1.2rem; border-radius: 999px;
  font-size: .95rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60;
  max-width: calc(100vw - 2rem); text-align: center;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #8a2f20; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes flicker { 0%, 100% { transform: scale(1, 1) rotate(0); } 30% { transform: scale(.96, 1.04) rotate(-2deg); } 60% { transform: scale(1.03, .97) rotate(1.5deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes softPop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .check-path { stroke-dashoffset: 0; }
  .product-card:hover { transform: none; }
}
