/* ==========================================================================
   Vladzimir Cook: clean, bold recipe site (light grey, black, lime accents)
   ========================================================================== */

:root {
  color-scheme: light dark;
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #ececea;
  --text: #0b0b0b;
  --muted: #5c5c59;
  --line: #e3e3dd;
  --field-border: #c9c9c3;
  --line-strong: #0b0b0b;
  --lime: #ccff00;
  --lime-hover: #b8e600;
  --lime-ink: #0b0b0b;
  --ink: #111111;
  --ink-text: #ffffff;
  --ink-muted: #a6a6a1;
  --red: #c62828;
  --yellow: #ffe066;
  --focus: #0b0b0b;
  --font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wrap: 1240px;
  --gutter: 16px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --surface: #191919;
    --surface-2: #232323;
    --text: #f1f1ee;
    --muted: #a3a39e;
    --line: #2c2c2a;
    --field-border: #3a3a37;
    --line-strong: #f1f1ee;
    --ink: #000000;
    --red: #ff6b6b;
    --focus: #ccff00;
  }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

img {
  display: block;
  max-width: 100%;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 1em;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.icon {
  flex: none;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: 700 13px/1 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--text);
  color: var(--bg);
}

.btn--sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 12px;
}

.btn--lime {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}

.btn--lime:hover {
  background: var(--lime-hover);
  border-color: var(--lime-hover);
  color: var(--lime-ink);
}

.btn--dark {
  background: var(--text);
  color: var(--bg);
}

.btn--dark:hover {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--lime-ink);
}

.btn--danger {
  border-color: var(--red);
  color: var(--red);
}

.btn--danger:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn--ghost-light {
  border-color: #555;
  color: #fff;
}

.btn--ghost-light:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}

.btn--text {
  min-height: 36px;
  padding: 0;
  border: 0;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
}

.btn--text:hover {
  background: none;
  color: var(--text);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--line-strong);
}

.icon-btn--danger:hover {
  border-color: var(--red);
  color: var(--red);
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.badge--draft {
  background: var(--yellow);
  color: #000;
}

/* ---------- Header ---------- */

.site-header {
  background: var(--ink);
  color: var(--ink-text);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  margin-right: auto;
}

.header-suggest {
  padding: 8px 0;
  color: var(--lime);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.header-suggest:hover {
  text-decoration: underline;
  text-underline-offset: 5px;
}

.header-suggest__long {
  display: none;
}

@media (min-width: 1024px) {
  .header-suggest__long {
    display: inline;
  }

  .header-suggest__short {
    display: none;
  }
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}

.logo__mark {
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--lime);
}

.header-search {
  position: relative;
  display: none;
  align-items: center;
  color: var(--ink-muted);
}

.header-search .icon {
  position: absolute;
  left: 12px;
  pointer-events: none;
}

.header-search input {
  width: clamp(200px, 24vw, 320px);
  height: 40px;
  padding: 0 12px 0 38px;
  border: 1px solid #333;
  border-radius: 0;
  background: #1f1f1f;
  color: #fff;
  font: 400 15px var(--font);
}

.header-search input::placeholder {
  color: #8a8a86;
}

.header-search input:focus {
  outline: 2px solid var(--lime);
  outline-offset: -1px;
}

.header-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink-text);
}

