:root {
  --paper: #f1e9d8;
  --paper-bright: #fbf7ed;
  --ink: #261b17;
  --coffee: #6a3c2d;
  --coffee-deep: #3a2019;
  --lime: #d8ff62;
  --rust: #a43e1b;
  --line: rgba(38, 27, 23, 0.18);
  --muted: #675a54;
  --mono: "DM Mono", monospace;
  --sans: "Manrope", sans-serif;
  --serif: "Young Serif", serif;
  --shadow: 0 28px 80px rgba(48, 30, 21, 0.16);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.17;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.17'/%3E%3C/svg%3E");
}

.site-header,
main,
footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.16em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
}

.brand-mark svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.source-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 5px;
}

.hero {
  padding: 86px 0 78px;
  display: grid;
  grid-template-columns: 1.5fr 0.75fr;
  align-items: end;
  gap: 60px;
}

.eyebrow {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: -22px;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rust);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font: 400 clamp(54px, 8vw, 105px) / 0.91 var(--serif);
  letter-spacing: -0.055em;
}

h1 em {
  color: var(--coffee);
  font-weight: 400;
}

.lede {
  max-width: 420px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
  box-shadow: var(--shadow);
}

.control-panel,
.pour-panel {
  min-width: 0;
  padding: clamp(28px, 5vw, 60px);
}

.control-panel {
  background: var(--paper-bright);
}

.pour-panel {
  color: var(--paper-bright);
  background: var(--coffee-deep);
}

.panel-heading {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.panel-heading-light {
  border-color: rgba(255, 255, 255, 0.18);
}

.section-number {
  margin: 5px 0 0;
  font: 500 11px/1 var(--mono);
  color: var(--rust);
}

.panel-heading-light .section-number {
  color: var(--lime);
}

.panel-heading h2 {
  margin-bottom: 7px;
  font: 400 25px/1.15 var(--serif);
}

.panel-heading p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-heading-light p:last-child {
  color: rgba(255, 255, 255, 0.54);
}

.method-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 30px 0 42px;
  padding: 6px;
  background: #e9e0cf;
}

.method-option input {
  position: absolute;
  opacity: 0;
}

.method-option span {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: 180ms ease;
}

.method-option input:checked + span {
  background: var(--paper-bright);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(38, 27, 23, 0.09);
}

.method-option input:focus-visible + span {
  outline: 3px solid var(--rust);
  outline-offset: 2px;
}

@media (hover: hover) {
  .method-option span:hover {
    background: rgba(255, 255, 255, 0.5);
  }

  .brand:hover .brand-mark {
    transform: rotate(-7deg);
  }
}

.method-option strong {
  font-size: 13px;
}

.method-option small {
  margin-top: 5px;
  color: var(--muted);
  font: 400 11px/1 var(--mono);
}

.amount-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.amount-heading label {
  font-size: 14px;
  font-weight: 700;
}

.unit-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: -8px 0 16px;
  background: #e9e0cf;
}

.unit-switch input {
  position: absolute;
  opacity: 0;
}

.unit-switch span {
  display: block;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--muted);
  font: 500 10px/1 var(--mono);
}

.unit-switch input:checked + span {
  color: var(--ink);
  background: var(--paper-bright);
  box-shadow: 0 3px 10px rgba(38, 27, 23, 0.08);
}

.unit-switch input:focus-visible + span {
  outline: 3px solid var(--rust);
  outline-offset: 2px;
}

.number-wrap {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.number-wrap input {
  width: 118px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  text-align: right;
  font: 500 40px/1.2 var(--mono);
}

.number-wrap input:focus-visible {
  outline: 3px solid rgba(164, 62, 27, 0.3);
  outline-offset: 4px;
  border-color: var(--rust);
}

.number-wrap input[aria-invalid="true"] {
  color: var(--rust);
  border-color: var(--rust);
}

.number-wrap span {
  font: 500 13px/1 var(--mono);
}

.range {
  --range-progress: 16.67%;
  width: 100%;
  height: 44px;
  display: block;
  appearance: none;
  border: 0;
  border-radius: 0;
  background: linear-gradient(to right, var(--coffee) 0 var(--range-progress), #d8cebc var(--range-progress) 100%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 3px;
}

.range::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  appearance: none;
  border: 5px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--coffee);
  box-shadow: 0 0 0 1px var(--coffee);
  cursor: grab;
}

.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 5px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--coffee);
  box-shadow: 0 0 0 1px var(--coffee);
  cursor: grab;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font: 400 10px/1 var(--mono);
}

.field-error {
  min-height: 18px;
  margin: 8px 0 -8px;
  color: var(--rust);
  font-size: 12px;
  font-weight: 700;
}

.serving-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.quick-sizes {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.quick-sizes button {
  min-width: 58px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: 500 10px/1 var(--mono);
  cursor: pointer;
  transition: 160ms ease;
}

.quick-sizes button:hover,
.quick-sizes button.is-active {
  color: var(--paper-bright);
  border-color: var(--coffee);
  background: var(--coffee);
}

.quick-sizes button:active,
.timer-button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.98);
}

.quick-sizes button:disabled,
.range:disabled,
.number-wrap input:disabled,
.method-option input:disabled + span {
  cursor: not-allowed;
  opacity: 0.52;
}

.quick-sizes button:focus-visible,
.timer-button:focus-visible,
.icon-button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 3px;
}

