:root {
  color-scheme: light;
  --ink: #2d241d;
  --muted: #74685c;
  --paper: #fffdf8;
  --warm: #f5ecdf;
  --line: #e5d6c1;
  --accent: #a44324;
  --accent-dark: #753019;
  --sage: #56715c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 96% 0%, #ead5ba 0, transparent 28rem),
    linear-gradient(150deg, #f7f0e7, #efe3d3 60%, #e7d6c3);
}

.page-shell {
  width: min(100% - 2rem, 680px);
  margin: 0 auto;
  padding: 2.75rem 0 4rem;
}

.hero { padding: 0 0.25rem 1.75rem; }

.install-panel {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--warm) 78%, var(--paper));
  box-shadow: 0 0.4rem 1.2rem rgb(66 40 20 / 7%);
}

.install-panel[hidden] { display: none !important; }

.install-panel h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.install-panel p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.install-button {
  width: 100%;
  min-height: 3.15rem;
  border: 0;
  border-radius: 0.75rem;
  color: #fff9f0;
  background: var(--sage);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.install-button:hover { background: #405c49; }
.install-button:focus-visible { outline: 3px solid rgb(86 113 92 / 40%); outline-offset: 3px; }
.ios-install-instruction { padding-left: 0.8rem; border-left: 3px solid var(--sage); }

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0.55rem;
  color: var(--accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
}

h2 { font-size: 1.32rem; letter-spacing: -0.02em; }
h3 { margin: 1.5rem 0 0.75rem; font-size: 1rem; }

.lead { max-width: 36rem; margin-bottom: 0; color: var(--muted); font-size: 1.03rem; line-height: 1.55; }

.video-recipe-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  min-height: 2.75rem;
  margin-top: 1rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  box-shadow: 0 0.25rem 0.7rem rgb(66 40 20 / 6%);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.3;
  text-decoration: none;
}

.video-recipe-link:hover { border-color: var(--accent); background: #fff9f0; }
.video-recipe-link:focus-visible { outline: 3px solid rgb(164 67 36 / 35%); outline-offset: 3px; }

.weight-card, .recipe-stage {
  margin-top: 1rem;
  padding: 1.35rem;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 1.2rem;
  box-shadow: 0 0.6rem 2rem rgb(66 40 20 / 8%);
}

.weight-card h2 { margin-bottom: 1.1rem; }

label { display: block; margin-bottom: 0.45rem; font-size: 0.86rem; font-weight: 700; }

.input-with-unit { position: relative; }

input {
  width: 100%;
  min-height: 3.55rem;
  padding: 0.65rem 4.1rem 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  color: var(--ink);
  background: #fffefa;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 700;
  outline: none;
}

input:focus { border-color: var(--accent); box-shadow: 0 0 0 0.22rem rgb(164 67 36 / 17%); }
input[aria-invalid="true"] { border-color: #b42318; }

.input-with-unit span {
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 700;
  transform: translateY(-50%);
}

#weight-help, .validation-message { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.validation-message { min-height: 1.25em; color: #b42318; font-weight: 650; }

.calculate-button {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 1rem;
  border: 0;
  border-radius: 0.75rem;
  color: #fff9f0;
  background: var(--accent);
  box-shadow: 0 0.3rem 0.75rem rgb(117 48 25 / 20%);
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
}

.calculate-button:hover { background: var(--accent-dark); }
.calculate-button:focus-visible { outline: 3px solid rgb(164 67 36 / 40%); outline-offset: 3px; }

#salting-stage { scroll-margin-top: 1rem; }

.stage-heading { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.15rem; }
.stage-heading .eyebrow { margin-bottom: 0.15rem; }
.stage-heading h2 { margin: 0; }

.stage-number {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  margin: 0;
  place-items: center;
  border-radius: 50%;
  color: #fff9f0;
  background: var(--accent);
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.ingredients { border-top: 1px solid var(--line); }

.ingredient {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.82rem 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.35;
}

.ingredient span { font-size: 0.98rem; }
.ingredient small { margin-left: 0.25rem; color: var(--muted); font-size: 0.78rem; }
output { flex: 0 0 auto; max-width: 12rem; color: var(--accent-dark); font-size: 1.02rem; font-weight: 750; line-height: 1.4; text-align: right; }
output[data-spice] { display: flex; flex-direction: column; align-items: flex-end; gap: 0.05rem; }
.spice-grams { font-size: 1.12rem; font-weight: 800; }
.spice-spoons { color: var(--muted); font-size: 0.8rem; font-weight: 600; }

.instruction {
  margin: 1.2rem 0 0;
  padding-left: 0.9rem;
  border-left: 3px solid var(--sage);
  color: #4b4036;
  font-size: 0.95rem;
  line-height: 1.57;
}

.note, .spice-note, .garlic-note { margin: 1rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.spice-note { font-style: italic; }
.second-stage, .storage-stage { margin-top: 1rem; }

@media (min-width: 640px) {
  .page-shell { padding-top: 4rem; }
  .weight-card, .recipe-stage { padding: 1.7rem; }
}

@media (max-width: 700px) {
  .page-shell {
    width: calc(100% - 24px);
    padding: 1.5rem 0 2.75rem;
  }

  .hero { padding: 0 0.25rem 1.35rem; }

  .install-panel {
    gap: 0.8rem;
    margin-bottom: 1rem;
    padding: 1rem;
  }

  .install-panel h2 { font-size: 1.2rem; }
  .install-panel p { font-size: 1rem; }
  .install-button { min-height: 3.3rem; font-size: 1.1rem; }

  .eyebrow { font-size: 0.88rem; }

  h1 {
    font-size: clamp(2.5rem, 11vw, 2.75rem);
    line-height: 1;
  }

  h2 { font-size: clamp(1.55rem, 6.5vw, 1.75rem); }
  h3 { font-size: 1.2rem; }

  .lead {
    font-size: 1.125rem;
    line-height: 1.55;
  }

  .video-recipe-link {
    min-height: 3.15rem;
    margin-top: 0.9rem;
    padding: 0.6rem 0.9rem;
    font-size: 1rem;
  }

  .weight-card, .recipe-stage {
    margin-top: 1rem;
    padding: 1.25rem;
    border-radius: 1rem;
  }

  .weight-card h2 { margin-bottom: 1rem; }

  label {
    margin-bottom: 0.55rem;
    font-size: 1.1rem;
  }

  input {
    min-height: 3.9rem;
    padding: 0.65rem 4.25rem 0.65rem 1rem;
    font-size: 1.85rem;
  }

  .input-with-unit span {
    right: 1.1rem;
    font-size: 1.2rem;
  }

  #weight-help, .validation-message {
    font-size: 1rem;
    line-height: 1.5;
  }

  .calculate-button {
    min-height: 3.4rem;
    margin-top: 0.95rem;
    font-size: 1.2rem;
  }

  .stage-heading {
    gap: 0.9rem;
    margin-bottom: 1rem;
  }

  .stage-number {
    width: 2.7rem;
    height: 2.7rem;
    font-size: 1.45rem;
  }

  .ingredient {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    column-gap: 0.5rem;
    padding: 0.75rem 0;
    line-height: 1.3;
  }

  .ingredient > span { font-size: 1.1rem; }

  .ingredient small {
    display: inline;
    margin-left: 0.2rem;
    font-size: 0.9rem;
  }

  output {
    max-width: none;
    font-size: 1.28rem;
    line-height: 1.3;
  }

  output:not([data-spice]) {
    grid-column: 2 / span 2;
    justify-self: end;
    white-space: nowrap;
  }

  output[data-spice] {
    display: grid;
    grid-column: 2 / span 2;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: 0.5rem;
    white-space: nowrap;
  }

  .spice-grams {
    font-size: 1.28rem;
    font-weight: 800;
    white-space: nowrap;
  }

  .spice-spoons {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .instruction {
    margin-top: 1.15rem;
    padding-left: 1rem;
    font-size: 1.125rem;
    line-height: 1.58;
  }

  .note, .spice-note, .garlic-note {
    font-size: 1rem;
    line-height: 1.5;
  }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
