:root {
  color-scheme: light;
  --paper: #f4f3ef;
  --card: #fff;
  --ink: #1d1d23;
  --muted: #52525c;
  --line: #d8d8df;
  --accent: #254681;
  --accent-hover: #1a3567;
  --chosen: #edf3ff;
  --coffee-note: #f3ece3;
  --coffee-ink: #573d29;
  --page-gutter: 32px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.skip-link { position: absolute; z-index: 5; inset: 8px auto auto 8px; padding: 12px 16px; border-radius: 8px; background: var(--card); color: var(--accent); transform: translateY(calc(-100% - 16px)); }
.skip-link:focus { transform: none; }
.finder-fallback { display: block; margin-bottom: 16px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, .option input:focus-visible + span {
  outline: 3px solid #5377c6;
  outline-offset: 4px;
}
.shell { width: min(1152px, calc(100% - 2 * var(--page-gutter))); margin-inline: auto; }
.top { background: #f8faff; border-bottom: 1px solid #ccd7ec; }
.nav { display: flex; align-items: center; min-height: 66px; gap: clamp(12px, 2.4vw, 30px); padding-block: 6px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 14px; min-height: 44px; text-decoration: none; }
.brand img { display: block; width: 118px; height: auto; }
.nav-title { border-left: 1px solid var(--line); padding-left: 14px; color: var(--ink); white-space: nowrap; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-title, .nav-actions :is(.text-button, .nav-shop), .language-options a { font-family: inherit; font-size: .9rem; font-weight: 650; line-height: 1.2; }
.shop-link { display: inline-flex; align-items: center; width: fit-content; color: var(--accent); font-size: .95rem; font-weight: 700; text-decoration: none; }
.nav-actions > *, .result-actions > *, .order a { min-height: 44px; }
.nav-actions > * { min-width: 44px; }
.shop-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav-actions .nav-shop { display: inline-block; padding: 12px; border-radius: 8px; color: #fff; background: var(--accent); text-align: center; align-content: center; }
.nav-actions .text-button { padding-inline: 10px; border-radius: 8px; }
.nav-actions .text-button:hover { background: var(--chosen); text-decoration: none; }
.nav-actions .nav-shop:hover { background: var(--accent-hover); text-decoration: none; }
.shop-link.primary { color: #fff; white-space: nowrap; }
.text-button { color: var(--accent); background: none; border: 0; padding: 9px 0; font-size: .95rem; font-weight: 650; }
.text-button:hover, .order a:hover { text-decoration: underline; text-underline-offset: 4px; }
.primary { border: 0; border-radius: 999px; background: var(--accent); color: white; min-height: 44px; padding: 11px 23px; font-size: .95rem; font-weight: 650; }
.primary:hover { background: var(--accent-hover); }

.intro {
  min-height: clamp(260px, 28vw, 320px);
  width: min(1152px, calc(100% - 2 * var(--page-gutter)));
  margin: 18px auto 0;
  border-radius: 22px;
  display: grid;
  align-items: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #0c1117;
  color: white;
  text-align: left;
}
.hero-image, .intro::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-image { object-fit: cover; object-position: 80% 60%; z-index: -2; }
.intro::after { content: ""; z-index: -1; background: linear-gradient(90deg, #102341f7 3%, #142743e8 34%, #14274385 57%, #0a101c08 100%); }
.hero-content { width: min(100%, 650px); padding: clamp(22px, 2.5vw, 30px) clamp(22px, 5vw, 60px); }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 520px; margin-bottom: 14px; font-size: clamp(2.25rem, 4.85vw, 3.95rem); font-weight: 750; letter-spacing: -.06em; line-height: 1.04; }
.hero-brand { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 15px; margin-bottom: 17px; color: #f5debe; font-size: .875rem; font-weight: 700; }
.hero-brand img { display: block; width: clamp(112px, 11vw, 147px); height: auto; filter: brightness(0) invert(1); }
.intro p { max-width: 450px; margin: 0 0 18px; color: #f1f0f4; font-size: clamp(1rem, 1.8vw, 1.12rem); line-height: 1.5; }
.intro .primary { background: #fff; color: #203663; }
.intro .primary:hover { background: #e9efff; }

.workspace { padding-block: clamp(22px, 4vw, 46px); scroll-margin-top: 24px; }
.intro:not([hidden]) + .workspace { padding-block-start: clamp(12px, 2vw, 24px); }
.layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(230px, 1fr); gap: 18px; }
.panel, .guide, .card { min-width: 0; border-radius: 25px; padding: clamp(20px, 3.4vw, 36px); background: var(--card); }
.guide { display: flex; flex-direction: column; padding: clamp(23px, 3.4vw, 36px); }
.guide h2 { font-size: 1.35rem; letter-spacing: -.04em; margin-bottom: 22px; }
.guide dl { margin: 0; }
.guide dt { color: var(--muted); font-size: .875rem; }
.guide dd { margin: 4px 0 16px; font-weight: 650; }
.notice { border-top: 1px solid var(--line); margin: auto 0 0; padding-top: 15px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.progress { color: var(--accent); font-size: .875rem; font-weight: 650; margin-bottom: 14px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: clamp(1.55rem, 3.35vw, 2.4rem); font-weight: 750; line-height: 1.08; letter-spacing: -.063em; margin-bottom: 17px; padding: 0; }
.step-note { color: var(--muted); line-height: 1.45; margin-bottom: 16px; }
.options, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option { position: relative; display: block; cursor: pointer; }
.option input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.option-content { min-height: 56px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; padding: 13px 15px; line-height: 1.35; }
.option:hover .option-content { border-color: #8c9bb6; }
.option input:checked + .option-content { background: var(--chosen); border-color: var(--accent); color: var(--accent); font-weight: 650; box-shadow: inset 0 0 0 1px var(--accent); }
.visual-options .option:last-child:nth-child(odd) { grid-column: 1 / -1; }
.visual-options .option-content { min-height: 76px; gap: 13px; padding: 7px 11px 7px 7px; }
.visual-options .option-content img { flex: 0 0 auto; width: 78px; height: 58px; object-fit: cover; border-radius: 8px; }
.filter-caption { display: flex; align-items: center; gap: 10px; }
.filter-caption img { flex: 0 0 auto; width: 49px; height: 36px; object-fit: cover; border-radius: 6px; }
.filters label, .order label { font-size: .9rem; font-weight: 650; }
select, .filters input { display: block; width: 100%; min-width: 0; min-height: 48px; padding: 9px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); font-weight: 400; }
.controls { display: flex; gap: 16px; justify-content: flex-end; margin-top: 25px; }

.result-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 22px; }
.result-heading h2 { font-size: clamp(1.8rem, 3.8vw, 3rem); letter-spacing: -.068em; line-height: 1.04; margin: 0 0 10px; }
.result-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.result-edit { position: sticky; z-index: 2; top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.result-edit .text-button, #see-matches { min-height: 44px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; padding: clamp(21px, 3vw, 33px); }
.product-photo { margin: 0 0 15px; }
.product-photo img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 13px; background: var(--coffee-note); }
.card h3 { font-size: clamp(1.46rem, 2.6vw, 2.05rem); letter-spacing: -.055em; line-height: 1.14; margin: 7px 0 13px; }
.origin { color: var(--accent); margin: 0; font-size: .88rem; font-weight: 650; line-height: 1.45; }
.taste-notes { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; padding: 0; margin: 0 0 12px; }
.taste-notes li { padding: 4px 9px; border-radius: 6px; color: var(--coffee-ink); background: var(--coffee-note); font-size: .875rem; line-height: 1.4; }
.tastes { font-weight: 650; margin-bottom: 10px; line-height: 1.45; }
.brewing-fit { margin: 1px 0 11px; color: var(--accent); font-size: .9rem; font-weight: 650; line-height: 1.45; }
.attributes, .reason { color: var(--muted); line-height: 1.48; }
.attributes { font-size: .9rem; margin-bottom: 11px; }
.coffee-notes-label { margin-bottom: 5px; color: var(--muted); font-size: .875rem; }
.order { display: grid; gap: 11px; margin-top: auto; padding-top: 12px; }
.order a { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; font-weight: 650; width: fit-content; }
.order select { font-size: 1rem; }
.pack-price { margin: 0; font-weight: 700; }
.roastery-story { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); overflow: hidden; margin-top: 18px; border-radius: 22px; background: #182f54; color: #fff; }
.roastery-story img { width: 100%; height: 100%; max-height: 320px; object-fit: cover; object-position: center 43%; }
.roastery-copy { align-self: center; padding: clamp(22px, 4vw, 46px); }
.roastery-copy h2 { margin-bottom: 10px; font-size: clamp(1.5rem, 3.2vw, 2.45rem); letter-spacing: -.04em; }
.roastery-copy p { max-width: 52ch; color: #eff3fa; line-height: 1.55; margin-bottom: 10px; }
.roastery-copy p:last-child { margin-bottom: 0; }
.shop-info { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: 18px; padding: clamp(20px, 3.4vw, 34px); background: var(--card); border-radius: 22px; }
.shop-info h2 { margin-bottom: 7px; font-size: clamp(1.25rem, 3vw, 1.65rem); letter-spacing: -.035em; }
.shop-info p { max-width: 55ch; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.footer { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; line-height: 1.6; }
.footer-grid { display: grid; grid-template-columns: 1.18fr 1fr 1fr; gap: 24px clamp(18px, 4vw, 56px); padding-block: 32px; }
.footer h2 { margin: 0 0 8px; color: var(--ink); font-size: .95rem; font-weight: 750; }
.footer p, .footer address { margin: 0; }
.footer-brand img { display: block; width: 105px; height: auto; margin-bottom: 12px; }
.footer-about p { max-width: 290px; margin-bottom: 8px; }
.footer address { font-style: normal; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer a { color: var(--accent); text-underline-offset: 3px; overflow-wrap: anywhere; }
.footer-legal { border-top: 1px solid var(--line); padding-block: 13px; }

@media (max-width: 960px) {
  :root { --page-gutter: 24px; }
  .layout { grid-template-columns: 1fr; gap: 14px; }
  .guide { padding: 18px 22px; }
  .guide h2 { font-size: 1.1rem; margin-bottom: 12px; }
  .guide dl { display: grid; grid-template-columns: minmax(100px, max-content) minmax(0, 1fr); gap: 6px 16px; align-items: baseline; }
  .guide dd { margin: 0; overflow-wrap: anywhere; }
  .notice { margin-top: 13px; padding-top: 11px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-about { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  :root { --page-gutter: 16px; }
  .nav { min-height: 56px; gap: 8px; padding-block: 5px; }
  .brand { gap: 10px; }
  .brand img { width: 94px; }
  .nav-title { padding-left: 10px; }
  .nav-actions { gap: 6px; }
  .nav-title, .nav-actions :is(.text-button, .nav-shop), .language-options a { font-size: .875rem; }
  .intro { min-height: 0; margin-top: 12px; border-radius: 16px; }
  .intro::after { background: linear-gradient(90deg, #08121ef5 0%, #101a26e8 58%, #0a101c82 100%); }
  .hero-content { padding: 20px; }
  .hero-brand { margin-bottom: 14px; }
  .hero-image { object-position: 58% 58%; }
  h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .panel, .guide, .card, .shop-info { border-radius: 18px; }
  .options, .filters, .cards { grid-template-columns: 1fr; gap: 10px; }
  .option-content { min-height: 48px; padding: 11px 14px; }
  .controls {
    position: sticky;
    z-index: 2;
    bottom: 0;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 10px 0 max(8px, env(safe-area-inset-bottom));
    background: var(--card);
  }
  .controls .text-button { flex: 0 0 auto; min-width: 44px; }
  .controls .primary { flex: 1; min-width: 0; }
  .result-heading { margin-bottom: 14px; }
  .result-actions { width: 100%; gap: 0 14px; }
  .card .order a { justify-content: center; width: 100%; padding-inline: 12px; border: 1px solid var(--line); border-radius: 9px; }
  .shop-info .primary { justify-content: center; width: 100%; }
  .roastery-story { grid-template-columns: 1fr; border-radius: 18px; }
  .roastery-story img { max-height: 195px; }
  .shop-info { flex-wrap: wrap; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; padding-block: 24px; }
}

@media (max-width: 600px) {
  .nav-title { display: none; }
}

/* Keep the language choice independent from the shop actions. */
.nav-actions > * { white-space: nowrap; }
#language-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.language-switcher { display: flex; align-items: center; margin-left: auto; }
.language-options { display: inline-flex; gap: 2px; padding: 0; border: 1px solid #c9d2e2; border-radius: 9px; background: #edf1f8; }
.language-options a { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; min-width: 44px; min-height: 44px; padding: 0 9px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); white-space: nowrap; }
.language-options a:hover { background: #dce6f8; }
.language-options a[aria-current="page"] { background: var(--accent); color: #fff; }
.language-short { display: none; }

#results { scroll-margin-top: 16px; }
#results.results-empty { padding: clamp(20px, 4vw, 38px); border: 1px solid #cbd6e8; border-top: 4px solid var(--accent); border-radius: 18px; background: var(--card); }
.results-empty .result-heading { margin-bottom: 14px; }
.results-empty .result-edit { position: static; padding: 2px 0 4px; margin-bottom: 4px; border: 0; background: transparent; }
.result-actions { margin-bottom: 12px; }
.results-empty .result-actions { margin-bottom: 0; }
.secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 999px; background: var(--card); color: var(--accent); font-weight: 650; font-size: .95rem; }
.secondary:hover { background: var(--chosen); }

@media (max-width: 860px) {
  .language-full { display: none; }
  .language-short { display: inline; }
}
@media (max-width: 600px) {
  .nav { gap: 8px; }
  .nav-actions .text-button, .nav-actions .nav-shop { padding-inline: 8px; }
  .result-edit { gap: 8px; }
  .result-edit .primary, .result-edit .secondary { flex: 1 1 auto; text-align: center; }
  .result-actions { gap: 0 14px; }
}
@media (max-width: 450px) {
  .nav-browse-tail, .nav-shop-tail { display: none; }
}
@media (max-width: 370px) {
  .top .shell { width: calc(100% - 24px); }
  .brand img { width: 81px; }
  .nav, .nav-actions { gap: 4px; }
  .nav-actions .text-button, .nav-actions .nav-shop { padding-inline: 4px; }
}
@media (max-width: 290px) {
  .nav { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .visual-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visual-options .option { display: flex; min-width: 0; scroll-margin-bottom: 70px; }
  .visual-options .option-content { width: 100%; flex-direction: column; align-items: stretch; gap: 7px; padding: 6px; }
  .visual-options .option-content img { width: 100%; height: clamp(64px, 21vw, 130px); object-position: center; }
  .visual-options .option-label { padding: 0 4px 4px; overflow-wrap: anywhere; }
  .visual-options .option:last-child:nth-child(odd) .option-content { flex-direction: row; align-items: center; }
  .visual-options .option:last-child:nth-child(odd) img { width: 68px; height: 48px; }
  .visual-options .option:last-child:nth-child(odd) .option-label { padding-bottom: 0; }
  .filters select, .filters input { scroll-margin-bottom: 76px; }
}

@media (min-width: 761px) and (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(190px, .42fr); }
  .guide dl { display: block; }
  .guide dd { margin: 4px 0 14px; }
}

@media (min-width: 961px) and (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
