/* ===== Bean Miles — design system ===== */

:root {
  --espresso: #171210;
  --roast: #211a15;
  --crema: #f6f0e4;
  --paper: #fdfaf3;
  --ink: #2b211a;
  --muted: #8d7c6d;
  --line: #e4d9c6;
  --caramel: #c98a4b;
  --gold: #edc46f;
  --leg1: #e07a4f;
  --leg2: #6fb3d8;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--espresso);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0 0 .4em; }
a { color: var(--caramel); }

/* ---- scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.on { opacity: 1; transform: none; }

/* ---- nav ---- */
#topnav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--espresso) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
#topnav .wordmark { font-family: var(--serif); font-weight: 900; letter-spacing: .18em; color: var(--gold); font-size: 14px; }
#topnav .navlinks a {
  color: #cbb9a5; text-decoration: none; font-size: 13px; margin-left: 22px;
  letter-spacing: .04em; transition: color .2s;
}
#topnav .navlinks a:hover { color: var(--gold); }
#topnav .navhome { display: flex; align-items: baseline; gap: 18px; }
#topnav .back-home {
  color: #cbb9a5; text-decoration: none; font-size: 13px;
  letter-spacing: .04em; transition: color .2s;
}
#topnav .back-home:hover { color: var(--gold); }
#topnav .navlinks a.track-link {
  color: var(--caramel); border: 1px solid rgba(201,138,75,.5);
  border-radius: 999px; padding: 5px 12px; transition: background .2s, color .2s;
}
#topnav .navlinks a.track-link:hover { background: var(--caramel); color: var(--espresso); }
@media (max-width: 860px) { #topnav .navlinks a:not(.track-link) { display: none; } }
@media (max-width: 560px) { #topnav .navlinks a.track-link { display: none; } }

/* ---- hero ---- */
.hero {
  min-height: 92vh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; padding: 120px 24px 60px;
  color: var(--crema);
  background:
    radial-gradient(ellipse 70% 45% at 50% 62%, rgba(201,138,75,.16), transparent 65%),
    radial-gradient(ellipse 45% 30% at 50% 58%, rgba(237,196,111,.10), transparent 60%),
    var(--espresso);
  position: relative;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .34em; font-size: 12px;
  color: var(--caramel); margin: 0 0 10px;
}
.hero h1 {
  font-size: clamp(64px, 11vw, 150px); font-weight: 900; line-height: .95;
  margin: 0 0 26px; color: var(--crema);
  background: linear-gradient(160deg, #f8ecd7 30%, var(--gold) 75%, var(--caramel));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.odometer { display: flex; align-items: baseline; gap: 14px; }
.big-number {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(52px, 8vw, 104px);
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
  color: var(--crema);
}
.odometer .unit { font-family: var(--serif); font-size: clamp(20px, 3vw, 34px); color: var(--caramel); }
.hero-sub { max-width: 560px; color: #b7a58f; font-size: 15px; line-height: 1.7; }
.hero-sub strong { color: var(--gold); font-weight: 600; }
.hero-strip {
  display: flex; gap: 34px; margin-top: 44px; flex-wrap: wrap; justify-content: center;
}
.hero-strip .cell { text-align: center; }
.hero-strip .cell b {
  display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--gold);
}
.hero-strip .cell span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: #9b8875; }

.scroll-cue { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); }
.scroll-cue span {
  display: block; width: 20px; height: 32px; border: 2px solid #5c4c3d; border-radius: 12px; position: relative;
}
.scroll-cue span::after {
  content: ""; position: absolute; top: 6px; left: 50%; width: 4px; height: 7px; margin-left: -2px;
  border-radius: 2px; background: var(--caramel); animation: cue 1.8s infinite;
}
@keyframes cue { 0% {opacity:0; transform:translateY(0)} 35% {opacity:1} 100% {opacity:0; transform:translateY(11px)} }

/* ---- sections ---- */
section, footer { padding: 90px 24px; }
section.dark { background: var(--espresso); color: var(--crema); }
section.light { background: var(--crema); color: var(--ink); }
.section-head { max-width: 780px; margin: 0 auto 44px; text-align: center; }
.section-head h2 { font-size: clamp(34px, 5vw, 52px); }
section.dark .section-head p { color: #b3a08c; }
section.light .section-head p { color: var(--muted); }

/* ---- globe ---- */
#globe-wrap { position: relative; max-width: 1200px; margin: 0 auto; }
#globe { height: min(78vh, 760px); border-radius: 18px; overflow: hidden; cursor: grab; }
#globe:active { cursor: grabbing; }
.globe-controls {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(20, 14, 10, .78); border: 1px solid rgba(255,255,255,.08);
  padding: 12px 16px; border-radius: 12px; backdrop-filter: blur(6px);
  font-size: 13px; color: #d8c8b4;
}
.globe-controls label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.swatch { display: inline-block; width: 20px; height: 4px; border-radius: 2px; }
.swatch.leg1 { background: var(--leg1); }
.swatch.leg2 { background: var(--leg2); }
.swatch.spin { background: none; width: auto; height: auto; color: var(--gold); }
#globe-tooltip {
  position: absolute; z-index: 6; pointer-events: none;
  background: rgba(18, 12, 8, .92); color: var(--crema);
  border: 1px solid rgba(237,196,111,.35);
  padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  max-width: 300px; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
#globe-tooltip b { color: var(--gold); }
#globe-fallback { text-align: center; padding: 80px 20px; color: #b3a08c; }

/* ---- guided tour ---- */
#globe-caption {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%); z-index: 5;
  text-align: center; pointer-events: none; max-width: 80%;
}
#gc-role {
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--caramel);
}
#gc-name {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(22px, 3.2vw, 36px); line-height: 1.15; color: var(--crema);
  text-shadow: 0 2px 18px rgba(0,0,0,.75);
}
#gc-sub {
  font-size: 12.5px; color: #b3a08c; margin-top: 7px; letter-spacing: .05em;
}
#globe-caption.show #gc-role, #globe-caption.show #gc-name {
  animation: caption-in .5s ease both;
}
@keyframes caption-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

