/* Three Rivers Coffee Co. — demo storefront for CartThrob AI */
:root {
  --ink: #2b1d16;
  --ink-soft: #5c4a3f;
  --muted: #7b6d63;
  --paper: #fbf7f2;
  --card: #ffffff;
  --line: #e8dfd5;
  --brand: #b5552b;
  --brand-dark: #8f3f1d;
  --gold: #f2a541;
  --river: #2f4858;
  --ok: #2e7d4f;
  --ok-bg: #e7f4ec;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --info-bg: #eef4f8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 29, 22, .06), 0 8px 24px rgba(43, 29, 22, .06);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-dark); }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code { font: .88em/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1e9e0; padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow .wrap, .narrow-inner { max-width: 820px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 700; color: var(--brand); margin-bottom: .6rem; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* Header */
.announce { background: var(--ink); color: #f5e9dc; text-align: center; font-size: .85rem; padding: 7px 16px; }
.announce a { color: var(--gold); }
.site-header { background: rgba(251, 247, 242, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 68px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 800; font-size: 1.2rem; }
.brand em { font-style: normal; color: var(--brand); }
.brand-mark { width: 34px; height: 34px; color: var(--brand); }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.main-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 6px 10px; border-radius: 8px; }
.main-nav a:hover, .main-nav a[aria-current] { background: #f1e6da; color: var(--ink); }
.cart-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 600; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.cart-link svg { width: 20px; height: 20px; }
.cart-count { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .8rem; display: inline-grid; place-items: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 1rem/1 var(--sans); padding: 13px 20px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: #cdbfb2; color: var(--ink); }
.btn-ghost:hover { background: #f1e6da; color: var(--ink); }
.btn-light { background: #fff; color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 22px; font-size: 1.05rem; }
.btn-sm { padding: 8px 12px; font-size: .9rem; }
.text-link { font-weight: 600; text-decoration: none; }

/* Sections */
.section { padding: 56px 0; }
.section-tight { padding-top: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head { padding: 44px 0 18px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.chip { text-decoration: none; color: var(--ink-soft); border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 999px; font-size: .92rem; font-weight: 500; }
.chip[aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); }
.breadcrumbs { padding-top: 24px; font-size: .9rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* Hero */
.hero { padding: 56px 0 24px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-art { position: relative; min-height: 420px; }
.hero-bag { position: absolute; width: 58%; border-radius: 24px; box-shadow: var(--shadow); }
.hero-bag-1 { left: 0; top: 40px; transform: rotate(-6deg); }
.hero-bag-2 { left: 22%; top: 0; z-index: 2; }
.hero-bag-3 { right: 0; top: 60px; transform: rotate(6deg); }

/* Product grid */
.product-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 22px; }
.product-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(43, 29, 22, .12); }
.product-card-link { color: inherit; text-decoration: none; display: block; height: 100%; }
.product-card-media { position: relative; background: #f3ece4; }
.badge { position: absolute; left: 12px; top: 12px; background: rgba(255,255,255,.92); color: var(--ink); font-size: .75rem; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.badge-muted { left: auto; right: 12px; background: var(--ink); color: #fff; }
.product-card-body { padding: 16px 18px 20px; }
.product-card-cat { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 4px; }
.product-card-desc { color: var(--ink-soft); font-size: .92rem; min-height: 3em; }
.price { font-weight: 700; color: var(--ink); margin: 0; }
.price-lg { font-size: 1.5rem; margin-bottom: 16px; }
.price-lg .muted { font-size: 1rem; font-weight: 400; }
.empty { color: var(--muted); }

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.product-media img { border-radius: 20px; border: 1px solid var(--line); background: #f3ece4; }
.prose { color: var(--ink-soft); }
.prose h2 { margin-top: 1.6em; font-size: 1.35rem; color: var(--ink); }
.buy-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 22px 0; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label, legend { font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], select {
  width: 100%; font: 1rem/1.3 var(--sans); padding: 11px 12px; border: 1px solid #cdbfb2; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus { border-color: var(--brand); outline: 3px solid rgba(242, 165, 65, .45); outline-offset: 0; }
.field-qty input { max-width: 120px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 18px; }
.facts div { background: #f5ede5; border-radius: 10px; padding: 10px 12px; }
.facts dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.facts-stack { grid-template-columns: 1fr; }
.agent-note { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; color: var(--ink-soft); background: var(--info-bg); border-radius: 10px; padding: 12px 14px; }
.agent-note svg { width: 18px; height: 18px; flex: none; color: var(--river); margin-top: 3px; }

/* Notices */
.notice { border-radius: 10px; padding: 12px 14px; font-size: .95rem; }
.notice-warn { background: #fff4e0; }
.notice-info { background: var(--info-bg); }
.ct-ai-handoff-notice { background: var(--ok-bg); border: 1px solid #b9dcc7; color: #1e5236; border-radius: var(--radius); padding: 14px 18px; margin: 0 0 20px; font-weight: 500; }
.ct-ai-handoff-notice::before { content: "✦ "; color: var(--ok); }

/* Cart */
.cart-layout, .checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.cart-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cart-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cart-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-table .num { text-align: right; white-space: nowrap; }
.cart-item { display: flex; gap: 12px; align-items: center; }
.cart-item img { width: 64px; height: 64px; border-radius: 10px; background: #f3ece4; }
.cart-item-title { font-weight: 600; color: var(--ink); text-decoration: none; display: block; }
.cart-item-opt { display: block; font-size: .85rem; color: var(--muted); }
.qty { max-width: 76px; }
.remove { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.cart-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; flex-wrap: wrap; }
.summary-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.summary-card h2 { font-size: 1.25rem; margin: 0; }
.totals { margin: 0; display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals dt { color: var(--ink-soft); }
.totals dd { margin: 0; font-weight: 600; }
.totals .discount dd { color: var(--ok); }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; font-size: 1.15rem; }
.totals .grand dt { color: var(--ink); font-weight: 700; }
.inline-form { display: grid; gap: 6px; }
.inline-row { display: flex; gap: 8px; }
.empty-state { text-align: center; background: var(--card); border: 1px dashed #cdbfb2; border-radius: var(--radius); padding: 56px 24px; }

/* Checkout */
.checkout-form { display: grid; gap: 18px; }
fieldset { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0; display: grid; gap: 14px; }
legend { padding: 0 6px; font-family: var(--serif); font-size: 1.15rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.checkout-review { background: #f5ede5; border-radius: var(--radius); padding: 18px 20px; }
.checkout-review h2 { font-size: 1.15rem; }
.shipping-options { padding: 0; border: 0; gap: 8px; background: none; }
.shipping-options legend { padding: 0; font-family: var(--sans); font-size: .92rem; font-weight: 600; }
.radio { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.radio span:nth-of-type(1) { flex: 1; }
.radio:has(input:checked) { border-color: var(--brand); background: #fff7ef; }
.mini-cart { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mini-cart li { display: flex; gap: 12px; align-items: center; }
.mini-cart img { width: 52px; height: 52px; border-radius: 8px; background: #f3ece4; }
.mini-cart li > div { flex: 1; display: grid; }
.mini-title { font-weight: 600; font-size: .95rem; }
.mini-price { font-weight: 600; }

/* Results & orders */
.result { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 36px; box-shadow: var(--shadow); }
.result-ok { border-top: 6px solid var(--ok); }
.result-bad { border-top: 6px solid var(--bad); }
.order-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 20px; }
.order-grid h2 { font-size: 1.05rem; margin-top: 4px; }
.order-grid address { font-style: normal; }
.status-pill { display: inline-block; background: var(--ok-bg); color: #1e5236; font-weight: 600; padding: 3px 10px; border-radius: 999px; font-size: .85rem; }

/* Agents */
.agent-callout { background: var(--river); color: #eef3f6; }
.agent-callout h2 { color: #fff; }
.agent-callout .eyebrow { color: var(--gold); }
.agent-callout code { background: rgba(255,255,255,.12); color: #fff; }
.callout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.steps { list-style: none; padding: 0; margin: 20px 0 26px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: center; }
.steps span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--ink); font-weight: 700; flex: none; }
.code-card { background: #1c2b35; border-radius: 16px; padding: 20px; overflow-x: auto; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.code-card pre { margin: 0; }
.code-card code { background: none; color: #d6e4ec; font-size: .85rem; padding: 0; }
.flow { list-style: none; counter-reset: flow; padding: 0; margin: 0 0 32px; display: grid; gap: 14px; }
.flow li { counter-increment: flow; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 6px 64px; position: relative; }
.flow li::before { content: counter(flow); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.flow h2 { font-size: 1.2rem; margin-bottom: .3em; }

/* Footer */
.site-footer { background: var(--ink); color: #d9cabd; margin-top: 40px; padding: 48px 0 20px; font-size: .92rem; }
.site-footer a { color: #f5e9dc; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.footer-brand { font-family: var(--serif); font-size: 1.3rem; color: #fff; }
.footer-heading { color: #fff; font-weight: 600; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer .muted { color: #a8978a; }
.footer-base { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.12); margin-top: 32px; padding-top: 16px; color: #a8978a; font-size: .85rem; }

/* CartThrob review panel & errors */
.checkout-form .error, .cartthrob-error, ul.errors { color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px 14px; }

@media (max-width: 900px) {
  .hero-grid, .product-detail, .callout-grid, .cart-layout, .checkout-layout, .order-grid { grid-template-columns: 1fr; }
  .hero-art { min-height: 300px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .main-nav a { white-space: nowrap; }
  .cart-link { margin-left: auto; }
  .grid-2, .grid-3, .facts { grid-template-columns: 1fr; }
  .cart-table thead { display: none; }
  .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; }
  .cart-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .cart-table td { border: 0; padding: 6px 14px; }
  .cart-table .num { text-align: left; }
  .section { padding: 40px 0; }
  .result { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.field-label { font-weight: 600; font-size: .92rem; }
.form-errors { list-style: none; margin: 0 0 20px; padding: 14px 18px; background: var(--bad-bg); border: 1px solid #f0c3bf; border-radius: var(--radius); color: #7d1a15; display: grid; gap: 6px; }
