:root {
  --paper: #f7f1e3;
  --paper-dark: #efe6cf;
  --ink: #2e2419;
  --ink-soft: #5c4a36;
  --coffee: #6b4226;
  --coffee-light: #8a5a37;
  --highlighter: #f2c14e;
  --tape: #e8d4a8;
  --stain: #c9a063;
  --font-hand: "Caveat", cursive;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  background-image:
    radial-gradient(circle at 8% 18%, rgba(107,66,38,0.05) 0, transparent 9%),
    radial-gradient(circle at 92% 75%, rgba(107,66,38,0.05) 0, transparent 9%);
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Navbar ---------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 6%;
  background: var(--paper);
  border-bottom: 2px dashed var(--coffee);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 700;
  color: var(--coffee);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: rotate(-2deg);
}
.logo .seal {
  width: 34px; height: 34px;
  border: 2px solid var(--coffee);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--coffee);
  transform: rotate(8deg);
}

.nav-links { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--coffee); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 6px;
  background: var(--highlighter);
  opacity: 0.6;
  z-index: -1;
}

.nav-icons { display: flex; gap: 16px; align-items: center; font-size: 0.95rem; }
.lang-tag { font-size: 0.8rem; color: var(--ink-soft); }

.signin-btn {
  border: 2px solid var(--coffee);
  border-radius: 30px 4px 30px 4px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--coffee);
}
.signin-btn:hover { background: var(--coffee); color: var(--paper); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 30px;
  padding: 80px 6% 70px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 14%; right: 8%;
  width: 220px; height: 220px;
  border: 18px solid var(--stain);
  border-radius: 50%;
  opacity: 0.18;
  pointer-events: none;
}

.hero-stamp {
  position: absolute;
  top: 28px; right: 6%;
  width: 90px; height: 90px;
  border: 2px dashed var(--coffee);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: var(--coffee);
  transform: rotate(8deg);
  line-height: 1.3;
}
.hero-stamp strong { font-size: 1.3rem; display: block; }

.hero-text { max-width: 480px; position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--font-hand);
  color: var(--coffee);
  font-weight: 700;
  font-size: 1.3rem;
  transform: rotate(-2deg);
  display: inline-block;
}

.hero h1 {
  font-family: var(--font-body);
  font-size: 2.7rem;
  line-height: 1.1;
  margin: 12px 0 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.hero h1 em {
  font-style: normal;
  font-family: var(--font-hand);
  color: var(--coffee);
  background: linear-gradient(180deg, transparent 60%, var(--highlighter) 60%);
  padding: 0 4px;
}

.hero p { color: var(--ink-soft); margin-bottom: 26px; font-size: 1rem; max-width: 400px; }

.steam {
  position: absolute;
  width: 3px;
  background: rgba(107,66,38,0.2);
  border-radius: 3px;
  filter: blur(2px);
  animation: rise 4s ease-in-out infinite;
}
@keyframes rise {
  0% { opacity: 0; transform: translateY(0) scaleY(0.6); }
  30% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-70px) scaleY(1.3); }
}
@media (prefers-reduced-motion: reduce) { .steam { animation: none; opacity: 0; } }

.hero-cups { display: flex; align-items: flex-end; justify-content: center; position: relative; z-index: 1; }

.cup {
  width: 120px;
  border-radius: 6px 6px 40px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  color: var(--paper);
  font-family: var(--font-hand);
  font-weight: 700;
  padding-bottom: 18px;
  box-shadow: 4px 8px 0 rgba(46,36,25,0.15);
  position: relative;
}
.cup::before {
  content: "";
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 88%; height: 18px;
  background: var(--ink);
  border-radius: 8px;
}
.cup .label-small { font-family: var(--font-body); font-size: 0.6rem; font-weight: 600; letter-spacing: 1px; opacity: 0.85; margin-bottom: 4px; text-transform: uppercase; }
.cup .label-main { font-size: 1.4rem; }

