/* Base styling */
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #fafafa;
  color: #333;
}

/* Centre all page content */
.page-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* User icon in filter bar */
.user-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.user-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: white;
  border: 1px solid #ddd;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
}

.user-icon-btn:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.user-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid #ddd;
  transition: border-color 0.2s;
}

.user-avatar-btn:hover { border-color: #aaa; }

.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 12px 16px;
  min-width: 180px;
  z-index: 100;
  white-space: nowrap;
}

.user-menu.open { display: block; }

.user-menu-name {
  font-weight: 600;
  font-size: 14px;
  color: #222;
  margin-bottom: 2px;
}

.user-menu-email {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
}

.user-menu-signout {
  display: block;
  font-size: 13px;
  color: #c0392b;
  text-decoration: none;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.user-menu-signout:hover { color: #922b21; }

/* Buy Ingredients */
.ingredients-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
  gap: 8px;
}

.ingredients-heading h3 {
  margin: 0;
  flex: 1;
}

.buy-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #e17a58;
  border: none;
  border-radius: 20px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.buy-icon-btn:hover { background: #c9623f; }
.buy-icon-btn:active { background: #b55535; }

.shop-retailer-inline {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  background: white;
  color: #333;
  /* width matches the Buy button's right edge automatically via flex */
}

.shop-hint-blurb {
  font-size: 12px;
  color: #aaa;
  font-style: italic;
  margin: 0.25rem 0 0.5rem;
}

.ingredient-buy-list {
  margin: 0;
  padding-left: 1.2rem;
}

.ingredient-buy-list li {
  margin-bottom: 4px;
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ingredient-buy-list.shop-active li {
  cursor: pointer;
  border-radius: 4px;
  padding: 3px 4px;
  margin-left: -4px;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.ingredient-buy-list.shop-active li:hover {
  background: #fde8e0;
  color: #c9623f;
  text-decoration: underline;
}

.ingredient-buy-list li.ing-done {
  opacity: 0.4;
  text-decoration: line-through;
}

.ing-tick {
  font-size: 12px;
  color: #6ab87a;
  font-weight: 700;
  flex-shrink: 0;
}

/* AI caveat */
.ai-caveat {
  font-size: 12px;
  color: #888;
  font-style: italic;
  background: #fffbe6;
  border-left: 3px solid #f0c040;
  padding: 8px 10px;
  border-radius: 4px;
  margin: 0 0 1rem;
  line-height: 1.5;
}

/* In-app browser banner */
.iab-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}

.iab-sheet {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 18px 18px 0 0;
  padding: 2rem 1.5rem 2.5rem;
  z-index: 201;
  text-align: center;
  transition: bottom 0.35s ease;
  max-width: 480px;
  margin: 0 auto;
}

.iab-sheet.iab-sheet-open { bottom: 0; }

.iab-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  cursor: pointer;
  line-height: 28px;
}

.iab-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.iab-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #222;
}

.iab-text {
  font-size: 14px;
  color: #555;
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.iab-hint {
  font-size: 13px;
  color: #777;
  background: #f7f7f7;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.iab-copy {
  width: 100%;
  padding: 12px;
  background: #e9f9e3;
  color: #333;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.iab-copy:hover { background: #d0f0c0; }

.iab-copied {
  margin-top: 0.75rem;
  font-size: 13px;
  color: #4a9960;
  font-weight: 500;
}

/* Filter bar */
.selection-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
  align-items: center;
}

.selection-bar select {
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* Header: add | logo | search — all same size */
.header-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 1rem 0;
}

/* Logo box and top buttons share the same square size */
.logo-box,
.top-button {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo-box {
  background-color: white;
}

.logo-box img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.top-button {
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: #333;
  gap: 6px;
}

.add-button {
  background-color: #f8c8c4; /* pastel red */
}

.search-button {
  background-color: #fff7c4; /* pastel yellow */
}

/* Action buttons */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.75rem 0 1.5rem;
  flex-wrap: wrap;
}

.action-button {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  background-color: #e3f3ff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  color: #333;
}

.action-button.ingredients {
  background-color: #e9f9e3;
}

.action-button.photo {
  background-color: #f2e9ff;
}

/* Add Recipe form */
.add-recipe-form {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row input[type="text"],
.form-row select,
.form-row textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.form-row textarea {
  resize: vertical;
  line-height: 1.6;
}

.form-row.two-col {
  flex-direction: row;
  gap: 1rem;
}

.form-row.two-col > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mic-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: 20px;
  background: white;
  cursor: pointer;
  font-size: 12px;
  margin-left: auto;
}

.mic-btn.mic-active {
  background: #fee2e2;
  border-color: #f87171;
  color: #dc2626;
}

.mic-status {
  font-size: 12px;
  color: #888;
  min-height: 18px;
}

.upload-area {
  border: 2px dashed #c4a8e8;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  background: #f9f4ff;
  cursor: pointer;
}

.upload-area input[type="file"] {
  display: none;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #777;
  font-size: 13px;
}

.upload-area img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: cover;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  background: #e9f9e3;
  color: #333;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.submit-btn:hover {
  background: #d0f0c0;
}

/* Sits beside .submit-btn on an AI preview screen — a way to say "not this
   one" without losing what's typed into the form behind it, which closing
   the whole panel would do. Deliberately quiet next to the green save
   button: this is the option most people won't take. */
.cancel-btn {
  padding: 12px;
  background: #fff;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.cancel-btn:hover {
  background: #f7f7f7;
  border-color: #ccc;
}
@media (prefers-color-scheme: dark) {
  .cancel-btn { background: #2a2a2a; border-color: #444; color: #ccc; }
  .cancel-btn:hover { background: #333; }
}

.save-result {
  max-width: 540px;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}

.save-result.success {
  background: #d1fae5;
  color: #065f46;
}

.save-result.error {
  background: #fee2e2;
  color: #991b1b;
}

/* AI prompt panel */
.ai-prompt-panel {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 1rem;
}

.ai-panel-content {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.ai-panel-content input {
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  width: 260px;
}

.ai-panel-content button {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.ai-recipe-result {
  margin: 1rem auto;
  max-width: 600px;
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  white-space: pre-wrap;
}

/* Paging through the recipe grid */
.cs-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem 0;
}
.cs-page-btn {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  color: #555;
  text-decoration: none;
  white-space: nowrap;
}
.cs-page-btn:hover { border-color: #2d7d5a; color: #2d7d5a; }
.cs-page-btn.off { opacity: 0.35; }
.cs-page-at { font-size: 0.82rem; color: #999; white-space: nowrap; }
.cs-pager-note {
  text-align: center;
  font-size: 0.8rem;
  color: #999;
  margin: 0.6rem 1rem 0;
}

@media (prefers-color-scheme: dark) {
  .cs-page-btn { border-color: #444; color: #bbb; }
  .cs-page-at, .cs-pager-note { color: #777; }
}

/* Site footer — quiet, but the only permanent route to the legal pages */
.cs-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.1rem;
  padding: 2rem 1rem 2.5rem;
  font-size: 0.8rem;
}
.cs-foot a { color: #888; text-decoration: none; }
.cs-foot a:hover { color: #2d7d5a; text-decoration: underline; }
.cs-foot-note { color: #bbb; }

@media (prefers-color-scheme: dark) {
  .cs-foot a { color: #777; }
  .cs-foot-note { color: #555; }
}

/* Favourites — the filter toggle beside the cuisine and diet dropdowns */
.fav-filter {
  border: 1px solid #ccc;
  background: #fff;
  color: #c9c2c2;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.fav-filter:hover { color: #e0607a; border-color: #e0607a; }
.fav-filter.on { color: #fff; background: #e0607a; border-color: #e0607a; }

/* Shown when the favourites filter is on and nothing has been kept yet */
.fav-empty {
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  padding: 1.5rem 1rem 3rem;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .fav-filter { background: #2a2a2a; border-color: #444; color: #777; }
  .fav-filter.on { background: #e0607a; border-color: #e0607a; color: #fff; }
}

/* Recipe grid */
.recipes-container {
  padding: 0 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, 100px);
  gap: 1.25rem;
  justify-content: center;
}


.recipe-card {
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s;
  /* Now an <a>, so reset the link styling it would otherwise inherit */
  display: block;
  text-decoration: none;
  color: inherit;
}

.recipe-card:hover {
  transform: scale(1.02);
}

.recipe-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Three lines, then stop.
   Without the clamp a long name sets the height of its whole row: "Chicken
   Meatballs in Creamy Red Pepper Sauce with Sautéed Kale" runs to eight lines
   on a phone and leaves "Spiced Currant Rolls" sitting above five lines of
   nothing. min-height keeps short and long cards the same size, so the grid
   stays a grid.

   Cutting from the end is only safe because cs_card_title() has already taken
   the dietary qualifiers off the front — otherwise "Gluten-Free Sugar-Free Ube
   Chocolate Chip Crinkles" would clamp to the two qualifiers and none of the
   cake. See includes/card_title.php. */
.recipe-card .title {
  padding: 0.6rem 0.8rem;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  line-height: 1.3;
  box-sizing: border-box;
  min-height: calc(3 * 1.3em + 1.2rem);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The qualifiers taken off the title, shown as what they are.
   Two words of "Gluten-Free Sugar-Free" cost three lines as part of a name and
   half a line as chips, and they read better here — a property of the dish
   rather than part of what it's called. */
.recipe-card .cs-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  padding: 0 0.5rem 0.6rem;
}

.recipe-card .cs-card-flags span {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 20px;
  background: #eaf3de;
  color: #2b4a12;
  white-space: nowrap;
}

/* Bigger tiles, desktop only.
   The phone layout works as it is — three across, cards growing to fit — so it
   keeps the 100px squares. Above this width there is room to show the
   photographs at a size where they read as food rather than as thumbnails,
   which is the whole point: the pictures are already 904×1200, they were just
   being displayed into a hundred pixels. */
@media (min-width: 620px) {
  .recipes-container {
    grid-template-columns: repeat(auto-fill, 160px);
    gap: 2rem;
  }
}

/* The featured recipe.
   544px is three 160px tiles plus their two gutters, so it lines up with the
   button block above it rather than floating at its own width.

   200 tall, not the photograph's own height. A portrait phone snapshot at its
   native aspect is 400px, which pushes the first row of recipes off the bottom
   of a laptop screen — the page then opens on navigation and one picture, and
   a visitor who has never seen CookSwap has no idea it is full of food. Food
   shot from above survives the crop; the plate is in the middle. */
.cs-feature {
  display: none;
}

@media (min-width: 620px) {
  .cs-feature {
    display: block;
    position: relative;
    width: 544px;
    max-width: 100%;
    margin: 0 auto 2rem;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 5px rgba(0,0,0,.1);
  }

  .cs-feature img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
  }

  /* Over the photograph rather than under it, so the panel costs no height.
     The gradient is for legibility, not decoration — white text on an
     unknown photograph is otherwise a gamble. */
  .cs-feature .cs-feature-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 1rem 0.8rem;
    background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0));
    color: #fff;
  }

  .cs-feature .cs-feature-name {
    font-weight: bold;
    font-size: 17px;
    line-height: 1.3;
  }

  .cs-feature .cs-feature-why {
    font-size: 12px;
    opacity: .85;
    margin-top: 2px;
  }
}

/* One measure for the whole head of the page.
 *
 * Three 160px squares and two 32px gutters is 544, which is what the feature
 * image is, which is what a three-column slice of the recipe grid is. So the
 * filter bar, both rows of buttons and the feature all end at the same point
 * and the page has a column instead of four things that happen to be centred.
 *
 * The old numbers were close enough to look deliberate and far enough apart to
 * look wrong: 100px squares with 2rem gutters gave 364 on the top row, 100px
 * with 1.5rem gave 348 on the second, and the filter bar was whatever its
 * contents came to. Under a 544 feature all three read as slightly askew.
 *
 * Below 620px none of this applies. The phone layout is three small tiles
 * across and it works — 544 would not fit a 375px screen, and the buttons at
 * 160 would push the food two full screens down.
 */
@media (min-width: 620px) {
  .selection-bar {
    width: 544px;
    max-width: 100%;
    margin: 0 auto;
    gap: 16px;
  }

  /* Share out whatever the two icons leave, rather than sizing to the longest
     translated option label — "Alle Küchen" and "Lahat ng Lutuin" would
     otherwise give German and Tagalog a different bar width from English. */
  .selection-bar select {
    flex: 1;
    min-width: 0;
  }

  .header-wrapper,
  .action-buttons {
    gap: 32px;
    padding: 0 0 32px;
  }

  .logo-box,
  .top-button,
  .action-button {
    width: 160px;
    height: 160px;
  }

  /* The icons were drawn for a 100px tile and look marooned in a 160px one.
     Scaled by roughly the same 1.6, which keeps the proportion the buttons
     were designed with. Delete this rule if you prefer the smaller icons —
     nothing else depends on it.

     The logo is taller than the other two, and that is an optical correction
     rather than an inconsistency. The + and the magnifier fill their squares;
     the wordmark is artwork inside a 2000×2000 canvas with its own margin, so
     at an equal box height it renders visibly smaller than its neighbours. The
     extra pixels buy back that margin and land all three at the same apparent
     size. Adjust this number, not the others, if it looks wrong. */
  .top-button img        { height: 64px; }
  .logo-box img          { height: 92px; }
  .action-button svg     { width: 54px; height: 54px; }
}

/* Below 620px the three buttons are 100px squares, so the icons stay small.
   Set here rather than left to the HTML height attribute, which is what let
   the logo and its neighbours drift apart in the first place. The same
   optical correction applies, scaled down. */
@media (max-width: 619px) {
  .top-button img        { height: 40px; }
  .logo-box img          { height: 58px; }
}

/* "Add to plan" chooser.
   Above the panels (z-index 10) but below the cookie banner (9999), same
   reasoning as the floating tools icons. */
.cs-plan-pop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cs-plan-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.2rem 1.3rem 1.1rem;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
}
.cs-plan-card h3 { margin: 0 0 .2rem; font-size: 1rem; }
.cs-plan-what { margin: 0 0 .9rem; font-size: .85rem; color: #777; }
.cs-plan-card label {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #999;
  margin: .7rem 0 .25rem;
  font-weight: 700;
}
.cs-plan-card input[type=date],
.cs-plan-card select {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  background: #fff;
  color: #222;
}
.cs-plan-slots { display: flex; gap: .3rem; }
.cs-plan-slots button {
  flex: 1;
  padding: .45rem .2rem;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 8px;
  font-size: .78rem;
  cursor: pointer;
  font-family: inherit;
  color: #666;
}
.cs-plan-slots button.on { background: #2d7d5a; border-color: #2d7d5a; color: #fff; font-weight: 700; }
.cs-plan-acts { display: flex; gap: .5rem; margin-top: 1.1rem; }
.cs-plan-acts button {
  flex: 1;
  padding: .55rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
}
.cs-plan-acts .cs-plan-ok { background: #2d7d5a; border-color: #2d7d5a; color: #fff; }
.cs-plan-msg { margin: .6rem 0 0; font-size: .8rem; color: #c0392b; min-height: 1em; }

@media (prefers-color-scheme: dark) {
  .cs-plan-card { background: #1e1e1e; color: #ddd; }
  .cs-plan-card input[type=date],
  .cs-plan-card select,
  .cs-plan-slots button,
  .cs-plan-acts button { background: #2a2a2a; color: #ccc; border-color: #444; }
  .cs-plan-slots button.on,
  .cs-plan-acts .cs-plan-ok { background: #2d7d5a; border-color: #2d7d5a; color: #fff; }
}

/* Ad tiles.
   Same shape as a recipe card so the grid stays even, but never the same
   thing to look at. The ASA requires an ad be identifiable as one before
   someone engages with it, so the flag sits on the image itself — not in a
   caption underneath, which is read after the click has already happened. */
.ad-card {
  position: relative;
  outline: 1px solid rgba(45, 125, 90, 0.25);
  outline-offset: -1px;
}

.ad-flag {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 1;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1.3;
  /* The tile is only 100px — a long label must not cover the picture */
  max-width: calc(100% - 8px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ad-card .title {
  font-weight: 600;
  color: #5d6d65;
}

/* Search results */
.search-result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.search-result-card:hover {
  background: #fafafa;
}

.search-result-card img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 14px;
}

.search-result-cuisine {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

/* Recipe detail (loaded into slide panel) */
.recipe-detail {
  font-size: 14px;
}

.recipe-image-wrap {
  margin: -2rem -2rem 1rem -2rem;
  position: relative;   /* anchors the bottom-quadrant nav zones, below */
}

.recipe-image-wrap img {
  width: 100%;
  border-radius: 0;
  object-fit: cover;
}

.image-caption {
  font-size: 12px;
  color: #888;
  text-align: center;
  margin: 4px 0 0;
}

.recipe-detail h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  color: #222;
}

.recipe-detail .subtitle {
  color: #666;
  font-style: italic;
  margin: 0 0 0.75rem;
}

.recipe-credits {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .9rem;
  flex-wrap: wrap;
}
.recipe-credits-label {
  font-size: .72rem;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  flex-basis: 100%;
}
.recipe-credits-avatars {
  display: flex;
  align-items: center;
  gap: -.3rem;
}
.recipe-credit-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  margin-left: -6px;
  cursor: pointer;
  transition: transform .15s;
  background: #eee;
}
.recipe-credit-av:first-child { margin-left: 0; }
.recipe-credit-av:hover { transform: scale(1.15); z-index: 1; }
.recipe-credits-more {
  font-size: .75rem;
  color: #aaa;
  margin-left: .4rem;
  white-space: nowrap;
}

.recipe-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  font-size: 13px;
  color: #555;
}

.recipe-section {
  margin-bottom: 1.25rem;
}

.recipe-section h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: #444;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
}

.recipe-section h3.ingredients-heading {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.recipe-section ul {
  margin: 0;
  padding-left: 1.2rem;
}

.recipe-section ul li {
  margin-bottom: 4px;
  line-height: 1.5;
}

.recipe-section p {
  line-height: 1.7;
  margin: 0;
  color: #333;
}

/* Slide-in recipe panel */
.recipe-panel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 400px;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 12px rgba(0,0,0,0.2);
  overflow-y: auto;
  transition: right 0.5s ease;
  z-index: 10;
  padding: 2rem;
  box-sizing: border-box;

  /* Why the recipe swipe didn't work on a phone.
   *
   * The panel scrolls vertically, and with the default touch-action Safari
   * treats a drag inside it as its own business to interpret. The moment it
   * decides the gesture is a scroll it claims it, and the touch sequence
   * ends in touchcancel rather than touchend — so a horizontal swipe that
   * looked perfectly deliberate to a person never reached the handler at
   * all. Nothing was wrong with the swipe arithmetic, which is why it kept
   * testing fine everywhere except on an actual phone.
   *
   * pan-y says: vertical panning is yours, horizontal is mine. pinch-zoom
   * is listed explicitly because naming any pan value would otherwise
   * switch zooming off, and pinching to look closely at someone's
   * photograph of dinner is exactly the sort of thing people do here.
   */
  touch-action: pan-y pinch-zoom;
}

.recipe-panel.open {
  right: 0;
}

.recipe-panel h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.recipe-panel .close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.4rem;
  cursor: pointer;
  border: none;
  background: none;
}

/* Every flyout panel's close button.
   The floating help and settings icons are position:fixed at the top right
   with a far higher z-index, so on a wide screen they sit directly over this
   corner — the × vanished underneath them and couldn't be clicked. On a phone
   those icons drop to the bottom, which is why it only showed up on desktop
   and iPad.
   Left is safe here and nowhere else: this is the only panel whose content
   starts with the photo rather than a heading. */
.recipe-panel .close-btn:not(.social-close-btn) {
  right: auto;
  left: 1rem;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 20;                     /* above the photo */
  transition: transform .15s, background .15s;
}
.recipe-panel .close-btn:not(.social-close-btn) svg {
  width: 26px;
  height: 26px;
  display: block;
  overflow: visible;               /* the white halo strokes past the box */
}
.recipe-panel .close-btn:not(.social-close-btn):hover { background: rgba(255,255,255,.3); transform: scale(1.06); }
.recipe-panel .close-btn:not(.social-close-btn):active { transform: scale(.96); }
.recipe-panel .close-btn:not(.social-close-btn):focus-visible { outline: 2px solid #2d7d5a; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .recipe-panel .close-btn:not(.social-close-btn) { transition: none; }
  .recipe-panel .close-btn:not(.social-close-btn):hover { transform: none; }
}

/* Responsive */
@media (max-width: 600px) {
  .logo-box {
    width: 80px;
    height: 80px;
  }

  .top-button {
    width: 80px;
    height: 80px;
  }

  .action-button {
    width: 85px;
  }

  .recipe-panel {
    width: 100%;
  }
}

/* Panels that open with a heading rather than a photo: drop the title below
   the close button rather than indenting it, which would leave the text
   hanging in from the edge looking like a mistake. */
.recipe-panel .cs-panel-title {
  margin-top: 1.9rem;
  font-size: 1.5rem;
}

/* The social and tools panels keep their close in the header row beside the
   back arrow — moving it left would collide with it. Same glyph either way,
   so it reads as the same control wherever it appears. */
.social-close-btn { display: flex; align-items: center; justify-content: center; padding: 0; }
.social-close-btn svg { width: 18px; height: 18px; display: block; overflow: visible; }

/* A member's own diet combinations, last in the list. Red so it reads as
   "yours" rather than as part of the shared set — the same distinction the
   My Diets tool makes. */
.cs-own-diet { color: #c0392b; }

/* Shown when a filter matches nothing.
   The old behaviour was a blank grid, which reads as a broken site rather than
   an empty result — especially on a diet filter, where the honest answer is
   "nobody has tagged one of those yet" and not "we have none". */
.cs-empty {
  max-width: 544px;
  margin: 1rem auto 2rem;
  padding: 1.1rem 1.3rem;
  background: #f6f4ef;
  border: 1px solid #e6ded3;
  border-radius: 12px;
  text-align: center;
  font-size: .93rem;
  line-height: 1.6;
  color: #5f574d;
}
.cs-empty strong { display: block; margin-bottom: .3rem; color: #241f1a; }
.cs-empty a { display: inline-block; margin-top: .6rem; color: #2d7d5a; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .cs-empty { background: #201c17; border-color: #332c24; color: #b6aca0; }
  .cs-empty strong { color: #f0e9e0; }
  .cs-empty a { color: #6fae7d; }
}

/* Next/previous chevrons on the recipe panel — desktop only.
 *
 * (any-hover: hover) and (any-pointer: fine), not the bare (hover: hover) and
 * (pointer: fine) this started as. The plain form asks about the PRIMARY
 * input only, and on a touchscreen laptop Windows and Chrome both treat the
 * touchscreen as primary even while a mouse sits right there doing the
 * clicking — so the query read "touch device" and hid the chevrons for
 * anyone on that kind of hardware, cursor and all. any-hover/any-pointer ask
 * "is a fine pointer available at all", which is true the moment a mouse or
 * trackpad exists alongside the touchscreen, and still false on a phone or
 * tablet with nothing but a finger. Touch still gets the swipe gesture in
 * index.php either way; this only widens who sees the chevrons, not who
 * loses the swipe.
 *
 * Flat solid triangles rather than a stroked arrow icon — closer in spirit
 * to the old dinnerbyliane site's own prev/next chevrons than a Bootstrap-style
 * icon would be, and a solid shape reads at a glance over any food photograph
 * without needing an icon font.
 */
/* position: fixed with the horizontal offset set in JS (csRecipeNavRender),
   not hard-coded here. The panel is 400px wide normally but goes to 100%
   below 600px (style.css, the @media block near .recipe-panel) — a fixed
   "400px from the edge" would float in the wrong place the moment someone's
   browser window happens to be narrow enough to trip that breakpoint while
   still using a mouse. Reading the panel's own bounding rect is the only
   version of this that's correct in both cases without duplicating the
   breakpoint number here. */
.cs-recipe-nav {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem;
  height: 3.2rem;
  border: none;
  background: rgba(20, 20, 20, .38);
  cursor: pointer;
  padding: 0;
  z-index: 15;
  transition: background .15s;
}
.cs-recipe-nav svg { width: 100%; height: 100%; fill: rgba(255,255,255,.92); }

/* Directional cursors, carried over from dinnerbyliane's ctrl-img set.
 *
 * The originals are 100x200 — well past what a cursor image reliably
 * renders at. Chrome and Firefox both cap out around 128px in the largest
 * dimension before silently ignoring the image and falling back to the
 * comma-separated keyword, which is exactly the kind of failure nobody
 * notices until someone tests it. -cur.png are the same artwork resized to
 * 32x64, same 1:2 aspect ratio, so nothing about the shape changed — only
 * the size the browser is willing to honour. Hotspot scales with it: the
 * originals were centred at (50,100), so the resized ones centre at (16,32).
 *
 * Cream at rest, dim grey on hover — reads as an accent appearing under the
 * pointer rather than the pointer itself dimming, which is the opposite of
 * the more common "brighten on hover" convention but matches the pairing in
 * the old assets, so kept as supplied. */
.cs-recipe-nav.prev { cursor: url('/ctrl-img/leftcream-cur.png')  16 32, pointer; }
.cs-recipe-nav.next { cursor: url('/ctrl-img/rightcream-cur.png') 16 32, pointer; }
.cs-recipe-nav.prev:hover { cursor: url('/ctrl-img/leftdimgrey-cur.png')  16 32, pointer; }
.cs-recipe-nav.next:hover { cursor: url('/ctrl-img/rightdimgrey-cur.png') 16 32, pointer; }
.cs-recipe-nav:hover { background: rgba(20, 20, 20, .58); }
.cs-recipe-nav:disabled { display: none; }
/* left/right themselves come from the inline style set in
   csRecipeNavRender() — see the comment on .cs-recipe-nav above. */
.cs-recipe-nav.prev { border-radius: 0 8px 8px 0; }
.cs-recipe-nav.next { border-radius: 8px 0 0 8px; }

@media (any-hover: hover) and (any-pointer: fine) {
  .cs-recipe-nav { display: flex; align-items: center; justify-content: center; }
  .cs-recipe-nav:disabled { display: none; }
  .cs-recipe-nav.zone { display: block; }
}

/* The same next/previous, as an invisible click zone over the bottom half of
 * the recipe photo rather than a small button pinned to the screen edge. The
 * photo is the biggest, most obvious thing in the panel — asking someone to
 * find a 2.4rem triangle at the edge of their browser window when there's a
 * much larger natural target right in front of them was always going to be
 * the weaker affordance. The floating buttons stay too: they're the visible
 * cue that this exists at all, since a plain cursor change over an ordinary
 * photograph is easy to miss the first time.
 *
 * Bottom half, not the whole photo: the top half is where a recipe's own
 * title and credits sit just below it, and a click there already means
 * something. Splitting only the lower half keeps the two purposes apart.
 *
 * No visible box, no SVG — the custom cursor above is the entire signal, so
 * the hover tint is barely there on purpose, just enough to notice without
 * drawing an outline around a UI element on someone's dinner.
 */
.cs-recipe-nav.zone {
  position: absolute;
  top: 55%;
  bottom: 0;
  height: auto;      /* the base rule's fixed 3.2rem otherwise wins over top+bottom */
  width: 50%;
  background: transparent;
  border-radius: 0;  /* the floating button's rounded corner, inherited via .prev/.next below */
  transition: background .15s;
}
.cs-recipe-nav.zone:hover { background: rgba(0, 0, 0, .07); }
.cs-recipe-nav.zone.prev { left: 0; }
.cs-recipe-nav.zone.next { right: 0; }

@media (prefers-color-scheme: dark) {
  .cs-recipe-nav { background: rgba(0, 0, 0, .5); }
  .cs-recipe-nav:hover { background: rgba(0, 0, 0, .7); }
}

/* ── Star rating ───────────────────────────────────────────────────────
 *
 * Rendered by cs_rating_html() in includes/ratings.php, on both the recipe
 * panel and the standalone page. The stars are real buttons when the reader
 * is allowed to rate and inert spans when they aren't, so there is nothing
 * to click at that can't actually do anything.
 *
 * Gold only where a star is earned. An unfilled star stays a hollow outline
 * rather than a grey fill, so a 3-of-5 reads as three at a glance instead of
 * as five stars in two shades.
 */
.cs-rating {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
  margin: 0 0 .6rem;
}
.cs-stars { display: inline-flex; gap: .1rem; line-height: 1; }
.cs-star {
  font-size: 1.15rem;
  line-height: 1;
  color: #d8d2c6;            /* unfilled: quiet, and not a second gold */
  background: none;
  border: none;
  padding: 0 .04rem;
  font-family: inherit;
}
.cs-star.on { color: #e8a723; }

/* Only the interactive version gets a pointer, a hover and a focus ring */
.cs-rating.can-rate .cs-star { cursor: pointer; transition: transform .12s, color .12s; }
.cs-rating.can-rate .cs-stars:hover .cs-star { color: #d8d2c6; }
.cs-rating.can-rate .cs-star:hover,
.cs-rating.can-rate .cs-star:hover ~ .cs-star { color: #d8d2c6; }
/* Hovering star 4 should light 1 to 4. CSS can only look forwards, so the row
   is lit left-to-right and then dimmed from the hovered star onwards — hence
   the two rules above undoing, and this one re-lighting up to the cursor. */
.cs-rating.can-rate .cs-stars:hover .cs-star:hover { color: #e8a723; }
.cs-rating.can-rate .cs-star:hover { transform: scale(1.18); }
.cs-rating.can-rate .cs-star:focus-visible { outline: 2px solid #2d7d5a; outline-offset: 2px; border-radius: 3px; }
.cs-rating.saving { opacity: .55; pointer-events: none; }

.cs-rating-note { font-size: .78rem; color: #999; }
.cs-rating-note em { font-style: normal; color: #2d7d5a; font-weight: 600; }

@media (prefers-color-scheme: dark) {
  .cs-star { color: #4a463e; }
  .cs-rating.can-rate .cs-stars:hover .cs-star,
  .cs-rating.can-rate .cs-star:hover ~ .cs-star { color: #4a463e; }
  .cs-rating-note { color: #888; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-rating.can-rate .cs-star { transition: none; }
  .cs-rating.can-rate .cs-star:hover { transform: none; }
}

/* ── Moderation banner ─────────────────────────────────────────────────
 *
 * Only ever seen by a recipe's own author or an admin, because nobody else
 * can load an unapproved recipe at all. Its job is to answer "did my save
 * work?" before the question is asked, so it sits above everything and
 * states the position plainly rather than decorating it.
 */
.cs-mod-banner {
  margin: 0 0 .9rem;
  padding: .65rem .8rem;
  border-radius: 8px;
  border-left: 3px solid #b07a1e;
  background: #fdf6e7;
  color: #6b5626;
  font-size: .85rem;
  line-height: 1.5;
}
.cs-mod-banner strong { display: block; color: #8a6414; font-weight: 700; }
.cs-mod-banner.bad { border-left-color: #b0442c; background: #fbeae5; color: #7a3527; }
.cs-mod-banner.bad strong { color: #a23a22; }
.cs-mod-why {
  display: block;
  margin-top: .35rem;
  font-style: italic;
  opacity: .85;
}
@media (prefers-color-scheme: dark) {
  .cs-mod-banner { background: #2a2415; color: #d8c79c; border-left-color: #b07a1e; }
  .cs-mod-banner strong { color: #e0bd6c; }
  .cs-mod-banner.bad { background: #2c1b16; color: #e0a897; }
  .cs-mod-banner.bad strong { color: #e0755a; }
}

/* A save that went through but isn't public yet. Not an error, so not red;
   not a clean success either, so not the green the others use. */
.save-result.pending {
  background: #fdf6e7;
  color: #6b5626;
  border-left: 3px solid #b07a1e;
  text-align: left;
}
@media (prefers-color-scheme: dark) {
  .save-result.pending { background: #2a2415; color: #d8c79c; }
}

/* ── "Join us" tiles in the grid ───────────────────────────────────────
 *
 * Only rendered for visitors who aren't signed in, twice in a page of 120.
 * Shaped like a recipe card so the grid rows stay intact, but deliberately
 * not dressed like one: no photograph, no image area, and the words sit in
 * the space a picture would occupy. A tile that mimics a recipe and turns
 * out to be a sign-up prompt is a small dishonesty people remember.
 */
.join-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: .8rem .6rem;
  gap: .28rem;
  background: #edf7f2;
  /* Solid, not dashed. A dashed border reads as a placeholder or a drop
     zone; the tile is already obviously not a recipe because it has no
     photograph, so the border only has to be tidy. */
  border: 1px solid #bfe0cf;
  box-shadow: none;
  text-decoration: none;
  color: #1f5640;
}
.join-card:hover {
  background: #e3f2ea;
  border-color: #2d7d5a;
  transform: scale(1.02);   /* the same lift a recipe tile gets */
}
.join-icon { font-size: 1.45rem; line-height: 1; color: #2d7d5a; }
.join-head {
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.join-body { font-size: .71rem; line-height: 1.3; color: #4d7a67; }
/* A filled pill rather than an underlined link. Underlined text inside a
   tile of photographs is easy to read past, and this is the one thing on
   the tile that is supposed to be pressed. It is the only saturated colour
   in the grid apart from the favourite hearts, which is what gives it the
   punch without the whole tile having to shout. */
.join-cta {
  margin-top: .3rem;
  padding: .3rem .7rem;
  background: #2d7d5a;
  color: #fff;
  border-radius: 999px;
  font-size: .71rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.join-card:hover .join-cta { background: #24664a; }

@media (prefers-color-scheme: dark) {
  .join-card { background: #16261f; border-color: #2f5b46; color: #cfe6da; }
  .join-card:hover { background: #1b2f26; border-color: #6fae7d; }
  .join-icon { color: #6fae7d; }
  .join-body { color: #8fae9d; }
  .join-cta { background: #2d7d5a; color: #fff; }
  .join-card:hover .join-cta { background: #38996e; }
}
@media (prefers-reduced-motion: reduce) {
  .join-card:hover { transform: none; }
}

/* Scattered produce on the join tiles.
   Decorative only. Sits behind the words at low opacity, so the tile reads
   as a hand-strewn border of vegetables rather than as text printed over a
   picture. The words keep their own stacking context above it. */
.join-card { position: relative; overflow: hidden; }
.join-scatter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.join-scatter i {
  position: absolute;
  font-style: normal;
  line-height: 1;
  /* Emoji ignore CSS colour entirely, so opacity is the only way to sit
     them behind the words. At .38 they read as smudges rather than as
     vegetables; half is enough to recognise a chilli without it competing
     with the heading. */
  opacity: .5;
}
/* Everything readable sits above the scatter */
.join-icon, .join-head, .join-body, .join-cta { position: relative; z-index: 1; }

@media (prefers-color-scheme: dark) {
  .join-scatter i { opacity: .3; }
}

/* Visually hidden, but read aloud and indexed.
   The standard clip pattern rather than display:none, which would remove
   the element from the accessibility tree entirely and defeat the point.
   Used for the home page's h1: the page needs a heading for its outline,
   but showing one would push the recipe grid back below the fold. */
.cs-vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── Adapting a recipe to a diet ──────────────────────────────────────
   The row under the ingredients on a recipe. Quiet by default: this is a
   suggestion about somebody else's recipe, and it shouldn't shout over the
   recipe itself. The active diet goes green; the note under it carries the
   AI warning and is the one part meant to be read properly. */
.cs-adapt { margin: .9rem 0 .25rem; display: flex; flex-wrap: wrap;
            align-items: center; gap: .35rem; }
.cs-adapt-lede { font-size: .78rem; color: #999; margin-right: .2rem; width: 100%; }
.cs-adapt-btn { background: none; border: 1px dashed #ccc; border-radius: 20px;
                padding: .3rem .7rem; font-size: .78rem; font-weight: 600;
                color: #666; cursor: pointer; font-family: inherit; }
.cs-adapt-btn:hover { border-color: #2d7d5a; color: #2d7d5a; background: #f5fbf8; }
.cs-adapt-btn:disabled { opacity: .55; cursor: default; }
.cs-adapt-btn.on { border-style: solid; border-color: #2d7d5a; color: #fff; background: #2d7d5a; }
.cs-adapt-back { border-style: solid; }
.cs-adapt-msg { width: 100%; margin: .5rem 0 0; font-size: .8rem; line-height: 1.5; color: #666; }
.cs-adapt-msg.on { background: #f0f9f5; border-left: 3px solid #2d7d5a;
                   border-radius: 0 8px 8px 0; padding: .6rem .8rem; }
.cs-adapt-msg.on i { color: #8a6100; font-style: normal; font-size: .75rem; }
.cs-adapt-msg.warn { background: #fdf3e0; border-left: 3px solid #d9a441;
                     border-radius: 0 8px 8px 0; padding: .6rem .8rem; color: #7a5c00; }
@media (prefers-color-scheme: dark) {
  .cs-adapt-btn { border-color: #444; color: #bbb; }
  .cs-adapt-msg.on { background: #1a2e24; }
  .cs-adapt-msg.warn { background: #33280f; color: #d8ad4f; }
}

/* ── "Start from…" in the Add Recipe panel ────────────────────────────
   The three AI routes used to be tiles on the home page, where they took
   half the first screen from every visitor and had no room to explain
   themselves. Here they are a choice made after somebody has decided to add
   something, and each gets a line saying what it does. */
.cs-start { margin: 0 0 1.1rem; }
.cs-start-lede { display: block; font-size: .72rem; font-weight: 700; color: #999;
                 text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; }
.cs-start-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
                gap: .5rem; }
.cs-start-btn { text-align: left; background: #fff; border: 1px solid #e5e5e5;
                border-radius: 10px; padding: .6rem .7rem; cursor: pointer;
                font-family: inherit; color: inherit; }
.cs-start-btn b { display: block; font-size: .85rem; font-weight: 700; }
.cs-start-btn small { display: block; margin-top: .15rem; font-size: .72rem;
                      color: #999; line-height: 1.35; }
.cs-start-btn:hover { border-color: #2d7d5a; background: #f5fbf8; }
.cs-start-btn.on { border-color: #2d7d5a; box-shadow: inset 0 0 0 1px #2d7d5a; }
@media (prefers-color-scheme: dark) {
  .cs-start-btn { background: #1e1e1e; border-color: #3a3a3a; }
  .cs-start-btn:hover { background: #243029; }
}

/* The one demo tile a signed-out visitor sees, in place of the three AI
   tiles. Wider than the old thirds because it stands alone, and it carries
   a line of explanation — the tiles never had room for one. */
.action-button.cs-demo { flex: 1 1 100%; flex-direction: row; gap: .8rem;
                         align-items: center; justify-content: flex-start;
                         padding: .9rem 1.1rem; text-align: left; }
.action-button.cs-demo span { font-size: .95rem; font-weight: 700; }
.action-button.cs-demo small { display: block; margin-top: .15rem; font-size: .75rem;
                               font-weight: 400; color: #888; line-height: 1.4; }
@media (prefers-color-scheme: dark) { .action-button.cs-demo small { color: #999; } }

/* ── Brand bar ────────────────────────────────────────────────────────
   The logo was a button for the social feed, which meant the one mark
   carrying the site's name sent you somewhere with nothing to do with it —
   and the name appeared nowhere else on the page at all. It lives here now,
   in the filter bar, which sticks to the top: the brand stays on screen
   however far down the grid you are, the way Samsung Food's does. */
.selection-bar {
  position: sticky;
  top: 0;
  z-index: 9;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid #eee;
}
.cs-brand { display: flex; align-items: center; margin-right: auto;
            padding-left: 4px; text-decoration: none; }
.cs-brand img { height: 34px; width: auto; display: block; }

/* ── The three doors: Food, Social, Pantry ────────────────────────────
   One shape, one weight of line, one colour each — drawn in the same hand
   as the ingredients icon that was already on the page. The pastel fills
   the old squares used are gone: three different pastels behind three
   different drawings read as three unrelated things. */
.top-button.door-food,
.top-button.door-social,
.top-button.door-pantry {
  width: 108px;
  height: 108px;
  background: #fff;
  border: 1px solid #ececec;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  transition: border-color .15s, transform .15s;
}
.top-button.door-food:hover,
.top-button.door-social:hover,
.top-button.door-pantry:hover { border-color: #2d7d5a; transform: translateY(-2px); }
.top-button.door-social { position: relative; }

.cs-food-row { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

@media (prefers-color-scheme: dark) {
  .selection-bar { background: rgba(17,17,17,.94); border-bottom-color: #262626; }
  .top-button.door-food,
  .top-button.door-social,
  .top-button.door-pantry { background: #1e1e1e; border-color: #333; color: #ddd; }
}
@media (max-width: 620px) {
  .cs-brand img { height: 28px; }
  .top-button.door-food,
  .top-button.door-social,
  .top-button.door-pantry { width: 92px; height: 92px; }
}

/* The old three-AI-tile row is kept in the markup, hidden, so it can be put
   back in one word if the three doors don't work out. display:flex above
   beats the hidden attribute on its own, hence this. */
.action-buttons[hidden] { display: none; }

/* The signed-out demo tile: pinned to the width of the three doors above it
   rather than running the full width of a desktop window, where one green
   band across the page looked like an error message. */
.action-button.cs-demo { max-width: 420px; margin: 0 auto; }

/* Back to the original square: three of them and two gaps inside 544px, the
   width the featured card and the panels already use. They grow a little on
   a wide desktop and shrink on a phone, but 544 is the shape everything else
   on this page is cut to. */
.header-wrapper { gap: 1.5rem; max-width: 544px; margin: 0 auto; }
.top-button.door-food,
.top-button.door-social,
.top-button.door-pantry { width: 100px; height: 100px; }
@media (min-width: 1100px) {
  .header-wrapper { max-width: 640px; gap: 2rem; }
  .top-button.door-food,
  .top-button.door-social,
  .top-button.door-pantry { width: 120px; height: 120px; }
}

/* ── The invitation shown instead of the grid ─────────────────────────
   Four reasons, then the button. The order matters: a sign-in form with no
   argument in front of it is a toll gate, and the usual answer to a toll
   gate is the back button. */
.cs-invite { max-width: 544px; margin: 1.5rem auto 3rem; padding: 1.75rem 1.5rem 1.5rem;
             background: #fff; border: 1px solid #ececec; border-radius: 14px;
             box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.cs-invite h2 { margin: 0 0 1rem; font-size: 1.15rem; font-weight: 800; }
.cs-invite ul { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.cs-invite li { display: flex; gap: .7rem; align-items: flex-start;
                padding: .55rem 0; font-size: .92rem; line-height: 1.45; color: #555; }
.cs-invite li span { font-size: 1.25rem; line-height: 1.2; }
.cs-invite li b { color: #1a1a1a; font-weight: 700; }
.cs-invite-btn { display: block; text-align: center; background: #2d7d5a; color: #fff;
                 border-radius: 10px; padding: .8rem; font-size: 1rem; font-weight: 700;
                 text-decoration: none; }
.cs-invite-btn:hover { filter: brightness(1.08); }
.cs-invite-foot { margin: .8rem 0 0; text-align: center; font-size: .82rem; color: #999; }
.cs-invite-foot a { color: #2d7d5a; font-weight: 600; text-decoration: none; }
/* Nothing to filter behind a gate, so the bar is just the brand and the account */
.selection-bar.bare { justify-content: space-between; }
@media (prefers-color-scheme: dark) {
  .cs-invite { background: #1e1e1e; border-color: #333; }
  .cs-invite li { color: #bbb; }
  .cs-invite li b { color: #eee; }
}

/* ── Brand bar, filters moved out ─────────────────────────────────────
   A phone is 375 points wide: brand + two dropdowns + heart + avatar don't
   fit, so the logo was clipped on the left and the avatar pushed off the
   right. The bar now carries the brand and the account only, and the
   filters sit under the three doors, next to the recipes they filter. */
.selection-bar { justify-content: space-between; padding: 8px 12px; }
.cs-brand img { height: 46px; }

.filter-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 12px 12px;
}
.filter-bar select {
  padding: 6px 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  max-width: 44vw;          /* two of them side by side on the narrowest phone */
}

@media (max-width: 620px) {
  .cs-brand img { height: 38px; }
  /* The three doors share the width evenly rather than being fixed squares:
     at 375 points three 100px squares plus gaps overflowed. */
  .header-wrapper { gap: .6rem; padding: .75rem .75rem 0; max-width: none; }
  .top-button.door-food,
  .top-button.door-social,
  .top-button.door-pantry { flex: 1 1 0; width: auto; height: 96px; }
}
@media (prefers-color-scheme: dark) {
  .filter-bar select { background: #1e1e1e; color: #ddd; border-color: #444; }
}

/* On a phone the bold phrase and its tail were sharing a line and each
   wrapping separately, which read as two ragged columns. Stack them. */
@media (max-width: 480px) {
  .cs-invite li { flex-wrap: wrap; }
  .cs-invite li b { flex: 1 1 100%; }
}

/* Invitation lines: icon | heading over explanation. */
.cs-invite li { align-items: flex-start; }
.cs-invite li div { display: flex; flex-direction: column; gap: .1rem; }
.cs-invite li b { font-size: .95rem; }
.cs-invite li em { font-style: normal; font-size: .85rem; color: #777; line-height: 1.4; }
@media (max-width: 480px) {
  /* Undo the earlier stacking attempt, which put the emoji on its own line */
  .cs-invite li { flex-wrap: nowrap; }
  .cs-invite li b { flex: 0 1 auto; }
}
@media (prefers-color-scheme: dark) { .cs-invite li em { color: #999; } }

/* Room between the three doors and the filters. They were sitting right
   under the buttons with nothing between them, so the row read as part of
   the buttons rather than as the start of the recipes. */
.filter-bar { padding-top: 1rem; }
@media (max-width: 620px) {
  .filter-bar { padding-top: .9rem; gap: 8px; }
  /* 40vw each leaves room for the heart on the same line rather than
     dropping it onto a row of its own */
  .filter-bar select { max-width: 40vw; }
}

/* ── The invitation, warmed up ────────────────────────────────────────
   A white page selling food with no food on it reads as a form. The card
   opens with the featured dish, and the page behind it takes a pale warm
   tint rather than the flat white the grid sits on — where photographs
   supply the colour and white is right. */
body.cs-gated { background: #faf7f2; }
body.cs-gated .selection-bar { background: rgba(250,247,242,.94); }

.cs-invite { margin-top: .75rem; overflow: hidden; padding-top: 0; }
.cs-invite-pic { margin: 0 -1.5rem 1.25rem; height: 160px; overflow: hidden; }
.cs-invite-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-invite h2 { margin-top: 0; padding-top: .25rem; font-size: 1.2rem; line-height: 1.3; }
@media (max-width: 480px) { .cs-invite-pic { height: 130px; } }
@media (prefers-color-scheme: dark) {
  body.cs-gated { background: #14120f; }
  body.cs-gated .selection-bar { background: rgba(20,18,15,.94); }
}

/* ── Phone: two columns, not three ────────────────────────────────────
   The grid was three fixed 100px squares. At that size a recipe title is
   clamped to three lines of nothing useful — "Middle Eastern Spice…" tells
   you neither the dish nor the ingredient — and the photographs, which are
   the reason anyone stops scrolling, are thumbnails. Two flexible columns
   give both room. */
@media (max-width: 619px) {
  .recipes-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    padding: 0 12px 2.5rem;
    justify-content: stretch;
  }
  .recipe-card .title { font-size: 15px; padding: .55rem .6rem; }
  /* The doors give back a fifth of their height, so a row of food shows
     above the fold on arrival. */
  .top-button.door-food,
  .top-button.door-social,
  .top-button.door-pantry { height: 80px; }
  .top-button.door-food svg,
  .top-button.door-social svg,
  .top-button.door-pantry svg { width: 34px; height: 34px; }
}

/* The favourites filter, now a labelled chip rather than a bare heart. */
.fav-filter {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  width: auto;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.fav-filter:hover { border-color: #2d7d5a; color: #2d7d5a; }
.fav-filter.on { background: #2d7d5a; border-color: #2d7d5a; color: #fff; }
@media (prefers-color-scheme: dark) {
  .fav-filter { background: #1e1e1e; border-color: #444; color: #bbb; }
}

/* The three doors are <button> now, not <div onclick>: reachable by keyboard
   and announced as buttons rather than as anonymous boxes. Buttons bring
   their own padding, font and focus ring, so reset what we don't want and
   keep a visible focus outline, which is the point of the change. */
.top-button.door-food,
.top-button.door-social,
.top-button.door-pantry { padding: 0; font-family: inherit; -webkit-appearance: none; appearance: none; }
.top-button.door-food:focus-visible,
.top-button.door-social:focus-visible,
.top-button.door-pantry:focus-visible { outline: 2px solid #2d7d5a; outline-offset: 2px; }

/* ── The recipe photo on a phone ──────────────────────────────────────
   Portrait phone snapshots opened at their native height, which is roughly
   half the screen — so "Add to plan", "Shop" and the ingredients all began
   below the fold on the one screen where somebody is deciding whether to
   cook the thing. Capped, and cropped from the middle where the plate is. */
@media (max-width: 620px) {
  .recipe-image-wrap img { max-height: 42vh; object-fit: cover; }
}

/* "You've been signed out" — shown when the page discovers, on coming back
   to the foreground, that the server no longer agrees about who it is
   talking to. Anchored to the bottom, above everything, and deliberately
   plain: it is bad news and dressing it up helps nobody. */
#csStaleBar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10002;
  background: #8a6100;
  color: #fff;
  padding: .7rem 1rem;
  font-size: .85rem;
  text-align: center;
}
#csStaleBar button {
  margin-left: .6rem;
  background: #fff;
  color: #8a6100;
  border: none;
  border-radius: 6px;
  padding: .3rem .8rem;
  font-size: .82rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

/* Desktop: the three doors sat tight under the header bar with all the air
   below them, so they read as hanging off the header rather than as a row
   of their own. Equal space above and below centres them between the bar
   and the filters. The phone layout is already right and keeps its own
   tighter spacing. */
@media (min-width: 620px) {
  .header-wrapper { padding: 2rem 0 0; }
  .filter-bar     { padding-top: 2rem; }
}

/* ── The video on a recipe ────────────────────────────────────────────
   A poster and a play button, and no YouTube iframe until the button is
   pressed. That is what keeps it out of the consent banner: nothing is
   requested from Google, and nothing is set, until somebody asks to watch.
   16:9 held by aspect-ratio so the page doesn't jump when it loads. */
.cs-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px;
            overflow: hidden; background: #111; cursor: pointer; }
.cs-video-poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-video-play {
  position: absolute; inset: 0; margin: auto;
  width: 68px; height: 48px; padding: 0;
  background: none; border: none; cursor: pointer;
}
.cs-video-play svg { display: block; }
.cs-video-play-bg { fill: #212121; opacity: .8; transition: fill .15s, opacity .15s; }
.cs-video:hover .cs-video-play-bg { fill: #f00; opacity: 1; }
.cs-video-play:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.cs-video-note {
  position: absolute; right: .5rem; bottom: .45rem;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: .68rem; padding: .15rem .45rem; border-radius: 4px;
}
.cs-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.re-hint { font-size: .75rem; color: #999; margin: .3rem 0 0; line-height: 1.4; }

/* ── Meals on Reels ───────────────────────────────────────────────────
   The listing of recipes with a video, and the marker that says a tile has
   one. The marker is deliberately small: it is a fact about the recipe, not
   a call to action, and a red triangle on every card would shout. */
.cs-reels-head { max-width: 544px; margin: 0 auto 1.25rem; text-align: center; }
.cs-reels-head h2 { margin: 0 0 .2rem; font-size: 1.25rem; font-weight: 800; }
.cs-reels-head p  { margin: 0; font-size: .85rem; color: #888; }

.recipe-card { position: relative; }
.cs-card-video {
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: .6rem;
  border-radius: 50%;
  padding-left: 2px;          /* the triangle sits left-heavy in its box */
}
@media (prefers-color-scheme: dark) { .cs-reels-head p { color: #999; } }

/* ── The journal ──────────────────────────────────────────────────────
   Set for reading rather than for scanning: one column, generous measure,
   larger type than the rest of the site. A recipe is looked at; an article
   is read, and the two want different pages. */
.jr-page { max-width: 680px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }
.jr-head { margin: 1.5rem 0 2rem; }
.jr-head h1 { font-size: 1.9rem; font-weight: 800; margin: 0 0 .4rem; line-height: 1.2; }
.jr-head p  { margin: 0; color: #777; font-size: .95rem; line-height: 1.6; }

.jr-article h1 { font-size: 1.9rem; font-weight: 800; line-height: 1.2; margin: 1.25rem 0 .5rem; }
.jr-hero { width: 100%; border-radius: 12px; display: block; }
.jr-stand { font-size: 1.05rem; color: #555; line-height: 1.55; margin: 0 0 .75rem; }
.jr-by { font-size: .82rem; color: #999; margin: 0 0 1.75rem; }
.jr-draft { background: #fdf3e0; color: #8a6100; border-radius: 4px;
            padding: .1rem .45rem; margin-left: .4rem; font-weight: 600; }

.jr-body p  { font-size: 1.02rem; line-height: 1.75; margin: 0 0 1.2rem; }
.jr-body h2 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 .6rem; }
.cs-art-inline { color: #2d7d5a; font-weight: 600; text-decoration: none;
                 border-bottom: 1px solid #cfe7db; }
.cs-art-inline:hover { border-bottom-color: #2d7d5a; }

.jr-recipes-head { font-size: 1.1rem; font-weight: 700; margin: 2.5rem 0 .75rem; }
.jr-recipes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.jr-recipe { text-decoration: none; color: inherit; background: #fff;
             border: 1px solid #eee; border-radius: 10px; overflow: hidden; display: block; }
.jr-recipe img, .jr-recipe-noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
                                   background: #f0f0f0; }
.jr-recipe span { display: block; padding: .5rem .6rem; font-size: .82rem; font-weight: 600;
                  line-height: 1.3; }
.jr-recipe:hover { border-color: #2d7d5a; }

.jr-note { margin: 2.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid #eee;
           font-size: .78rem; color: #999; line-height: 1.6; }

.jr-list { display: flex; flex-direction: column; gap: 1rem; }
.jr-card { display: flex; gap: 1rem; text-decoration: none; color: inherit;
           background: #fff; border: 1px solid #eee; border-radius: 12px;
           padding: .85rem; align-items: flex-start; }
.jr-card:hover { border-color: #2d7d5a; }
.jr-card img { width: 110px; height: 90px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.jr-card h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .25rem; line-height: 1.3; }
.jr-card h2 em { font-style: normal; font-size: .7rem; background: #fdf3e0; color: #8a6100;
                 border-radius: 4px; padding: .1rem .4rem; margin-left: .35rem; vertical-align: middle; }
.jr-card p { margin: 0 0 .35rem; font-size: .85rem; color: #777; line-height: 1.5; }
.jr-meta { font-size: .75rem; color: #aaa; }

@media (max-width: 560px) {
  .jr-card { flex-direction: column; }
  .jr-card img { width: 100%; height: 150px; }
}
@media (prefers-color-scheme: dark) {
  .jr-head p, .jr-stand { color: #aaa; }
  .jr-recipe, .jr-card { background: #1e1e1e; border-color: #333; }
  .jr-note { border-top-color: #262626; }
}

/* ── The journal editor ───────────────────────────────────────────────
   A page, not a panel: nobody writes eight hundred words in a sidebar, and
   a stray tap outside a panel should not be able to close the thing you
   have been talking into for ten minutes. */
.je-page { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 5rem; }
.je-h1 { font-size: 1.5rem; font-weight: 800; margin: 1rem 0 1.5rem; }
.je-lbl { display: block; font-size: .72rem; font-weight: 700; color: #999;
          text-transform: uppercase; letter-spacing: .05em; margin: 1.25rem 0 .35rem; }
.je-lbl small { text-transform: none; letter-spacing: 0; font-weight: 400; color: #bbb; }
.je-page input[type=text], .je-page textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px;
  padding: .6rem .8rem; font-size: .95rem; font-family: inherit; background: #fff; color: inherit;
}
.je-page textarea { line-height: 1.7; resize: vertical; min-height: 320px; }
.je-page input:focus, .je-page textarea:focus { outline: none; border-color: #2d7d5a; }
.je-hint { font-size: .76rem; color: #999; margin: .4rem 0 0; line-height: 1.5; }
.je-note { font-size: .78rem; color: #888; }

.je-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .5rem 0; }
.je-btn { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: .4rem .75rem;
          font-size: .82rem; font-weight: 600; color: #555; cursor: pointer; font-family: inherit; }
.je-btn:hover { border-color: #2d7d5a; color: #2d7d5a; background: #f5fbf8; }
.je-sel { padding-right: .4rem; max-width: 230px; }
.je-mic.on { background: #c0392b; border-color: #c0392b; color: #fff; }

.je-hero { margin: .25rem 0 .5rem; }
.je-hero img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; display: block; }

.je-foot { display: flex; align-items: center; gap: .9rem; margin-top: 1.5rem;
           padding-top: 1rem; border-top: 1px solid #eee; }
.je-pub { font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.je-save { margin-left: auto; background: #2d7d5a; color: #fff; border: none; border-radius: 8px;
           padding: .6rem 1.4rem; font-size: .9rem; font-weight: 700; cursor: pointer; font-family: inherit; }

/* ── Embedded video, loaded only on request ───────────────────────── */
.cs-embed { margin: 1.5rem 0; border: 1px solid #e5e5e5; border-radius: 12px; overflow: hidden;
            background: #fafafa; text-align: center; }
.cs-embed-play { width: 100%; background: none; border: none; padding: 1.75rem 1rem 1rem;
                 cursor: pointer; font-family: inherit; display: block; }
.cs-embed-ico { display: block; font-size: 1.6rem; color: #2d7d5a; }
.cs-embed-label { display: block; font-size: .95rem; font-weight: 700; margin-top: .3rem; }
.cs-embed-play small { display: block; font-size: .72rem; color: #999; margin-top: .3rem; }
.cs-embed-out { display: inline-block; margin: 0 0 1rem; font-size: .76rem; color: #888; }
.cs-embed iframe { width: 100%; min-height: 420px; border: 0; display: block; }

.jr-fig { margin: 1.75rem 0; }
.jr-fig img { width: 100%; border-radius: 10px; display: block; }
.jr-fig figcaption { font-size: .78rem; color: #999; margin-top: .45rem; line-height: 1.5; }

@media (prefers-color-scheme: dark) {
  .je-page input[type=text], .je-page textarea, .je-btn { background: #1e1e1e; border-color: #3a3a3a; color: #ddd; }
  .cs-embed { background: #1a1a1a; border-color: #333; }
}

/* The masthead stands in for the journal's title, so the h1 holds a picture
   and the words live in its alt text. Centred, with room to breathe: it is
   a cover, not a header bar. */
.jr-masthead { margin: .5rem 0 1rem; text-align: center; }
.jr-masthead img { width: 100%; max-width: 640px; height: auto; display: inline-block; }
.jr-head { text-align: center; }
.jr-head p { max-width: 480px; margin: 0 auto; }
@media (max-width: 560px) { .jr-masthead img { max-width: 92vw; } }

/* ── Series in the journal ────────────────────────────────────────────
   A series is a promise that there will be more of these, so it is named
   above the headline on an article and carried as a chip on the index. */
.jr-series-nav { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center;
                 margin: 1rem 0 0; }
.jr-series-chip { text-decoration: none; font-size: .8rem; font-weight: 600; color: #666;
                  border: 1px solid #ddd; border-radius: 20px; padding: .28rem .75rem; }
.jr-series-chip:hover { border-color: #2d7d5a; color: #2d7d5a; }
.jr-series-chip.on { background: #2d7d5a; border-color: #2d7d5a; color: #fff; }
.jr-series-chip span { opacity: .65; margin-left: .2rem; font-weight: 400; }
.jr-series-title { font-size: 1.4rem; font-weight: 800; margin: .75rem 0 .3rem; }

.jr-card-series { display: inline-block; font-size: .7rem; font-weight: 700;
                  text-transform: uppercase; letter-spacing: .04em; color: #2d7d5a;
                  margin-bottom: .2rem; }
.jr-art-series { display: inline-block; font-size: .78rem; font-weight: 700;
                 text-transform: uppercase; letter-spacing: .04em; color: #2d7d5a;
                 text-decoration: none; margin: 1.25rem 0 .1rem; }
.jr-art-series:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  .jr-series-chip { border-color: #444; color: #bbb; }
}

/* ── "All you can eat!" ───────────────────────────────────────────────
   Hand-drawn lettering, used as a mask rather than as a picture: the PNG
   supplies the shape through its alpha channel and the colour comes from
   here. One file, any colour, and it can be inverted for dark mode without
   a second export.

   Left-aligned under the masthead, which itself moves left: a magazine
   cover hangs its furniture off one edge, and two centred blocks of
   different widths look like neither was decided. */
.jr-masthead { text-align: left; }
.jr-masthead img { max-width: 560px; }

.jr-aye {
  display: block;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1552 / 239;
  margin: .35rem 0 0 .5rem;
  background: #7a2020;
  -webkit-mask: url(/All-You-Can-Eat.png) left center / contain no-repeat;
          mask: url(/All-You-Can-Eat.png) left center / contain no-repeat;
}

@media (max-width: 560px) {
  .jr-masthead img { max-width: 100%; }
  .jr-aye { max-width: 72vw; margin-left: .25rem; }
}
@media (prefers-color-scheme: dark) {
  /* The deep red disappears against a dark ground; the brand's orange holds */
  .jr-aye { background: #d9734f; }
}

/* Left, not centre. The masthead and the strapline are different widths, so
   centring both leaves two ragged edges and looks like neither was placed;
   hung off the left margin they share an edge and read as one block —
   which is how a cover is built. */
.jr-head { text-align: left; }
.jr-head p { max-width: 460px; margin: .75rem 0 0; }
.jr-series-nav { justify-content: flex-start; }

/* ── Masthead, down to two thirds ─────────────────────────────────────
   It was running to 560px on a 680px column, which is a cover, not a page
   heading — the first article began below the fold. Two thirds of that
   leaves room for the strapline, the series chips and a piece of writing
   above the fold, and the lettering is still legible at 380.

   The strapline tucks straight underneath with almost no gap: they are one
   piece of furniture, in the way a newspaper's title and its slogan are. */
.jr-masthead { margin: .25rem 0 .75rem; }
.jr-masthead img { max-width: 380px; }
.jr-aye { max-width: 300px; margin: -.15rem 0 0 .35rem; }

@media (max-width: 560px) {
  .jr-masthead img { max-width: 76vw; }
  .jr-aye { max-width: 60vw; margin-left: .25rem; }
}

/* ── Series shelves on the journal index ──────────────────────────────
   A monthly column would otherwise take the top of the page every month,
   whether or not it was the most interesting thing there. Features run in
   the main list; each series gets its own shelf beneath, the way a regular
   column has its own slot in a paper. */
.jr-shelf { margin: 2.5rem 0 0; padding-top: 1.5rem; border-top: 1px solid #eee; }
.jr-shelf h2 { display: flex; align-items: baseline; gap: .75rem;
               font-size: 1.1rem; font-weight: 800; margin: 0 0 .9rem; }
.jr-shelf h2 a { color: inherit; text-decoration: none; }
.jr-shelf h2 a:hover { color: #2d7d5a; }
.jr-shelf-all { margin-left: auto; font-size: .78rem; font-weight: 600; color: #2d7d5a; }
.jr-shelf-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.jr-shelf-card { text-decoration: none; color: inherit; }
.jr-shelf-card img, .jr-shelf-noimg { width: 100%; aspect-ratio: 4/3; object-fit: cover;
                                      border-radius: 8px; display: block; background: #f0f0f0; }
.jr-shelf-card strong { display: block; font-size: .85rem; font-weight: 700;
                        line-height: 1.35; margin: .4rem 0 .15rem; }
.jr-shelf-card em { font-style: normal; font-size: .68rem; background: #fdf3e0; color: #8a6100;
                    border-radius: 4px; padding: .05rem .3rem; margin-left: .3rem; }
.jr-shelf-card span { font-size: .72rem; color: #aaa; }
.jr-shelf-card:hover strong { color: #2d7d5a; }

/* ── Inside an article ───────────────────────────────────────────────── */
.jr-body h3 { font-size: 1.02rem; font-weight: 700; margin: 1.75rem 0 .5rem; }
.jr-list-items { margin: 0 0 1.2rem 1.25rem; padding: 0; }
.jr-list-items li { font-size: 1.02rem; line-height: 1.7; margin-bottom: .5rem; }
.jr-table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.jr-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.jr-table th, .jr-table td { text-align: left; padding: .5rem .7rem; border-bottom: 1px solid #eee; }
.jr-table th { font-weight: 700; background: #faf9f7; white-space: nowrap; }
@media (prefers-color-scheme: dark) {
  .jr-shelf { border-top-color: #262626; }
  .jr-table th { background: #1e1e1e; }
  .jr-table th, .jr-table td { border-bottom-color: #2a2a2a; }
}

/* ── The lead article, and the issue furniture ───────────────────────
   An issue opens with one piece given room, the way a cover does. Below it
   the features run as the ordinary cards; the difference in size is the
   editing decision made visible. */
.jr-lead { display: block; text-decoration: none; color: inherit; margin: 0 0 1.75rem; }
.jr-lead img { width: 100%; border-radius: 12px; display: block; margin-bottom: .75rem; }
.jr-lead h2 { font-size: 1.5rem; font-weight: 800; line-height: 1.25; margin: 0 0 .35rem; }
.jr-lead h2 em { font-style: normal; font-size: .7rem; background: #fdf3e0; color: #8a6100;
                 border-radius: 4px; padding: .1rem .4rem; margin-left: .35rem; vertical-align: middle; }
.jr-lead p { margin: 0 0 .4rem; font-size: 1rem; color: #666; line-height: 1.55; }
.jr-lead:hover h2 { color: #2d7d5a; }
.jr-issue-line { font-size: .85rem; color: #888; margin: .75rem 0 0; }
.jr-issue-line a { color: #2d7d5a; }

/* ── The issue manager ───────────────────────────────────────────────── */
.ji-page { max-width: 940px; margin: 0 auto; padding: 1rem 1.25rem 5rem; }
.ji-pick { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.ji-pick label { font-size: .78rem; font-weight: 700; color: #999; text-transform: uppercase; }
.ji-pick select { padding: .45rem .6rem; border: 1px solid #ddd; border-radius: 8px;
                  font-size: .9rem; font-family: inherit; background: #fff; color: inherit; }
.ji-msg { background: #f0f9f5; border-left: 3px solid #2d7d5a; border-radius: 0 8px 8px 0;
          padding: .6rem .8rem; font-size: .85rem; color: #2d7d5a; }
.ji-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
.ji-table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
               color: #999; padding: .4rem .5rem; border-bottom: 1px solid #eee; }
.ji-table td { padding: .5rem; border-bottom: 1px solid #f4f4f4; vertical-align: middle; }
.ji-table select, .ji-table input { padding: .35rem .5rem; border: 1px solid #ddd; border-radius: 6px;
                                    font-size: .85rem; font-family: inherit; background: #fff; color: inherit; }
.ji-table input[type=number] { width: 70px; }
.ji-group td { background: #faf9f7; font-size: .75rem; font-weight: 700; text-transform: uppercase;
               letter-spacing: .04em; color: #888; }
.ji-title a { color: inherit; text-decoration: none; font-weight: 600; }
.ji-title a:hover { color: #2d7d5a; }
.ji-draft { font-style: normal; font-size: .68rem; background: #fdf3e0; color: #8a6100;
            border-radius: 4px; padding: .05rem .35rem; margin-left: .35rem; }
.ji-series { font-size: .72rem; color: #2d7d5a; margin-left: .4rem; }
.je-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.je-row > div { flex: 1 1 140px; }
.je-row select, .je-row input { width: 100%; box-sizing: border-box; padding: .5rem .6rem;
                                border: 1px solid #ddd; border-radius: 8px; font-size: .9rem;
                                font-family: inherit; background: #fff; color: inherit; }
@media (prefers-color-scheme: dark) {
  .jr-lead p { color: #aaa; }
  .ji-pick select, .ji-table select, .ji-table input,
  .je-row select, .je-row input { background: #1e1e1e; border-color: #3a3a3a; color: #ddd; }
  .ji-group td { background: #1a1a1a; }
  .ji-table td { border-bottom-color: #262626; }
}