.header-link {
  color: var(--ink-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.header-link:hover {
  color: var(--lime);
}

@media (max-width: 479px) {
  .header-new span {
    display: none;
  }

  .logo {
    gap: 8px;
    font-size: 15px;
    white-space: nowrap;
  }

  .logo__mark {
    width: 16px;
    height: 16px;
  }

  .site-header__brand {
    gap: 14px;
  }

  /* On phones the owner's header already holds + New and Admin. */
  .site-header--admin .header-suggest {
    display: none;
  }
}

@media (min-width: 768px) {
  .header-search {
    display: flex;
  }

  .header-icon {
    display: none;
  }
}

/* ---------- Category tabs ---------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.page-recipe .tabs {
  position: static;
}

.tabs__inner {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs__inner::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: none;
  padding: 16px 12px 13px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.tab:first-child {
  margin-left: -12px;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  border-bottom-color: var(--text);
  color: var(--text);
}

/* ---------- Home hero ---------- */

.hero {
  padding: 48px 0 56px;
  background: var(--ink);
  color: var(--ink-text);
}

.hero .eyebrow {
  color: var(--lime);
}

.hero__title {
  font-size: clamp(46px, 10vw, 104px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.hero__lede {
  max-width: 34em;
  margin: 24px 0 28px;
  color: var(--ink-muted);
  font-size: 18px;
}

.hero-search,
.search-page-form {
  display: flex;
  max-width: 600px;
}

.hero-search input,
.search-page-form input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #000;
  font: 400 16px var(--font);
}

.hero-search .btn,
.search-page-form .btn {
  min-height: 52px;
}

.search-page-form {
  margin: 24px 0 8px;
}

.search-page-form input {
  border: 1px solid var(--line-strong);
  border-right: 0;
  background: var(--surface);
  color: var(--text);
}

.search-summary {
  margin: 16px 0 24px;
}

/* ---------- Sections & grids ---------- */

.section {
  padding-top: 40px;
  padding-bottom: 72px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 28px;
}

.section-head--page {
  margin-bottom: 28px;
}

.page-title {
  font-size: clamp(36px, 6vw, 60px);
  letter-spacing: -0.035em;
}

.lede {
  max-width: 36em;
  color: var(--muted);
  font-size: 18px;
}

.breadcrumb {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text);
  text-decoration: underline;
}

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

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
  }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card__media img {
  transform: scale(1.04);
}

.card__placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
}

.card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
}

.card__body {
  padding: 12px 12px 16px;
}

.card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.card:hover .card__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card__meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 640px) {
  .card__body {
    padding: 16px 16px 20px;
  }

  .card__title {
    font-size: 19px;
  }

  .card__meta {
    font-size: 12px;
  }
}

.empty {
  padding: 56px 24px;
  border: 1px dashed var(--field-border);
  background: var(--surface);
  text-align: center;
}

.empty .icon {
  margin: 0 auto 12px;
  color: var(--muted);
}

.empty h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.message {
  max-width: 720px;
}

.message .lede {
  margin: 16px 0 28px;
}

/* ---------- Recipe page ---------- */

.draft-banner {
  padding: 10px var(--gutter);
  background: var(--yellow);
  color: #000;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.recipe-top {
  display: grid;
}

.recipe-top__media {
  order: -1;
}

@media (min-width: 960px) {
  .recipe-top {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 56px;
    align-items: start;
    padding-top: 40px;
  }

  .recipe-top--no-media {
    grid-template-columns: minmax(0, 1fr);
  }

  .recipe-top__media {
    order: 2;
  }
}

.recipe-intro {
  padding-top: 24px;
}

.recipe-top--no-media .recipe-intro {
  max-width: 860px;
}