.cup.short { height: 150px; transform: rotate(-3deg); }
.cup.tall { height: 200px; margin-left: -18px; z-index: 2; }
.cup.med { height: 175px; margin-left: -18px; transform: rotate(3deg); }

.cup-red { background: #a4452a; }
.cup-gold { background: var(--coffee-light); }
.cup-dark { background: #382414; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--coffee);
  color: var(--paper);
  padding: 13px 28px;
  border-radius: 30px 6px 30px 6px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}
.btn:hover { background: var(--ink); transform: rotate(-1deg) translateY(-1px); }

/* ---------- Sections ---------- */
.section { padding: 70px 6%; position: relative; }
.section .kicker {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: var(--coffee);
  margin-bottom: 4px;
  display: inline-block;
  transform: rotate(-2deg);
}
.section h2 { font-family: var(--font-body); font-size: 2rem; margin: 0 0 8px; font-weight: 700; }
.section .lead { color: var(--ink-soft); margin-bottom: 40px; max-width: 520px; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 30px; }

.card {
  background: var(--paper-dark);
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s;
}
.card:nth-child(odd) { transform: rotate(-1deg); }
.card:nth-child(even) { transform: rotate(1deg); }
.card:hover { transform: scale(1.03) rotate(0deg); }

.card::before {
  content: "";
  position: absolute;
  top: -8px; left: 16px;
  width: 50px; height: 18px;
  background: var(--tape);
  opacity: 0.85;
  transform: rotate(-4deg);
  z-index: 2;
}

.card-img { height: 140px; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; background: var(--paper); border-bottom: 2px dashed var(--ink); }
.card-body { padding: 18px 20px 22px; }
.card-body .lot { font-family: var(--font-hand); font-size: 1rem; color: var(--coffee); }
.card-body h3 { margin: 4px 0 4px; font-family: var(--font-body); font-size: 1.1rem; font-weight: 700; }
.card-body .price { color: var(--coffee); font-weight: 700; margin: 4px 0 14px; font-size: 0.95rem; }
.card-body .btn { width: 100%; text-align: center; }

/* ---------- Footer ---------- */
footer {
  background: var(--paper-dark);
  color: var(--ink);
  padding: 50px 6% 36px;
  text-align: center;
  font-size: 0.9rem;
  border-top: 2px dashed var(--coffee);
}
footer .footer-brand { font-family: var(--font-hand); font-size: 1.8rem; margin-bottom: 10px; color: var(--coffee); }
footer .footer-links { margin-top: 14px; display: flex; gap: 22px; justify-content: center; font-size: 0.82rem; }
footer .footer-links a:hover { color: var(--coffee); }

/* ---------- Forms ---------- */
.form-box {
  max-width: 480px; margin: 0 auto;
  background: var(--paper-dark);
  padding: 36px;
  border-radius: 4px;
  border: 2px solid var(--ink);
}
.form-box label { display: block; font-family: var(--font-hand); font-size: 1.1rem; margin: 14px 0 4px; color: var(--coffee); }
.form-box input, .form-box textarea {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  font-family: var(--font-body); font-size: 0.95rem;
  background: var(--paper);
}
.form-box textarea { resize: vertical; min-height: 100px; }
.form-box .btn { margin-top: 22px; width: 100%; }

/* ---------- Cart ---------- */
.cart-row { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; border-bottom: 2px dashed var(--ink); }
.cart-row .cart-info { display: flex; align-items: center; gap: 16px; }
.cart-emoji { font-size: 2rem; }
.qty-controls { display: flex; align-items: center; gap: 10px; }
.qty-controls button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--coffee); background: none; cursor: pointer; font-size: 1rem; color: var(--coffee); }
.cart-total { display: flex; justify-content: space-between; font-family: var(--font-hand); font-size: 1.6rem; font-weight: 700; padding-top: 24px; color: var(--coffee); }
.remove-link { color: var(--coffee); font-size: 0.8rem; cursor: pointer; text-decoration: underline; }

