/* ==========================================================================
   Myxolab shared stylesheet
   1. Tokens      colours, type, spacing, radii, shadows
   2. Base        reset and page defaults
   3. Components  button, card, field, pill, top bar
   4. Library     recipe library grid (views/index.html and public/index.html)
   5. Recipe      recipe page (views/cocktail.html and public/public-cocktail.html)
   6. Feedback    notifications, dialogs, spinners, loading placeholders
   7. Access      keyboard focus, reduced motion, safe areas

   The values reproduce the library exactly as it looked before this file
   existed. Other pages still use their own inline styles and can move here
   one at a time.
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  /* Colours */
  --color-bg: #f9f9f9;            /* page background */
  --color-surface: #fff;          /* cards, pills, buttons */
  --color-ink: #111;              /* primary text, active states */
  --color-ink-soft: #222;         /* button text */
  --color-muted: #777;            /* secondary text */
  --color-border: #ddd;
  --color-border-soft: #eee;
  --color-border-strong: #ccc;    /* form fields */
  --color-divider: #e5e5e5;
  --color-on-ink: #fff;           /* text on dark backgrounds */
  --color-bg-recipe: #eee;        /* recipe page background, around the white card */
  --color-heading: #333;          /* recipe title */

  /* Typography */
  --font-display: 'Cinzel', serif;
  --font-body: 'Raleway', sans-serif;
  --text-xs: 10.5px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 10px;
  --space-5: 12px;
  --space-6: 14px;
  --space-7: 16px;
  --space-8: 20px;
  --space-9: 24px;
  --space-10: 30px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.1);
  --shadow-pill-hover: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-pill-active: 0 4px 12px rgba(0, 0, 0, 0.15);
  --focus-ring: 0 0 0 2px rgba(0, 0, 0, 0.06);

  /* Motion */
  --ease-fast: 0.2s ease;
  --ease-medium: 0.25s ease;
}

/* 2. Base ------------------------------------------------------------------ */

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
}

.page-container {
  padding: var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
}

/* 3. Components ------------------------------------------------------------ */

/* Button: neutral base. Add a variant class for colours. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-7);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  letter-spacing: 0.2px;
  text-decoration: none;
  cursor: pointer;
}

.btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.btn svg {
  display: block;
}

/* Outline button: white with a light border, turns black on hover. */
.btn-outline {
  background: var(--color-surface);
  color: var(--color-ink-soft);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* Hover effects only on devices with a mouse: on touch screens :hover
   sticks after a tap and leaves the element looking selected. */
@media (hover: hover) {
  .btn-outline:hover {
    background: var(--color-ink);
    color: var(--color-on-ink);
    border-color: var(--color-ink);
  }
}

/* Solid button: black, for the main action on a screen. */
.btn-solid {
  background: var(--color-ink);
  color: var(--color-on-ink);
  border: 1px solid var(--color-ink);
}

/* Card: white surface with a soft shadow.
   Library cards are created by script with the .cocktail class, so that
   selector shares the component until the markup gets the .card class. */
.card,
.cocktail {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* Field: text input, select or textarea. */
.field {
  width: 100%;
  padding: var(--space-4);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-md);
  background-color: var(--color-surface);
  color: var(--color-ink-soft);
}

.field:focus {
  outline: none;
  border-color: var(--color-ink);
  box-shadow: var(--focus-ring);
}

/* Pill: rounded filter chip. The library's category buttons are created by
   script without a class, so they share the component through
   .category-filter button. The active pill has the .active class. */
.pill,
.category-filter button {
  padding: 9px var(--space-8);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  letter-spacing: 0.4px;
  text-transform: capitalize;
  cursor: pointer;
  transition: all var(--ease-fast);
}

@media (hover: hover) {
  .pill:hover,
  .category-filter button:hover {
    box-shadow: var(--shadow-pill-hover);
  }
}

.pill.active,
.category-filter button.active {
  background: var(--color-ink);
  color: var(--color-on-ink);
  border-color: var(--color-ink);
  box-shadow: var(--shadow-pill-active);
}

/* Top bar: centred page header with a short divider line underneath. */
.topbar {
  position: relative;
  text-align: center;
  margin-bottom: var(--space-6);
}

.topbar::after {
  content: "";
  display: block;
  width: 120px;
  height: 1px;
  background: var(--color-divider);
  opacity: 0.6;
  margin: var(--space-4) auto 0;
}


/* 4. Library --------------------------------------------------------------- */

.logo {
  height: 50px;
  width: auto;
  margin-bottom: var(--space-2);
  filter: grayscale(100%) brightness(0.3);
}

/* "Manage Menu" / "Start Free Trial" button, top right of the header.
   Tablet and desktop show the gear and the label; phones a 44px gear. */
.admin-button {
  position: absolute;
  top: 0;
  right: var(--space-8);
  display: flex;
  -webkit-tap-highlight-color: transparent;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--space-9);
  grid-template-columns: repeat(auto-fit, minmax(180px, 210px));
  justify-content: center;
}

