:root {
  /* --- Color tokens --- */
  --ink: #1C1A17;          /* dark ink background */
  --ink-soft: #2A2723;     /* raised surface on dark */
  --ink-line: #3a342c;     /* hairline on dark */
  --parchment: #F3ECDC;    /* warm parchment background */
  --parchment-soft: #EAE0CC;
  --parchment-line: #d8cbae;
  --terracotta: #C1623D;   /* primary accent — CTA, custom */
  --terracotta-dark: #a14e30;
  --dusty: #6E7B8B;        /* secondary accent — links, badges */
  --gold: #B79556;         /* metallic hairline accent */
  --ok: #5c7a5e;
  --error: #b3492f;

  /* --- Type tokens --- */
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  /* --- Layout tokens --- */
  --maxw: 1180px;
  --radius: 2px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
}

/* --- Reset --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

ul { list-style: none; }

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

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

:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--terracotta);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); }
h3 { font-size: 1.3rem; }

p { color: inherit; }

.lede {
  font-size: 1.08rem;
  color: #534c41;
  max-width: 38em;
}

/* --- Stitch line: signature divider, looks like a sewn seam --- */
.stitch {
  border: none;
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    var(--gold) 0,
    var(--gold) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.6;
}
.stitch--dark {
  background-image: repeating-linear-gradient(
    to right,
    var(--ink-line) 0,
    var(--ink-line) 6px,
    transparent 6px,
    transparent 12px
  );
}

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--parchment);
  border-bottom: 1px solid var(--parchment-line);
}

.nav__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.logo-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.95;
  flex-shrink: 0;
}
.logo-mark::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid currentColor;
  opacity: 0.92;
}
.logo-mark::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.nav__brand .sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--dusty);
  margin-top: -2px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav__links a {
  font-size: 0.92rem;
  position: relative;
  padding-bottom: 4px;
}

.nav__links a.is-active,
.nav__links a:hover {
  color: var(--terracotta);
}
.nav__links a.is-active {
  font-weight: 600;
}

.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--terracotta);
  border-radius: 2px;
}

.nav__cart {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border: 1px solid var(--ink);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
}

.nav__cart:hover { background: var(--ink); color: var(--parchment); }

.nav__cart-count {
  background: var(--terracotta);
  color: var(--parchment);
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 26px;
}
.nav__toggle span { height: 1.4px; background: var(--ink); display: block; }

@media (max-width: 860px) {
  .nav__links {
    position: absolute;
    top: 76px; left: 0; right: 0;
    background: var(--parchment);
    border-bottom: 1px solid var(--parchment-line);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-3);
    display: none;
  }
  .nav__links.is-open { display: flex; }
  .nav__toggle { display: flex; }
}

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

.nav__mobile-auth {
  display: none;
}

@media (max-width: 860px) {
  .nav__actions {
    gap: 0.5rem;
  }
  .nav__actions > a:not(.nav__cart),
  .nav__actions > form {
    display: none;
  }
  .nav__cart {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .nav__mobile-auth {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
    border-top: 1px solid var(--parchment-line);
    padding-top: var(--space-2);
    margin-top: var(--space-2);
  }
  .nav__mobile-auth a, .nav__mobile-auth button {
    font-size: 0.92rem;
    position: relative;
    padding-bottom: 4px;
    font-family: inherit;
    color: var(--ink);
  }
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.95rem 1.6rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }

.btn--primary { background: var(--terracotta); color: var(--parchment); }
.btn--primary:hover { background: var(--terracotta-dark); }

.btn--dark { background: var(--ink); color: var(--parchment); }
.btn--dark:hover { background: #000; }

.btn--ghost { border-color: var(--ink); color: var(--ink); }
.btn--ghost:hover { background: var(--ink); color: var(--parchment); }

.btn--ghost-light { border-color: rgba(243,236,220,0.5); color: var(--parchment); }
.btn--ghost-light:hover { background: var(--parchment); color: var(--ink); }

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

.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--sm { padding: 0.6rem 1rem; font-size: 0.7rem; }

/* =========================================================
   BADGES / TAGS
   ========================================================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--dusty);
  color: var(--dusty);
}
.tag--custom { border-color: var(--terracotta); color: var(--terracotta); }
.tag--ink { background: var(--ink); color: var(--parchment); border-color: var(--ink); }

/* =========================================================
   SECTION HELPERS
   ========================================================= */
.section { padding: var(--space-6) 0; }
.section--ink { background: var(--ink); color: var(--parchment); }
.section--soft { background: var(--parchment-soft); }

.section__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

/* =========================================================
   FLOATING CHAT BUTTON
   ========================================================= */
.chat-float {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--terracotta);
  color: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(28,26,23,0.35);
  z-index: 80;
  transition: transform 0.18s ease;
}
.chat-float:hover { transform: scale(1.07); }
.chat-float__icon {
  font-size: 1.7rem;
  line-height: 1;
  font-style: normal;
  transform: translateY(-1px);
}

.chat-float__ping {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--terracotta);
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  background: var(--ink);
  color: var(--parchment);
  padding: var(--space-5) 0 var(--space-3);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: var(--space-2);
}

.footer__tagline {
  color: #b9b2a4;
  max-width: 26em;
  font-size: 0.92rem;
}

.footer h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.footer li { margin-bottom: 0.5rem; font-size: 0.9rem; color: #d9d2c4; }
.footer li a:hover { color: var(--terracotta); }

.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--ink-line);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #8b8478;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty {
  text-align: center;
  padding: var(--space-6) var(--space-2);
  border: 1px dashed var(--parchment-line);
  border-radius: var(--radius);
}
.empty p { color: #6b6356; margin: var(--space-1) 0 var(--space-3); }

/* =========================================================
   TOAST
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 90;
  border-left: 3px solid var(--terracotta);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