.recipe-title {
  margin: 4px 0 14px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.recipe-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.recipe-cats a {
  color: var(--muted);
  text-decoration: none;
}

.recipe-cats a:hover {
  color: var(--text);
}

.recipe-cats a + a::before {
  content: '·';
  padding: 0 8px;
  color: var(--muted);
}

.recipe-desc {
  max-width: 40em;
  color: var(--muted);
  font-size: 18px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  margin: 24px 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.meta-item {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-item dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta-item dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 600;
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.recipe-actions .switch {
  margin-right: 8px;
}

.cook-hint {
  display: none;
  margin: 12px 0 0;
  padding: 10px 14px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 14px;
  font-weight: 600;
}

.cook-mode .cook-hint {
  display: block;
}

/* Gallery: swipeable on phones, arrows + dots on desktop */

.gallery {
  position: relative;
  margin: 0 calc(var(--gutter) * -1);
  background: var(--surface-2);
}

@media (min-width: 960px) {
  .gallery {
    margin: 0;
  }
}

.gallery__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery__track::-webkit-scrollbar {
  display: none;
}

.gallery__slide {
  flex: 0 0 100%;
  margin: 0;
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
}

.gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__dots {
  position: absolute;
  right: 0;
  bottom: 8px;
  left: 0;
  display: flex;
  justify-content: center;
}

.gallery__dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.gallery__dot::before {
  content: '';
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.gallery__dot.is-active::before {
  background: var(--lime);
}

.gallery__nav {
  position: absolute;
  top: 50%;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  transform: translateY(-50%);
}

.gallery__nav:hover {
  background: var(--lime);
  color: #000;
}

.gallery__nav--prev {
  left: 12px;
}

.gallery__nav--next {
  right: 12px;
}

@media (hover: hover) {
  .gallery__nav {
    display: grid;
  }
}

/* Sticky section bar on phones */

.jumpbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 28px calc(var(--gutter) * -1) 0;
  padding: 0 var(--gutter);
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  scrollbar-width: none;
}

.jumpbar a {
  flex: none;
  padding: 14px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

.jumpbar a:first-child {
  margin-left: -10px;
}

.jumpbar .switch {
  flex: none;
  margin-left: auto;
  font-size: 13px;
}

@media (min-width: 960px) {
  .jumpbar {
    display: none;
  }
}

/* Toggle switch */

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  background: var(--field-border);
  transition: background-color 0.2s;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.switch input:checked + .switch__track {
  background: var(--lime);
}

.switch input:checked + .switch__track::after {
  background: #000;
  transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Ingredients + method */

.recipe-body {
  display: grid;
  gap: 40px;
  padding: 28px 0 72px;
}

.recipe-body section {
  scroll-margin-top: 64px;
}

@media (min-width: 960px) {
  .recipe-body {
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 56px;
    align-items: start;
    padding-top: 56px;
  }

  .ingredients {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
}

.panel {
  padding: 24px;
  background: var(--surface);
}

@media (max-width: 559px) {
  .panel {
    padding: 20px 16px;
  }
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line-strong);
}

.panel-head h2,
.rule-title {
  font-size: 30px;
}

.rule-title {
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line-strong);
}

.scaler {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
}

.scaler__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.scaler__btn:hover:not(:disabled) {
  background: var(--lime);
  color: var(--lime-ink);
}

.scaler__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.scaler__value {
  min-width: 104px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ing-group {
  margin-top: 16px;
}

.ing-group__title {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.ing-list li + li {
  border-top: 1px solid var(--line);
}

.ing {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}

.ing input {
  appearance: none;
  display: grid;
  flex: none;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 3px 0 0;
  border: 1.5px solid var(--muted);
  background: transparent;
  cursor: pointer;
}

.ing input::before {
  content: '';
  width: 10px;
  height: 6px;
  border-bottom: 2px solid #000;
  border-left: 2px solid #000;
  transform: rotate(-45deg) translate(1px, -1px);
  visibility: hidden;
}

.ing input:checked {
  border-color: var(--lime);
  background: var(--lime);
}

.ing input:checked::before {
  visibility: visible;
}

.ing input:checked + .ing__text {
  color: var(--muted);
  text-decoration: line-through;
}

.ing__qty {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

.step {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 640px) {
  .step {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 20px;
  }
}

.step__num {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: 500 18px/1 var(--font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.step__num .icon {
  display: none;
}

.step__num:hover {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
}

.step.is-done .step__num {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.step.is-done .step__num .icon {
  display: block;
}

.step.is-done .step__digits {
  display: none;
}

.step.is-done .step__body {
  opacity: 0.45;
}

.step__body p {
  margin: 0 0 0.75em;
  font-size: 17px;
}

.step__body p:last-of-type {
  margin-bottom: 0;
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.timer:hover {
  background: var(--surface-2);
}

.timer.is-running {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
}

.timer.is-finished {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.6;
  }
}

.notes {
  margin-top: 40px;
  padding: 24px;
  border-left: 6px solid var(--lime);
  background: var(--surface);
}

.notes h2 {
  margin-bottom: 12px;
  font-size: 24px;
}

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

.source {
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* Cook mode: bigger text for reading at the stove */

.cook-mode .recipe-desc,
.cook-mode .meta-grid {
  display: none;
}

.cook-mode .ing {
  padding: 14px 0;
  font-size: 19px;
}

.cook-mode .ing input {
  width: 24px;
  height: 24px;
}

.cook-mode .step__body p {
  font-size: 21px;
  line-height: 1.55;
}

.cook-mode .step__num {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

/* ---------- "Suggest a recipe" band (bottom of public pages) ---------- */

.suggest-band {
  padding: 16px 0 64px;
}

/* Always lime with black text, in light and dark mode alike, so it stands out. */
.suggest-card {
  display: grid;
  gap: 28px;
  padding: 32px 20px;
  background: var(--lime);
  color: #0b0b0b;
}

@media (min-width: 560px) {
  .suggest-card {
    padding: 40px;
  }
}

@media (min-width: 960px) {
  .suggest-card {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: 56px;
    padding: 64px 56px;
  }
}

.suggest-card .eyebrow {
  color: #0b0b0b;
  opacity: 0.7;
}

.suggest-card h2 {
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.suggest-card__intro p:last-child {
  max-width: 30em;
  margin: 18px 0 0;
  font-size: 18px;
}

.suggest-card__form {
  display: grid;
  gap: 14px;
}

@media (min-width: 560px) {
  .suggest-card__form {
    grid-template-columns: 1fr 1fr;
  }

  .suggest-card__form .field--wide,
  .suggest-card__form .btn {
    grid-column: 1 / -1;
  }
}

.suggest-card .field {
  margin: 0;
}

.suggest-card .field > label {
  color: #0b0b0b;
}

.suggest-card .optional {
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.suggest-card .field input {
  min-height: 54px;
  border: 2px solid #0b0b0b;
  background: #fff;
  color: #0b0b0b;
  font-size: 17px;
}

.suggest-card .field input::placeholder {
  color: #77776f;
}

.suggest-card .field input:focus {
  border-color: #0b0b0b;
  outline: 3px solid #0b0b0b;
  outline-offset: 0;
}

.suggest-card .btn {
  min-height: 58px;
  border-color: #0b0b0b;
  background: #0b0b0b;
  color: #fff;
  font-size: 14px;
}

.suggest-card .btn:hover {
  background: #fff;
  color: #0b0b0b;
}

.suggest-card .btn:focus-visible {
  outline-color: #0b0b0b;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 40px 0 calc(40px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--ink-muted);
  font-size: 14px;
}

.site-footer p {
  margin: 12px 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 24px;
}

.footer-links form {
  margin: 0;
}

.footer-links a,
.footer-links button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.footer-links a:hover,
.footer-links button:hover {
  color: #fff;
}

.has-savebar .site-footer {
  padding-bottom: 110px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 100;
  padding: 12px 18px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  transform: translateX(-50%);
  animation: toast-in 0.2s ease-out;
}

.has-savebar .toast {
  bottom: 96px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ==========================================================================
   Admin
   ========================================================================== */

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.admin-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-stats {
  margin: 12px 0 0;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.admin-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  padding: 10px;
  background: var(--surface);
}

@media (min-width: 640px) {
  .admin-item {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }
}

.admin-item__thumb {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-2);
  color: var(--muted);
}

.admin-item__title {
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.admin-item__title:hover {
  text-decoration: underline;
}

.admin-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.admin-item__actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .admin-item__actions {
    grid-column: auto;
  }
}

.signout {
  margin-top: 32px;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 12px;
  letter-spacing: 0;
}

/* Suggestion review page */

.suggestion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 28px;
}

.suggestion-body {
  display: grid;
  gap: 16px;
  max-width: 860px;
}

.suggestion-body h2 {
  margin-bottom: 12px;
  font-size: 22px;
}

.suggestion-body .photos {
  margin: 0;
}

.suggestion-body ol,
.suggestion-body ul {
  margin: 0;
  padding-left: 22px;
}

.suggestion-body li + li {
  margin-top: 6px;
}

.suggestion-body .ing-group__title {
  margin-top: 12px;
}

.pre-line {
  white-space: pre-line;
}

/* Recipe form */

.recipe-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.recipe-form > .panel {
  min-width: 0;
  margin: 0;
  border: 0;
}

.panel > legend {
  float: left;
  width: 100%;
  margin: 0 0 6px;
  padding: 0;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.panel > legend + * {
  clear: both;
}

.panel-intro {
  margin: 0 0 16px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-bottom: 18px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label,
.label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.req {
  color: var(--red);
}

.field input,
.field textarea,
.field select,
.ing-row input,
.group-title,
.step-text,
.step-timer input,
.cat-row input,
.cat-add input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1.4 var(--font);
}

.field textarea,
.step-text {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.ing-row input:focus,
.group-title:focus,
.step-text:focus,
.step-timer input:focus,
.cat-row input:focus,
.cat-add input:focus {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
}

.field-row .field {
  flex: 1 1 140px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.time-hint {
  min-height: 1.2em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--field-border);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.chip span:hover {
  border-color: var(--line-strong);
}

.chip input:checked + span {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.form-lede {
  margin-top: 16px;
}

/* Honeypot field: off-screen for people, still filled in by spam bots. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.thanks {
  max-width: 680px;
  margin-top: 28px;
  padding: 40px 32px;
  border-left: 6px solid var(--lime);
}

.thanks .icon {
  margin-bottom: 12px;
}

.thanks h2 {
  font-size: 34px;
}

.thanks .lede {
  margin: 12px 0 24px;
}

.thanks__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-error {
  padding: 12px 16px;
  border-left: 4px solid var(--red);
  background: color-mix(in srgb, var(--red) 12%, var(--surface));
  font-weight: 600;
}

/* Photos */

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.photos:not(:empty) {
  margin-bottom: 12px;
}

.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  display: none;
  background: var(--lime);
  color: #000;
}

.photo:first-child .badge {
  display: inline-block;
}

.photo__actions {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  padding: 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

.photo__actions button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #000;
  cursor: pointer;
}

.photo__actions button:hover {
  background: var(--lime);
}

.photo__actions [data-photo-remove] {
  margin-left: auto;
}

.photo.is-uploading::after,
.photo.is-error::after {
  content: 'Uploading…';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.photo.is-error::after {
  content: 'Upload failed';
  background: rgba(198, 40, 40, 0.75);
}

.photo.is-error .photo__actions {
  z-index: 1;
}

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 96px;
  border: 2px dashed var(--field-border);
  font-weight: 700;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Ingredient editor */

.ing-editor-group {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
}

.ing-editor-group__head {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.group-title {
  font-weight: 700;
}

.ing-editor-labels {
  display: none;
}

.ing-rows {
  display: grid;
  gap: 10px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
}

.ing-row {
  display: grid;
  grid-template-areas:
    'amount unit actions'
    'name name name';
  grid-template-columns: 76px 84px minmax(0, 1fr);
  gap: 6px;
}

.ing-row + .ing-row {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ing-amount {
  grid-area: amount;
}

.ing-unit {
  grid-area: unit;
}

.ing-name {
  grid-area: name;
}

.ing-row .row-actions {
  grid-area: actions;
  justify-self: end;
}

@media (min-width: 640px) {
  .ing-editor-labels,
  .ing-row {
    display: grid;
    grid-template-areas: 'amount unit name actions';
    grid-template-columns: 96px 110px minmax(0, 1fr) 116px;
    gap: 8px;
  }

  .ing-editor-labels {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .ing-row + .ing-row {
    padding-top: 0;
    border-top: 0;
  }

  .ing-rows {
    gap: 8px;
  }
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Step editor */

.step-editor {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.step-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--line);
}

.step-row__num {
  padding-top: 10px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.step-row__main {
  display: grid;
  gap: 8px;
}

.step-row .row-actions {
  grid-column: 2;
  justify-content: flex-end;
}

@media (min-width: 640px) {
  .step-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
  }

  .step-row .row-actions {
    grid-column: 3;
    align-self: start;
  }
}

.step-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.step-timer input {
  width: 96px;
  min-height: 40px;
}

/* Save bar */

.savebar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: #fff;
}

.savebar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.savebar__status {
  margin-right: auto;
  color: var(--ink-muted);
  font-size: 14px;
}

@media (max-width: 559px) {
  .savebar__status {
    width: 100%;
  }

  .savebar__status:empty {
    display: none;
  }

  .savebar .btn {
    flex: 1;
  }
}

.danger-zone {
  margin-top: 16px;
}

.danger-zone h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

/* Categories editor */

.cat-list {
  display: grid;
  gap: 8px;
  max-width: 680px;
  margin: 24px 0 16px;
  padding: 0;
  list-style: none;
}

.cat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  padding: 8px;
  background: var(--surface);
}

.cat-row__count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.cat-row .row-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

@media (min-width: 560px) {
  .cat-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .cat-row .row-actions {
    grid-column: auto;
  }
}

.cat-add {
  display: flex;
  gap: 8px;
  max-width: 680px;
  margin-top: 40px;
}

.cat-add input {
  flex: 1;
  min-width: 0;
}