/* Cards grow with their title; the image area keeps a fixed shape, so the
   page height does not change while images load. */
.cocktail {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.image-container {
  aspect-ratio: 3 / 4;
  min-height: 0; /* keep the shape even when a tall photo would stretch it */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.cocktail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--ease-medium);
}

.cocktail h3 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1.3;
  text-align: center;
  margin: 0;
}

@media (hover: hover) {
  .cocktail {
    transition: transform var(--ease-fast), box-shadow var(--ease-fast);
  }

  .cocktail:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
  }

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

/* Touch screens: a short press feedback instead of a hover lift. */
@media (hover: none) {
  .cocktail {
    transition: transform 0.12s ease;
  }

  .cocktail:active {
    transform: scale(0.98);
  }
}

/* Category filter row and search */
.category-filter {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  margin: var(--space-2) 0 var(--space-10);
  flex-wrap: wrap;
}

/* On tablet and desktop the category buttons sit directly in the wrapping
   row, as before; on phones this becomes a sideways-scrolling strip. */
.pill-row {
  display: contents;
}

.category-filter button {
  -webkit-tap-highlight-color: transparent;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 38px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}

.search-pill .icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-pill svg {
  display: block;
}

.search-pill input {
  width: 0;
  border: none;
  outline: none;
  background: transparent;
  transition: var(--ease-medium);
  opacity: 0;
}

.search-pill.active input {
  width: 160px;
  opacity: 1;
}

/* Touch tablets: filter targets at least 40px tall */
@media (pointer: coarse) and (min-width: 661px) {
  .category-filter button,
  .search-pill {
    min-height: 40px;
  }
}

/* Mobile */
@media (max-width: 660px) {
  .topbar::after {
    display: none;
  }

  .logo {
    height: 35px;
  }

  /* Round 44px gear, aligned with the logo and the card edge */
  .admin-button {
    top: -2px;
    right: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-full);
  }

  .admin-button .label {
    display: none;
  }

  /* Search and categories share one row, so the library starts higher up.
     The search field comes first and is always visible with its
     placeholder; while typing it takes the whole row. With a search entered
     it stays wide enough to show it, and the categories scroll beside it. */
  .category-filter {
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: var(--space-3);
    margin: var(--space-1) 0 var(--space-6);
  }

  .search-pill {
    order: -1;
    flex: 0 0 auto;
    width: 128px;
    height: 40px;
    margin-top: 2px; /* level with the pills, which have room for a shadow */
    padding: 0 var(--space-5);
    cursor: text;
    transition: width var(--ease-medium);
  }

  .search-pill.active {
    width: 150px;
  }

  .search-pill:focus-within {
    flex: 1 1 auto;
    width: auto;
    border-color: var(--color-ink);
  }

  /* The categories fold away sideways while typing; the row keeps its
     height and the categories keep their scroll position. */
  .category-filter:has(.search-pill input:focus) .pill-row {
    flex: 0 0 0;
    margin-right: calc(-1 * var(--space-3)); /* no gap after the search */
    padding-right: 0;
    overflow: hidden;
  }

  .search-pill input,
  .search-pill.active input {
    flex: 1;
    width: auto;
    min-width: 0;
    opacity: 1;
    font-family: var(--font-body);
    font-size: var(--text-lg); /* 16px: iOS does not zoom in on focus */
    color: var(--color-ink);
  }

  .pill-row {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    gap: var(--space-3);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    /* run to the right edge, with room for the active pill's shadow */
    margin-right: calc(-1 * var(--space-8));
    padding: 2px var(--space-8) var(--space-2) 0;
  }

  .pill-row::-webkit-scrollbar {
    display: none;
  }

  .category-filter button {
    flex: 0 0 auto;
    height: 40px;
    padding: 0 var(--space-7);
    font-size: var(--text-sm);
    white-space: nowrap;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-soft);
    color: var(--color-muted);
    letter-spacing: 0.2px;
  }

  .category-filter button.active {
    background: var(--color-ink);
    color: var(--color-on-ink);
    border-color: var(--color-ink);
    font-weight: 600;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
  }

  .image-container {
    aspect-ratio: 4 / 5;
  }

  .cocktail h3 {
    font-size: var(--text-sm);
  }
}