/* ---------- About ---------- */
.about-hero { background: var(--paper-dark); padding: 80px 6% 60px; text-align: center; border-bottom: 2px dashed var(--coffee); }
.about-hero h1 { font-family: var(--font-hand); font-size: 3.2rem; color: var(--coffee); margin: 8px 0; }
.values { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 28px; }
.value-card { text-align: center; padding: 22px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-dark); }
.value-card:nth-child(2) { transform: rotate(1deg); }
.value-card .icon { font-size: 2rem; margin-bottom: 10px; }
.value-card h3 { font-family: var(--font-body); font-weight: 700; margin: 0 0 6px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 70px 6% 40px; text-align: center; }
  .hero-text { margin: 0 auto; }
  .hero-cups { margin-top: 26px; }
  .hero h1 { font-size: 2.1rem; }
  .nav-links { display: none; }
}

/* ---------- AI Chat Widget ---------- */
.ai-fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--coffee); color: var(--paper);
  font-size: 1.4rem; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 4px 6px 0 rgba(46,36,25,0.25); z-index: 100; border: 2px solid var(--ink);
}
.ai-fab:hover { background: var(--ink); }

#ai-chat-panel {
  position: fixed; bottom: 96px; right: 24px;
  width: 320px; max-height: 440px;
  background: var(--paper); border-radius: 6px;
  border: 2px solid var(--ink);
  box-shadow: 4px 8px 0 rgba(46,36,25,0.2);
  display: none; flex-direction: column; overflow: hidden; z-index: 100;
}
#ai-chat-panel.open { display: flex; }

.ai-chat-header { background: var(--coffee); color: var(--paper); padding: 12px 16px; font-family: var(--font-hand); font-size: 1.2rem; display: flex; justify-content: space-between; align-items: center; }
.ai-chat-header span.close { cursor: pointer; font-size: 1.1rem; }

#ai-chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

.ai-bubble { padding: 9px 13px; border-radius: 10px; font-size: 0.86rem; max-width: 85%; line-height: 1.4; border: 1.5px solid var(--ink); }
.ai-bubble.assistant { background: var(--paper-dark); align-self: flex-start; }
.ai-bubble.user { background: var(--coffee); color: var(--paper); align-self: flex-end; border-color: var(--coffee); }

.ai-chat-inputrow { display: flex; border-top: 2px dashed var(--ink); padding: 10px; gap: 8px; }
.ai-chat-inputrow input { flex: 1; border: 2px solid var(--ink); border-radius: 6px; padding: 8px 12px; font-family: var(--font-body); font-size: 0.86rem; background: var(--paper); }
.ai-chat-inputrow button { background: var(--coffee); color: var(--paper); border: 2px solid var(--ink); border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: 700; font-size: 0.8rem; }

/* ---------- Signature cup page transition ---------- */
@view-transition { navigation: auto; }

.signature-cup { view-transition-name: signature-cup; position: relative; z-index: 50; }
.signature-cup.mini { width: 64px; }
.signature-cup.mini .cup { width: 64px; height: 84px; margin: 0; border-radius: 4px 4px 22px 22px; padding-bottom: 0; transform: none; }
.signature-cup.mini .cup::before { height: 10px; top: -7px; }

