:root {
  --ink: #171412;
  --muted: #665f58;
  --paper: #fbf7ef;
  --line: #ded4c7;
  --teal: #137c77;
  --teal-soft: #d9efed;
  --berry: #9b2f55;
  --berry-soft: #f0d5df;
  --gold: #b97817;
  --gold-soft: #f5e2bd;
  --green: #52733a;
  --green-soft: #dfead3;
  --char: #2d2520;
  --cream: #fffaf2;
  --shadow: 0 18px 48px rgba(32, 24, 16, .16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

.hero {
  min-height: 82vh;
  display: grid;
  align-items: end;
  position: relative;
  isolation: isolate;
  background-image:
    linear-gradient(90deg, rgba(19, 15, 12, .82), rgba(19, 15, 12, .46) 46%, rgba(19, 15, 12, .08)),
    url("../assets/coffee-variables-hero.png");
  background-size: cover;
  background-position: center;
  color: #fffaf1;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 18vh;
  background: linear-gradient(180deg, transparent, var(--paper));
  z-index: -1;
}

.hero__inner,
.section__inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero__inner {
  padding: 96px 0 92px;
}

.language-switcher {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 22px;
  border: 1px solid rgba(255, 250, 241, .38);
  border-radius: 999px;
  background: rgba(23, 20, 18, .42);
}

.language-switcher button {
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  color: #fffaf1;
  background: transparent;
  cursor: pointer;
  font-size: .86rem;
  font-weight: 800;
}

.language-switcher button[aria-pressed="true"] {
  color: var(--ink);
  background: #fffaf1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 250, 241, .46);
  border-radius: 999px;
  color: #f8e9ce;
  background: rgba(23, 20, 18, .38);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 20px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 7.7rem);
  line-height: .9;
  letter-spacing: 0;
}

.hero p {
  max-width: 610px;
  margin: 0;
  color: #f4eadb;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.hero__jump {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero__jump a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  color: #fffaf1;
  text-decoration: none;
  border: 1px solid rgba(255, 250, 241, .55);
  background: rgba(255, 250, 241, .13);
  border-radius: 999px;
  font-weight: 700;
}

section {
  padding: 56px 0;
}

.section-title {
  max-width: 820px;
  margin: 0 0 28px;
}

.section-title h2 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.lab {
  background: #f6efe4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.panel {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 20px;
  position: sticky;
  top: 18px;
}

.control {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.control:first-child {
  border-top: 0;
  padding-top: 0;
}

fieldset.control {
  min-width: 0;
  margin: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

.control label,
.control legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  color: var(--char);
  font-weight: 800;
}

.value {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
}

.segments button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--char);
  cursor: pointer;
  font-weight: 800;
}

.segments button[aria-pressed="true"] {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

.results {
  display: grid;
  gap: 18px;
}

.flavor-board {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
  height: 470px;
  overflow: hidden;
}

.cup-visual {
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, .22), transparent 30%),
    linear-gradient(150deg, #2a211d, #655044);
  color: #fffaf1;
}

.cup {
  width: min(220px, 62vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #3d251a 0 43%, #5b3928 44% 58%, #e9ded0 59% 64%, #fff8ec 65% 100%);
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, .2), 0 30px 60px rgba(0, 0, 0, .32);
}

.cup::after {
  content: "";
  position: absolute;
  width: 84%;
  height: 84%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, .28), transparent 12%),
    conic-gradient(from var(--aroma-angle), var(--berry), var(--gold), var(--green), var(--teal), var(--berry));
  mix-blend-mode: screen;
  opacity: .28;
  transform: rotate(var(--body-tilt));
}

.cup strong {
  position: relative;
  z-index: 1;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(23, 20, 18, .72);
  text-align: center;
  font-size: .82rem;
  line-height: 1.15;
  padding: 8px;
}

.score-area {
  min-height: 0;
  padding: 24px;
  display: grid;
  grid-template-rows: minmax(168px, auto) 1fr;
}

.profile-head {
  display: grid;
  gap: 18px;
  align-items: start;
  margin-bottom: 20px;
}

.profile-head > div {
  display: contents;
}

.profile-head h3 {
  grid-column: 1;
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.04;
  letter-spacing: 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.profile-head p {
  grid-column: 1 / -1;
  margin: -8px 0 0;
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.bars {
  align-self: end;
  display: grid;
  gap: 13px;
}

.bar {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.bar span:first-child {
  font-weight: 800;
}

.bar--primary {
  grid-template-columns: 112px minmax(0, 1fr) 46px;
}

.bar--primary span:first-child,
.bar--primary strong {
  font-size: 1.02rem;
}

.bar--secondary {
  opacity: .72;
}

.bar--secondary span:first-child,
.bar--secondary strong {
  font-size: .88rem;
  font-weight: 750;
}

.track {
  height: 14px;
  border-radius: 999px;
  background: #ebe2d6;
  overflow: hidden;
}

.bar--primary .track {
  height: 18px;
}

.bar--secondary .track {
  height: 10px;
  background: #f0e8de;
}

.fill {
  width: calc(var(--v) * 1%);
  height: 100%;
  border-radius: inherit;
  background: var(--c);
  transition: width .2s ease;
}

.insight-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.insight {
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--cream);
  height: 156px;
  overflow: hidden;
}

.insight h4 {
  margin: 0 0 8px;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.insight p {
  margin: 0;
  font-weight: 750;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.matrix,
.recipes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.matrix {
  grid-template-columns: repeat(4, 1fr);
}

.factor-card {
  display: grid;
  gap: 12px;
  min-height: 280px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--cream);
}

.factor-card h3,
.recipe h3 {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.factor-card p {
  margin: 0;
  color: var(--muted);
}

.scale {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-self: end;
}

.scale div {
  min-height: 96px;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 750;
}

.scale small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.teal {
  background: var(--teal-soft);
}

.berry {
  background: var(--berry-soft);
}

.gold {
  background: var(--gold-soft);
}

.green {
  background: var(--green-soft);
}

.recipe-band {
  background: #192522;
  color: #f8f0e4;
}

.recipe-band .section-title p {
  color: #d8cab9;
}

.recipe {
  padding: 20px;
  border-radius: 8px;
  background: rgba(255, 250, 242, .08);
  border: 1px solid rgba(255, 250, 242, .2);
  min-height: 250px;
}

.recipe h3 {
  margin-bottom: 10px;
  color: #fffaf1;
  font-size: 1.25rem;
}

.recipe dl {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px 12px;
  margin: 0;
}

.recipe dt {
  color: #cdbca8;
  font-weight: 800;
}

.recipe dd {
  margin: 0;
  color: #fffaf1;
}

.footer {
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 920px) {
  .lab-grid,
  .flavor-board,
  .matrix,
  .recipes {
    grid-template-columns: 1fr;
  }

  .controls {
    position: static;
  }

  .flavor-board,
  .insight {
    height: auto;
  }

  .score-area {
    grid-template-rows: auto;
  }

  .profile-head h3,
  .profile-head p,
  .insight p {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }

  .insight-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .hero {
    min-height: 78vh;
    background-position: 58% center;
  }

  .hero__inner {
    padding: 72px 0 78px;
  }

  .language-switcher {
    width: 100%;
  }

  .language-switcher button {
    flex: 1;
  }

  section {
    padding: 42px 0;
  }

  .segments {
    grid-template-columns: 1fr;
  }

  .profile-head {
    display: block;
  }

  .bar {
    grid-template-columns: 82px minmax(0, 1fr) 36px;
  }
}