/* Phones: three columns, so more recipes fit on one screen */
@media (max-width: 500px) {
  .grid {
    gap: var(--space-3);
  }

  .cocktail {
    padding: var(--space-3);
  }

  .image-container {
    margin-bottom: var(--space-2);
  }

  .cocktail h3 {
    font-size: 11px;
    letter-spacing: 0.3px;
  }
}

/* Narrowest phones (iPhone SE): three columns would be too small, use two */
@media (max-width: 374px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .cocktail {
    padding: var(--space-6);
  }

  .image-container {
    margin-bottom: var(--space-4);
  }

  .cocktail h3 {
    font-size: 12px;
    letter-spacing: 0.6px;
  }
}


/* 5. Recipe ---------------------------------------------------------------- */

/* Everything is scoped to body.recipe-page. The card, title, photo and type
   are the recipe page as it was; the top bar, the reading sizes and the
   reserved photo box are new. */

.recipe-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--color-bg-recipe);
}

.recipe-page h1,
.recipe-page h3 {
  font-family: var(--font-display);
}

/* Top bar: stays at the top while the recipe scrolls. Back on the left,
   previous / next on the right, where the user is in the list in between. */
.recipe-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  align-self: stretch;
  padding: var(--space-3) var(--space-5);
  padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--color-border-soft);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.recipe-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 880px;
  margin: 0 auto;
}

.recipe-back,
.recipe-step {
  height: 40px;
  border-radius: var(--radius-full);
  -webkit-tap-highlight-color: transparent;
}

.recipe-back {
  padding: 0 var(--space-6) 0 var(--space-4);
  gap: var(--space-1);
  font-weight: 600;
}

