/* ============================================================
   Northwind Coffee Roasters — demo site + AI support widget
   ============================================================ */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #2b2420;
  --ink-soft: #6b5f57;
  --brand: #7a4a2b;
  --brand-dark: #5c3720;
  --brand-light: #c98a5e;
  --accent: #e7b58a;
  --line: #ece4da;
  --shadow: 0 10px 40px rgba(64, 41, 24, 0.12);
  --shadow-sm: 0 4px 16px rgba(64, 41, 24, 0.10);
  --radius: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: min(1120px, 92vw); margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--brand); color: #fff; border: none;
  padding: .8rem 1.5rem; border-radius: 999px; font-weight: 600;
  font-size: .98rem; cursor: pointer; transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--brand-dark); transform: translateY(-2px); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--brand); box-shadow: none; border: 1.5px solid var(--line); }
.btn--ghost:hover { background: #fff; color: var(--brand-dark); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(10px);
  background: rgba(250, 247, 242, 0.82);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-weight: 600; font-size: 1.25rem; color: var(--ink); }
.brand .bean { font-size: 1.4rem; }
.nav-links { display: flex; gap: 1.6rem; align-items: center; }
.nav-links a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.nav-links a:hover { color: var(--brand); text-decoration: none; }
@media (max-width: 720px) { .nav-links a:not(.btn) { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: 5rem 0 4rem; position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-light);
  background: #fff; padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.2rem; box-shadow: var(--shadow-sm);
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
.hero p.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 34ch; margin: 1rem 0 2rem; }
.hero-cta { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero-art {
  aspect-ratio: 4/5; border-radius: 24px;
  background:
    radial-gradient(120% 120% at 20% 10%, #e7b58a 0%, rgba(231,181,138,0) 55%),
    linear-gradient(160deg, #8a5735, #4a2c19);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: flex; align-items: flex-end; padding: 1.8rem;
}
.hero-art .emoji { position: absolute; font-size: 8rem; top: 50%; left: 50%; transform: translate(-50%, -55%); filter: drop-shadow(0 12px 24px rgba(0,0,0,.25)); }
.hero-art .card {
  background: rgba(255,255,255,.92); border-radius: 14px; padding: 1rem 1.2rem;
  backdrop-filter: blur(6px); box-shadow: var(--shadow-sm); position: relative; z-index: 2;
}
.hero-art .card strong { display: block; font-family: var(--serif); }
.hero-art .card span { color: var(--ink-soft); font-size: .9rem; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } .hero-art { order: -1; aspect-ratio: 16/10; } }

/* ---------- Stats strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; padding: 0 0 4rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; text-align: center; }
.stat .num { font-family: var(--serif); font-size: 1.8rem; color: var(--brand); }
.stat .label { color: var(--ink-soft); font-size: .9rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Sections ---------- */
section { padding: 4rem 0; }
.section-head { text-align: center; max-width: 40rem; margin: 0 auto 2.6rem; }
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
.section-head p { color: var(--ink-soft); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.card-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.8rem; transition: transform .2s ease, box-shadow .2s ease;
}
.card-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card-item .ico { font-size: 2rem; margin-bottom: .6rem; }
.card-item h3 { font-size: 1.25rem; }
.card-item p { color: var(--ink-soft); margin: 0; font-size: .96rem; }
@media (max-width: 860px) { .cards { grid-template-columns: 1fr; } }

/* ---------- Product row ---------- */
.products { background: linear-gradient(180deg, #fff, var(--bg)); }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.product:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product .thumb { height: 150px; display: grid; place-items: center; font-size: 3.4rem; }
.product .thumb.t1 { background: linear-gradient(160deg, #f0d3b6, #d99a66); }
.product .thumb.t2 { background: linear-gradient(160deg, #d9b48a, #a86a3d); }
.product .thumb.t3 { background: linear-gradient(160deg, #b0855f, #5c3720); }
.product .body { padding: 1.2rem 1.3rem 1.5rem; }
.product h3 { font-size: 1.15rem; margin-bottom: .2rem; }
.product .origin { color: var(--ink-soft); font-size: .88rem; }
.product .row { display: flex; align-items: center; justify-content: space-between; margin-top: 1rem; }
.product .price { font-family: var(--serif); font-size: 1.25rem; color: var(--brand); }
@media (max-width: 860px) { .product-grid { grid-template-columns: 1fr; } }

/* ---------- Callout / demo note ---------- */
.callout {
  background: var(--brand); color: #fff; border-radius: 24px; padding: 3rem;
  text-align: center; box-shadow: var(--shadow);
}
.callout h2 { color: #fff; }
.callout p { color: #f4e6d9; max-width: 46ch; margin: .5rem auto 1.5rem; }
.callout .btn { background: #fff; color: var(--brand-dark); }
.callout .btn:hover { background: var(--accent); }

.demo-banner {
  background: #fff8ee; border: 1px dashed var(--brand-light); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1.5rem auto 0; max-width: 52rem; text-align: center;
  color: var(--ink-soft); font-size: .92rem;
}
.demo-banner strong { color: var(--brand-dark); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; color: var(--ink-soft); font-size: .9rem; }
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; align-items: center; }

/* ============================================================
   CHAT WIDGET
   ============================================================ */
#chat-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 100;
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--brand); color: #fff; box-shadow: 0 8px 28px rgba(90, 52, 28, 0.4);
  display: grid; place-items: center; transition: transform .18s ease, background .2s ease;
  animation: pop-in .4s ease both;
}
#chat-launcher:hover { transform: scale(1.06); background: var(--brand-dark); }
#chat-launcher.hidden { transform: scale(0); opacity: 0; pointer-events: none; }
#chat-launcher svg { width: 28px; height: 28px; }
#chat-launcher .badge {
  position: absolute; top: -2px; right: -2px; width: 18px; height: 18px; border-radius: 50%;
  background: #e5484d; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg);
}

@keyframes pop-in { from { transform: scale(0); } to { transform: scale(1); } }

#chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 101;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 48px));
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(20px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
  border: 1px solid var(--line);
}
#chat-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }

.chat-header {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; padding: 1.1rem 1.2rem; display: flex; align-items: center; gap: .8rem;
}
.chat-header .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0;
}
.chat-header .meta { flex: 1; min-width: 0; }
.chat-header .meta strong { display: block; font-size: 1rem; }
.chat-header .meta .status { font-size: .8rem; color: #f0dcc9; display: flex; align-items: center; gap: .4rem; }
.chat-header .status .dot { width: 8px; height: 8px; border-radius: 50%; background: #57c98a; box-shadow: 0 0 0 3px rgba(87,201,138,.3); }
.chat-header button {
  background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px;
  border-radius: 8px; cursor: pointer; font-size: 1.1rem; line-height: 1; transition: background .15s ease;
}
.chat-header button:hover { background: rgba(255,255,255,.28); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem;
  background: linear-gradient(180deg, #fdfaf6, #faf7f2);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.msg { display: flex; animation: rise .25s ease both; }
.msg--user { justify-content: flex-end; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.bubble {
  max-width: 82%; padding: .7rem .95rem; border-radius: 16px; font-size: .95rem; line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.msg--bot .bubble { background: #fff; color: var(--ink); border-bottom-left-radius: 5px; border: 1px solid var(--line); }
.msg--user .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.bubble strong { font-weight: 700; }
.bubble a { color: inherit; text-decoration: underline; }

.typing { display: flex; gap: 4px; align-items: center; padding: .85rem 1rem; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-light); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1.1rem .3rem; }
.chip {
  background: #fff; border: 1.5px solid var(--line); color: var(--brand-dark);
  padding: .45rem .8rem; border-radius: 999px; font-size: .83rem; cursor: pointer; font-weight: 500;
  transition: all .15s ease; font-family: var(--font);
}
.chip:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

.chat-form {
  display: flex; gap: .5rem; padding: .9rem 1.1rem 1.1rem; border-top: 1px solid var(--line); background: #fff;
}
.chat-form input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 999px; padding: .7rem 1rem;
  font-size: .95rem; font-family: var(--font); outline: none; transition: border-color .15s ease;
  color: var(--ink);
}
.chat-form input:focus { border-color: var(--brand-light); }
.chat-form button {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--brand); color: #fff;
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0; transition: background .15s ease, transform .15s ease;
}
.chat-form button:hover { background: var(--brand-dark); transform: scale(1.05); }
.chat-form button svg { width: 20px; height: 20px; }

.chat-footer-note { text-align: center; font-size: .72rem; color: var(--ink-soft); padding: 0 0 .7rem; background: #fff; }

@media (max-width: 480px) {
  #chat-panel { right: 8px; bottom: 8px; height: calc(100vh - 16px); width: calc(100vw - 16px); }
  #chat-launcher { right: 16px; bottom: 16px; }
}