.recipe-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 42px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fact-card {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 17px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-card:last-child {
  grid-column: 1 / -1;
  min-height: 112px;
}

.fact-primary {
  background: var(--lime);
}

.fact-label,
.fact-note {
  font: 500 10px/1.25 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fact-note {
  color: var(--muted);
}

.fact-card strong {
  font: 400 clamp(30px, 4vw, 44px) / 1 var(--serif);
}

.fact-card strong small {
  font: 500 11px/1 var(--mono);
}

.temperature-note {
  display: flex;
  gap: 15px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.temperature-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font: 500 16px/1 var(--mono);
}

.temperature-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.temperature-note span:not(.temperature-icon) {
  color: var(--muted);
}

.timer-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin: 30px 0 24px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.timer-kicker,
.timer-status small {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.64);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#timer-display {
  font: 500 30px/1 var(--mono);
  font-variant-numeric: tabular-nums;
}

.timer-status {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer-status p {
  min-width: 0;
  margin: 0;
}

.timer-status p span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(216, 255, 98, 0.1);
}

.timer-actions {
  display: flex;
  gap: 7px;
}

.brew-lock-note {
  grid-column: 1 / -1;
  margin: -10px 0 0;
  color: rgba(255, 255, 255, 0.72);
  text-align: right;
  font: 500 10px/1 var(--mono);
}

.timer-button,
.icon-button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

.timer-button {
  padding: 0 15px;
  color: var(--ink);
  background: var(--lime);
  font-size: 11px;
  font-weight: 800;
}

.timer-button.is-running {
  background: var(--paper-bright);
}

.timer-button:hover {
  filter: brightness(1.08);
}

.icon-button {
  width: 44px;
  display: grid;
  place-items: center;
  color: var(--paper-bright);
  background: rgba(255, 255, 255, 0.11);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.timer-card.is-paused .pulse-dot {
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.08);
}

.icon-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pour-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.pour-step {
  position: relative;
  display: grid;
  grid-template-columns: 62px 1fr 80px;
  gap: 15px;
  align-items: center;
  min-height: 105px;
  padding: 17px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  transition: color 180ms ease, opacity 180ms ease, transform 180ms ease;
  animation: step-reveal 240ms ease both;
}

@keyframes step-reveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.pour-step::before {
  content: "";
  position: absolute;
  left: -14px;
  width: 3px;
  height: 0;
  background: var(--lime);
  transition: height 180ms ease;
}

.pour-step.is-active::before {
  height: 62%;
}

.pour-step.is-complete {
  opacity: 0.45;
}

.step-time span {
  display: inline-block;
  padding: 7px 8px;
  color: var(--lime);
  border: 1px solid rgba(216, 255, 98, 0.5);
  font: 500 11px/1 var(--mono);
}

.step-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.step-title-row h3 {
  margin-bottom: 5px;
  font: 400 17px/1.2 var(--serif);
}

.add-weight {
  color: rgba(255, 255, 255, 0.68);
  font: 400 10px/1 var(--mono);
}

.step-copy p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
  line-height: 1.5;
}

.scale-target {
  text-align: right;
}

.scale-target small {
  display: block;
  margin-bottom: 5px;
  color: rgba(255, 255, 255, 0.68);
  font: 400 10px/1 var(--mono);
  text-transform: uppercase;
}

.scale-target strong {
  font: 400 23px/1 var(--serif);
}

.scale-target strong span {
  font: 400 10px/1 var(--mono);
}

.finish-note {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 20px;
  margin-top: 24px;
  padding: 20px;
  color: var(--ink);
  background: var(--lime);
}

.finish-note > span {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.finish-note strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font: 400 28px/1 var(--serif);
}

.finish-note p {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.45;
}

.method-notes {
  padding: 120px 0 100px;
}

.method-notes > .panel-heading {
  grid-template-columns: 32px 1fr;
  max-width: 580px;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 44px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.notes-grid article {
  min-height: 220px;
  padding: 24px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.notes-grid article > span {
  color: var(--rust);
  font: 500 10px/1 var(--mono);
}

.notes-grid h3 {
  margin: 60px 0 12px;
  font: 400 18px/1.2 var(--serif);
}

.notes-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.attribution {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.attribution p {
  margin-bottom: 0;
}

.attribution a {
  color: var(--ink);
  font-weight: 700;
  text-underline-offset: 3px;
}

footer {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

footer span:last-child {
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 70px 0 58px;
  }

  .eyebrow {
    margin-bottom: -8px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 600px) {
  .site-header,
  main,
  footer {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    height: 72px;
  }

  .source-link {
    font-size: 11px;
  }

  .source-long {
    display: none;
  }

  .hero {
    padding: 52px 0 46px;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(40px, 11vw, 52px);
    letter-spacing: -0.065em;
  }

  .lede {
    font-size: 15px;
  }

  .control-panel,
  .pour-panel {
    padding: 28px 20px;
  }

  .method-switch {
    grid-template-columns: 1fr;
  }

  .method-option span {
    min-height: 62px;
  }

  .amount-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .number-wrap input {
    text-align: left;
  }

  .timer-card {
    position: sticky;
    top: 0;
    z-index: 5;
    grid-template-columns: auto 1fr;
    gap: 18px;
    background: rgba(58, 32, 25, 0.97);
    box-shadow: 0 12px 30px rgba(18, 8, 5, 0.28);
  }

  .timer-actions {
    grid-column: 1 / -1;
  }

  .timer-button {
    flex: 1;
  }

  .pour-step {
    grid-template-columns: 52px 1fr 70px;
    gap: 10px;
  }

  .step-title-row {
    display: block;
  }

  .add-weight {
    display: block;
    margin-bottom: 5px;
  }

  .scale-target strong {
    font-size: 20px;
  }

  .method-notes {
    padding: 80px 0 60px;
  }

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

  .notes-grid article {
    min-height: 170px;
  }

  .notes-grid h3 {
    margin-top: 34px;
  }

  .attribution,
  footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .attribution {
    gap: 10px;
  }

  footer {
    justify-content: center;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
