:root {
  --bg: #fffefd;
  --text: #404246;
  --muted: #7f8081;

  --max: 44rem;
  --pad: 1.25rem;
  --leading: 1.65;

  --border: #d9d7d2;
  --surface: #f7f6f4;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/var(--leading) system-ui, -apple-system, Segoe UI,
        Roboto, Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: #111111;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: calc(var(--pad) * 2) var(--pad) calc(var(--pad) * 3);
}

/* NAV — shared with james-platt.com */
.nav {
  display: flex;
  gap: .9rem;
  align-items: baseline;
  margin-bottom: 2.25rem;
  flex-wrap: wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
}

.nav a {
  text-decoration: none;
}

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* FADE TRANSITIONS — shared with james-platt.com */
.fade {
  opacity: 0;
  transition: opacity 160ms ease;
}

.fade.is-visible {
  opacity: 1;
}

.fade.is-leaving {
  opacity: 0;
}

/* TYPE */
h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -.02em;
}

h2 {
  font-size: 1.1rem;
  margin: 2rem 0 .65rem;
}

p {
  margin: 0 0 1rem;
}

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

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
}

.controls {
  display: flex;
  gap: .7rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.button {
  appearance: none;
  border: 1px solid var(--text);
  border-radius: 0;
  padding: .68rem .9rem;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  line-height: 1.2;
  text-decoration: none;
}

.button.secondary {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.button:disabled {
  opacity: .45;
  cursor: default;
}

.status {
  min-height: 1.5rem;
  color: var(--muted);
  font-size: .92rem;
}

.status:empty { display: none; }

.recipe-list {
  margin: 0;
  padding: 0;
}

.recipe-card {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

.recipe-card:last-child {
  border-bottom: 1px solid var(--border);
}

.recipe-header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .3rem;
}

.recipe-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.recipe-description {
  margin: 0;
  color: #626468;
  font-size: .95rem;
  line-height: 1.5;
}

.recipe-reminder {
  flex: 0 0 auto;
  padding: .45rem .65rem;
  font-size: .82rem;
}

.macros {
  margin-top: .4rem;
  color: var(--muted);
  font-size: .85rem;
}

.recipe-card details {
  margin-top: .7rem;
}

.recipe-card summary {
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;
  font-size: .85rem;
}

.recipe-details {
  padding-top: .35rem;
}

.recipe-section-title {
  margin: 1rem 0 .35rem;
  font-size: .9rem;
}

.recipe-pantry {
  color: #626468;
  font-size: .92rem;
  line-height: 1.5;
}

.recipe-method {
  margin: .35rem 0 0;
  padding-left: 1.35rem;
}

.recipe-method li {
  margin-bottom: .5rem;
}

.shopping-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.shopping-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: .42rem 0;
  border-bottom: 1px dotted var(--border);
}

.shopping-list .category {
  display: block;
  margin-top: .8rem;
  padding-bottom: .15rem;
  border-bottom: 0;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.summary {
  margin: 1.25rem 0;
  padding: .85rem 1rem;
  border-left: 2px solid var(--muted);
  background: var(--surface);
}

.summary p:last-child { margin-bottom: 0; }

.hidden { display: none !important; }

.field { margin: 0 0 1rem; }

.field label {
  display: block;
  margin-bottom: .3rem;
  font-weight: 600;
}

.field small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: .55rem .65rem;
  background: #ffffff;
  color: var(--text);
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(6rem, .8fr) minmax(5rem, .7fr) auto;
  gap: .5rem;
  align-items: end;
  margin-bottom: .6rem;
}

.ingredient-row button,
.new-ingredient-row button {
  min-height: 44px;
  padding: .5rem .7rem;
}

.new-ingredient-row {
  display: grid;
  grid-template-columns: 1.15fr 1.5fr 1fr .8fr .8fr auto;
  gap: .5rem;
  align-items: end;
  margin-bottom: .6rem;
}

.checkbox {
  display: flex;
  gap: .5rem;
  align-items: center;
}

pre.output {
  padding: 1rem;
  border-left: 2px solid var(--muted);
  overflow-wrap: anywhere;
  background: var(--surface);
  font-size: .82rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.admin-publish {
  margin-top: 2rem;
  padding-top: .2rem;
  border-top: 1px solid var(--border);
}

.error { color: #8a3030; }
.success { color: #34613d; }

@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; }

  .ingredient-row { grid-template-columns: 1fr 1fr; }
  .ingredient-row .ingredient-select { grid-column: 1 / -1; }

  .new-ingredient-row { grid-template-columns: 1fr 1fr; }
  .new-ingredient-row input:nth-child(-n + 3) { grid-column: 1 / -1; }

  .recipe-header { display: block; }
  .recipe-reminder { margin-top: .55rem; }

  .shopping-list li { grid-template-columns: 1fr; }
  .shopping-list li span:last-child { margin-top: -.3rem; }
}

@media (max-width: 420px) {
  h1 { font-size: 1.9rem; }
}