.recipe-step {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.recipe-step[aria-disabled="true"] {
  opacity: 0.3;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.recipe-steps {
  display: flex;
  gap: var(--space-3);
}

.recipe-position {
  flex: 1;
  min-width: 0;
  text-align: center;
  line-height: 1.25;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-position .where {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-position .count {
  font-size: var(--text-sm);
  color: var(--color-ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Recipe card */
.recipe-page .recipe-container {
  box-sizing: content-box;
  background-color: var(--color-surface);
  padding: 20px 40px 40px;
  border-radius: 18px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  width: 80%;
  max-width: 800px;
  margin: 20px 0;
  text-align: center;
}

.recipe-page h1 {
  color: var(--color-heading);
  margin-bottom: 20px;
  text-align: center;
}

.recipe-page h3 {
  font-size: 18px;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.recipe-page .content-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 20px;
  text-align: left;
}

.recipe-page .text-column {
  flex: 1 1 55%;
  text-align: left;
}

.recipe-page .text-column h3:first-child {
  margin-top: 0;
}

.recipe-page .image-column {
  flex: 1 1 40%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.recipe-page .cocktail-img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.18));
}

/* Ingredients: larger text and air between lines, read at a glance */
.recipe-page .ingredients ul {
  margin: 0;
  padding-left: 20px;
}

.recipe-page .ingredients li {
  font-size: 17px;
  line-height: 1.4;
  margin: 0 0 var(--space-3);
}

/* Method: the number in its own column, so a long step wraps under its
   own text and each step starts on a clean line */
.recipe-page .instructions {
  margin-top: var(--space-9);
}

.recipe-page .instructions p {
  display: grid;
  grid-template-columns: 1.3em 1fr;
  column-gap: var(--space-1);
  margin: 0 0 var(--space-6);
  line-height: 1.5;
}

.recipe-page .ingredients li:last-child,
.recipe-page .instructions p:last-child {
  margin-bottom: 0;
}

.recipe-page .home-btn {
  min-width: 220px;
  padding: 12px 24px;
  background: var(--color-ink);
  color: var(--color-on-ink);
  text-decoration: none;
  border-radius: var(--radius-full);
  margin-top: 30px;
  font-size: 15px;
  font-weight: 600;
  display: inline-block;
  transition: all var(--ease-fast);
}

@media (hover: hover) {
  .recipe-page .home-btn:hover {
    transform: translateY(-2px);
    background: #000;
  }
}

@media (max-width: 768px) {
  /* The top bar already has Back, previous / next and the position, so the
     bottom "Back to Recipes" button is left out on phones and small tablets */
  .recipe-page .home-btn[data-library-link] {
    display: none;
  }

  .recipe-page .recipe-container {
    box-sizing: border-box; /* padding inside the 90%: no sideways scroll on small phones */
    width: 90%;
    padding: 20px;
    margin: 16px 0;
  }

  .recipe-page h1 {
    font-size: 24px;
  }

  .recipe-page .content-row {
    flex-direction: column-reverse;
    text-align: center;
  }

  .recipe-page .text-column {
    width: 100%;
    text-align: left;
  }

  /* The photo box has its height before the photo arrives, so the text
     below does not jump; a slightly lower box than before. */
  .recipe-page .image-column {
    flex: 0 0 auto;
    width: 100%;
    height: 220px;
  }

  .recipe-page .cocktail-img {
    max-height: 100%;
  }

  .recipe-page .ingredients li {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .recipe-page .instructions p {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .recipe-page h1 {
    font-size: 22px;
    margin-bottom: 14px;
  }

  .recipe-page .image-column {
    height: 170px;
  }

  .recipe-page .home-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}


/* 6. Feedback --------------------------------------------------------------- */

/* Line icons from js/ui.js: drawn in the text colour */
.ui-icon {
  display: block;
  flex: 0 0 auto;
}

/* Notifications (UI.toast): a small dark bar at the bottom centre, above the
   home indicator of phones. */
.toast-region {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--space-7) + env(safe-area-inset-bottom, 0px));
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-7);
  pointer-events: none;
}

.toast {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: min(440px, 100%);
  padding: var(--space-4) var(--space-3) var(--space-4) var(--space-7);
  border-radius: var(--radius-md);
  background: var(--color-ink);
  color: var(--color-on-ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--ease-fast), transform var(--ease-fast);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-error .ui-icon {
  color: #ff8a80;
}

.toast-success .ui-icon {
  color: #a5d6a7;
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
}

@media (hover: hover) {
  .toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
  }
}

/* Confirmation dialog (UI.confirm): a white card like the rest of the app */
.ui-dialog {
  box-sizing: border-box;
  width: min(360px, calc(100% - 2 * var(--space-8)));
  padding: var(--space-9);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-ink-soft);
  font-family: var(--font-body);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.ui-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.ui-dialog-title {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  color: var(--color-ink);
}

.ui-dialog-message {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.5;
  color: #555;
}

.ui-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  margin-top: var(--space-9);
}

.ui-dialog-actions button {
  box-sizing: border-box;
  min-width: 96px;
  height: 42px;
  margin: 0;
  padding: 0 var(--space-8);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 600;
  cursor: pointer;
}

.ui-dialog-cancel {
  background: var(--color-surface);
  color: var(--color-ink-soft);
  border: 1px solid var(--color-border);
}

.ui-dialog-confirm {
  background: var(--color-ink);
  color: var(--color-on-ink);
  border: 1px solid var(--color-ink);
}

.ui-dialog-confirm.danger {
  background: #c62828;
  border-color: #c62828;
}

@media (hover: hover) {
  .ui-dialog-cancel:hover {
    border-color: var(--color-ink);
  }

  .ui-dialog-confirm:hover {
    background: #000;
  }

  .ui-dialog-confirm.danger:hover {
    background: #b71c1c;
  }
}

/* Spinner: a small ring in the text colour, for buttons that are working */
.spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes ui-spin {
  to { transform: rotate(360deg); }
}

button[aria-busy="true"] {
  cursor: progress;
}

/* Loading placeholders: grey shapes where recipes and photos will appear.
   The image boxes already keep their shape, so nothing moves when the
   photos arrive. */
.skeleton {
  background: #eee;
  background-image: linear-gradient(90deg, #eee 0%, #f6f6f6 50%, #eee 100%);
  background-size: 200% 100%;
  animation: ui-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes ui-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.cocktail.is-placeholder {
  cursor: default;
  pointer-events: none;
}

.cocktail.is-placeholder .image-container {
  border-radius: var(--radius-sm);
}

.cocktail.is-placeholder .title-line {
  height: 12px;
  width: 70%;
  margin: var(--space-1) auto 0;
}

/* A photo that has not arrived yet shows a soft grey box; once loaded it
   fades in. */
.img-loading {
  background-color: #f2f2f2;
  border-radius: var(--radius-sm);
}

img.fade-in {
  opacity: 0;
  transition: opacity var(--ease-medium);
}

img.fade-in.loaded {
  opacity: 1;
}

/* Recipe page while the recipe loads: grey lines where the text will be */
.recipe-skeleton-title {
  display: inline-block;
  width: min(260px, 70%);
  height: 0.9em;
  vertical-align: middle;
}

.recipe-page .ingredients li.recipe-skeleton-line,
.recipe-skeleton-line {
  display: block;
  height: 14px;
  width: 80%;
  margin: 0 0 var(--space-5);
  list-style: none;
}

.recipe-skeleton-line.short {
  width: 55%;
}

.load-error {
  grid-column: 1 / -1;
  margin: 40px 0;
  text-align: center;
  color: #666;
}

/* Inline form message (login, password reset) */
.form-message {
  margin: 0 0 var(--space-6);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-sm);
  background: #fdecea;
  color: #b3261e;
  font-size: var(--text-sm);
  line-height: 1.45;
  text-align: left;
}

.form-message[hidden] {
  display: none;
}


/* 7. Access ----------------------------------------------------------------- */

/* Keyboard focus: a clear ring on whatever has the focus, shown only for
   keyboard use, not after a tap or a click. */
:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

/* On dark buttons the ring is set off by a white gap */
.btn-solid:focus-visible,
.category-filter button.active:focus-visible,
.ui-dialog-confirm:focus-visible {
  outline-offset: 0;
  box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-ink);
}

.toast :focus-visible {
  outline-color: var(--color-on-ink);
}

/* Library search: the ring goes round the whole pill */
.search-pill:has(input:focus-visible) {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

/* Cards in the library: the whole card is the link */
.cocktail:focus-visible {
  outline-offset: 3px;
}

/* Text for screen readers only */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion: no movement, lifts or shimmer. Spinners still turn slowly,
   because they say that something is happening. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner,
  .loading-image {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }

  .skeleton {
    background-image: none;
  }

  .cocktail:hover,
  .cocktail:active,
  .cocktail:hover img {
    transform: none !important;
  }
}

/* Safe areas: on phones with rounded corners or a notch, and in the
   installed app, keep content clear of the edges (zero everywhere else). */
@supports (padding: env(safe-area-inset-left)) {
  .page-container {
    padding-left: max(var(--space-8), env(safe-area-inset-left));
    padding-right: max(var(--space-8), env(safe-area-inset-right));
    padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
  }

  .recipe-bar {
    padding-left: max(var(--space-5), env(safe-area-inset-left));
    padding-right: max(var(--space-5), env(safe-area-inset-right));
  }
}