::view-transition-old(signature-cup), ::view-transition-new(signature-cup) {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.cup-slot-topright { position: fixed; top: 90px; right: 6%; }
.cup-slot-hero { position: relative; margin-left: 24px; }
.cup-slot-corner { position: fixed; bottom: 100px; left: 24px; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

.grid.reveal-group .card {
  opacity: 0;
  transform: translateY(20px) rotate(0deg) !important;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.grid.reveal-group.visible .card {
  opacity: 1;
}
.grid.reveal-group.visible .card:nth-child(1) { transition-delay: 0.05s; }
.grid.reveal-group.visible .card:nth-child(2) { transition-delay: 0.15s; }
.grid.reveal-group.visible .card:nth-child(3) { transition-delay: 0.25s; }
.grid.reveal-group.visible .card:nth-child(4) { transition-delay: 0.35s; }
.grid.reveal-group.visible .card:nth-child(5) { transition-delay: 0.45s; }
.grid.reveal-group.visible .card:nth-child(6) { transition-delay: 0.55s; }
.grid.reveal-group.visible .card:nth-child(odd) { transform: rotate(-1deg); }
.grid.reveal-group.visible .card:nth-child(even) { transform: rotate(1deg); }

/* ---------- Floating coffee beans ---------- */
.bean-field {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.bean {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0.12;
  animation: drift 16s linear infinite;
}
@keyframes drift {
  0% { transform: translateY(110vh) rotate(0deg); }
  100% { transform: translateY(-10vh) rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) { .bean { animation: none; display: none; } }

/* ---------- Pour animation ---------- */
.pour-wrap { position: relative; }
.pour-stream {
  position: absolute;
  top: -40px; left: 50%;
  width: 4px; height: 0;
  background: linear-gradient(180deg, #6b4226, #3a2414);
  border-radius: 2px;
  animation: pour 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes pour {
  0%, 15% { height: 0; opacity: 0; }
  25% { height: 40px; opacity: 1; }
  70% { height: 40px; opacity: 1; }
  85%, 100% { height: 0; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .pour-stream { animation: none; display: none; } }

/* ---------- Card hover lift ---------- */
.card { will-change: transform; }
.card:hover { box-shadow: 6px 10px 0 rgba(46,36,25,0.18); }

/* ---------- Underline draw on hover ---------- */
.nav-links a {
  background-image: linear-gradient(var(--coffee), var(--coffee));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease, color 0.2s;
  padding-bottom: 4px;
}
.nav-links a:hover { background-size: 100% 2px; }

/* ---------- Hero entrance ---------- */
.hero-text > * { opacity: 0; transform: translateY(16px); animation: heroIn 0.7s ease forwards; }
.hero-text .eyebrow { animation-delay: 0.05s; }
.hero-text h1 { animation-delay: 0.15s; }
.hero-text p { animation-delay: 0.28s; }
.hero-text .btn { animation-delay: 0.4s; }
@keyframes heroIn { to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .hero-text > * { animation: none; opacity: 1; transform: none; } }

.hero-cups .cup { animation: cupIn 0.6s ease backwards; }
.hero-cups .cup.short { animation-delay: 0.3s; }
.hero-cups .signature-cup .cup { animation-delay: 0.45s; }
.hero-cups .cup.med { animation-delay: 0.6s; }
@keyframes cupIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .hero-cups .cup { animation: none; } }

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  width: 0%;
  background: var(--coffee);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ---------- Cursor bean trail ---------- */
.cursor-bean {
  position: fixed;
  pointer-events: none;
  font-size: 1rem;
  z-index: 150;
  opacity: 0.8;
  animation: beanFade 0.9s ease forwards;
}
@keyframes beanFade {
  0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(0.4) rotate(120deg) translateY(20px); opacity: 0; }
}

/* ---------- Marquee ticker ---------- */
.ticker {
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  white-space: nowrap;
  padding: 10px 0;
  position: relative;
}
.ticker-track {
  display: inline-flex;
  gap: 40px;
  animation: tickerScroll 22s linear infinite;
}
.ticker-track span {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* ---------- Stats counters ---------- */
.stats-row {
  display: flex;
  gap: 50px;
  justify-content: center;
  padding: 50px 6%;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat .num {
  font-family: var(--font-hand);
  font-size: 2.6rem;
  color: var(--coffee);
  display: block;
}
.stat .label { font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- Parallax hero cups ---------- */
.hero-cups { transition: transform 0.05s linear; }