#tour-start {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 6;
  background: linear-gradient(135deg, var(--caramel), #a96a33); color: #fff;
  border: none; border-radius: 999px; padding: 14px 28px;
  font: 600 14px var(--sans); letter-spacing: .05em; cursor: pointer;
  box-shadow: 0 8px 28px rgba(201,138,75,.45);
  transition: transform .2s, box-shadow .2s;
}
#tour-start:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 12px 34px rgba(201,138,75,.6); }

/* ---- stats ---- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; max-width: 1080px; margin: 0 auto 60px;
}
.stat-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 20px 18px; text-align: center;
  box-shadow: 0 1px 2px rgba(43,33,26,.05);
}
.stat-card b {
  display: block; font-family: var(--serif); font-weight: 600;
  font-size: 34px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.stat-card small { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.stat-card .sub { display: block; font-size: 12px; color: var(--caramel); margin-top: 4px; }

/* ---- leg split ---- */
.leg-split { max-width: 860px; margin: 0 auto 70px; }
.leg-split h3 { text-align: center; font-size: 24px; }
.split-bar {
  display: flex; height: 26px; border-radius: 13px; overflow: hidden; margin: 18px 0 10px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.12);
}
.split-leg1 { background: linear-gradient(90deg, #d3703f, var(--leg1)); width: 0%; transition: width 1.4s cubic-bezier(.2,.7,.3,1); }
.split-leg2 { background: linear-gradient(90deg, var(--leg2), #8ec7e8); width: 0%; transition: width 1.4s cubic-bezier(.2,.7,.3,1) .2s; }
.split-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.split-labels .swatch { margin-right: 6px; }

/* ---- charts ---- */
.chart-block { max-width: 1080px; margin: 0 auto 70px; }
.chart-block h3 { font-size: 24px; }
.chart-note { color: var(--muted); font-size: 13px; margin-top: -4px; }
.chart-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 60px;
  max-width: 1080px; margin: 0 auto;
}
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-block svg { width: 100%; height: auto; display: block; }
.bar-leg1 { fill: var(--leg1); }
.bar-leg2 { fill: var(--leg2); }
.bar-row { cursor: pointer; }
.bar-row:hover .bar-leg1 { fill: #c25f31; }
.bar-row:hover .bar-leg2 { fill: #4f97bd; }
.axis text { font-family: var(--sans); font-size: 11px; fill: var(--muted); }
.axis line, .axis path { stroke: var(--line); }
.bar-label { font-size: 11px; fill: var(--ink); }
.bar-value { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
#chart-tooltip {
  position: fixed; z-index: 80; pointer-events: none;
  background: var(--espresso); color: var(--crema);
  padding: 9px 13px; border-radius: 9px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 8px 22px rgba(0,0,0,.35); max-width: 260px;
}
#chart-tooltip b { color: var(--gold); }
.cal-dot { cursor: pointer; transition: r .15s; }
.cal-dot:hover { stroke: var(--ink); stroke-width: 1.5; }
.radial-ring { fill: none; stroke: var(--line); stroke-dasharray: 3 5; }
.radial-ring-label { font-size: 10.5px; fill: var(--muted); }
.radial-label { font-size: 11px; fill: var(--ink); }
.radial-dot { stroke: #fff; stroke-width: 1.2; cursor: pointer; }
.radial-dot:hover { stroke: var(--ink); }
.radial-legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin-top: 12px; }
.radial-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 6px; vertical-align: -1px; }

/* ---- awards ---- */
.award-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px; max-width: 1200px; margin: 0 auto;
}
.award-card {
  background: linear-gradient(170deg, var(--roast), #191310);
  border: 1px solid rgba(237,196,111,.18); border-radius: 16px;
  overflow: hidden; cursor: pointer; transition: transform .25s, border-color .25s;
}
.award-card:hover { transform: translateY(-5px); border-color: rgba(237,196,111,.55); }
.award-card img { width: 100%; height: 168px; object-fit: cover; display: block; filter: saturate(.92); }
.award-card .pad { padding: 16px 18px 20px; }
.award-card .medal { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.award-card h4 { font-family: var(--serif); font-size: 20px; margin: 6px 0 4px; color: var(--crema); }
.award-card p { font-size: 12.5px; color: #b3a08c; margin: 0; line-height: 1.55; }
.award-card p b { color: var(--caramel); }

/* ---- collection ---- */
.coll-controls {
  display: flex; gap: 12px; max-width: 1080px; margin: 0 auto 14px; flex-wrap: wrap;
}
#coll-search {
  flex: 1; min-width: 220px; padding: 11px 16px; font: 14px var(--sans);
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
}
#coll-sort {
  padding: 11px 14px; font: 14px var(--sans); border: 1px solid var(--line);
  border-radius: 10px; background: var(--paper); color: var(--ink);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; max-width: 1080px; margin: 0 auto 30px; }
.chip {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 6px 13px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  transition: all .18s;
}
.chip.on { background: var(--ink); color: var(--crema); border-color: var(--ink); }
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px; max-width: 1200px; margin: 0 auto;
}
.bag-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; cursor: pointer; transition: transform .22s, box-shadow .22s;
}
.bag-card:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(43,33,26,.14); }
.bag-card img { width: 100%; height: 210px; object-fit: cover; display: block; }
.bag-card .pad { padding: 14px 16px 17px; }
.bag-card .km-badge {
  float: right; font-size: 11.5px; font-weight: 600; color: var(--caramel);
  font-variant-numeric: tabular-nums; padding-top: 2px;
}
.bag-card h4 { font-family: var(--serif); font-size: 17px; margin: 0 0 2px; }
.bag-card .roaster { font-size: 12.5px; color: var(--muted); }
.bag-card .origin { font-size: 12.5px; margin-top: 7px; }
.bag-card .notes { font-size: 12px; font-style: italic; color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* ---- modal ---- */
dialog#bag-modal {
  border: none; border-radius: 20px; padding: 0; max-width: 780px; width: 92vw;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
dialog#bag-modal::backdrop { background: rgba(15, 10, 7, .72); backdrop-filter: blur(3px); }
.modal-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(23,18,16,.55); color: #fff; font-size: 20px; line-height: 1;
}
.modal-hero { width: 100%; height: 300px; object-fit: cover; display: block; }
.modal-pad { padding: 26px 30px 30px; }
.modal-pad h3 { font-size: 30px; margin-bottom: 2px; }
.modal-pad .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.journey-strip {
  display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center;
  gap: 6px; background: var(--crema); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; margin: 0 0 20px; text-align: center;
}
.journey-strip .stop b { display: block; font-size: 13px; }
.journey-strip .stop span { font-size: 11px; color: var(--muted); }
.journey-strip .hop { font-size: 11px; color: var(--caramel); white-space: nowrap; }
.journey-strip .hop::before { content: "— "; color: var(--line); }
.journey-strip .hop::after { content: " →"; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 20px; margin-bottom: 16px; }
.meta-grid div b { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.meta-grid div span { font-size: 14px; }
.modal-notes { font-style: italic; color: var(--caramel); font-size: 15px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---- footer ---- */
footer { background: var(--espresso); color: #b3a08c; text-align: center; }
footer h3 { color: var(--crema); }
footer p { max-width: 640px; margin: 0 auto 14px; font-size: 13.5px; line-height: 1.7; }
.fineprint { font-size: 11.5px; color: #6d5c4c; }
.fineprint code { color: #9b8875; }
