/* ============================================================
   Place pullup — bottom sheet with 3 snap states (peek/half/full).
   Drag handle to resize, tap handle to cycle, swipe down to dismiss.
   Sits above bottom nav (z-index escalated in tokens).
   ============================================================ */

.pullup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-pullup);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-top-left-radius: var(--radius-2xl);
  border-top-right-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  height: 0;
  transform: translateY(100%);
  transition:
    height var(--duration-base) var(--easing-emphasized),
    transform var(--duration-base) var(--easing-emphasized);
  pointer-events: none;
  overflow: hidden;
}

.pullup--open {
  pointer-events: auto;
  transform: translateY(0);
}

.pullup[hidden] {
  display: none;
}

.pullup[data-state="peek"] { height: 140px; }
.pullup[data-state="half"] { height: 50vh; }
.pullup[data-state="full"] { height: 90vh; }

/* ---------- Handle ---------- */

.pullup__handle {
  flex-shrink: 0;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.pullup__handle:active {
  cursor: grabbing;
}

.pullup__handle-bar {
  width: 40px;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-border-default);
}

/* ---------- Body ---------- */

.pullup__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

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

.pullup__header {
  flex-shrink: 0;
  padding: 0 var(--space-4) var(--space-3);
}

.pullup__category-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.pullup__category-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: white;
}

.pullup__category-badge[data-cat] { background: var(--cat-color); }

.pullup__category-badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pullup__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-tertiary);
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard);
}

.pullup__close:hover {
  background: var(--color-surface-tonal);
  color: var(--color-text-secondary);
}

.pullup__close svg {
  width: 18px;
  height: 18px;
}

.pullup__name {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  letter-spacing: var(--letter-spacing-tight);
  line-height: var(--line-height-snug);
}

.pullup__type {
  margin: 2px 0 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
}

/* ---------- Scroll content ---------- */

.pullup__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-4) var(--space-4);
  /* In peek state, parent has small height — overflow hides this */
}

.pullup__photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-4);
  padding: var(--space-8) var(--space-4);
  background: var(--color-surface-tonal);
  border-radius: var(--radius-lg);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
}

.pullup__photo-placeholder svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
}

.pullup__details {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pullup__divider {
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  margin: 0 0 var(--space-5);
}

.pullup__detail {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  line-height: var(--line-height-snug);
}

.pullup__detail a {
  color: var(--color-brand-primary);
  text-decoration: none;
  word-break: break-all;
}

.pullup__detail a:hover {
  text-decoration: underline;
}

.pullup__detail-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}

.pullup__section {
  margin-bottom: var(--space-5);
}

.pullup__section-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  letter-spacing: var(--letter-spacing-wide);
}

.pullup__description {
  margin: 0;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  line-height: var(--line-height-relaxed);
}

.pullup__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pullup__chip {
  display: inline-flex;
  align-items: center;
  padding: 4px var(--space-3);
  background: var(--color-surface-tonal);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.pullup__chip--accent {
  background: var(--color-brand-secondary-tint);
  border-color: var(--color-brand-secondary-soft);
  color: var(--color-brand-secondary);
}

.pullup__updated {
  margin: var(--space-3) 0 0;
  font-size: var(--font-size-2xs);
  color: var(--color-text-tertiary);
  text-align: center;
}

/* ---------- Header bookmark icon ---------- */

.pullup__header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.pullup__bookmark-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  color: var(--color-text-tertiary);
  transition: all var(--duration-fast) var(--easing-standard);
}

.pullup__bookmark-icon:hover {
  color: var(--color-brand-primary);
  background: var(--color-brand-primary-tint);
}

.pullup__bookmark-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
}

.pullup__bookmark-icon[data-bookmarked="true"] {
  color: var(--color-brand-primary);
}

.pullup__bookmark-icon[data-bookmarked="true"] svg {
  fill: var(--color-brand-primary);
}

/* ---------- Dietary disclaimer ---------- */

.pullup__disclaimer {
  margin: var(--space-2) 0 0;
  padding: var(--space-2) var(--space-3);
  background: rgba(177, 68, 55, 0.06);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-2xs);
  color: var(--color-danger);
  line-height: var(--line-height-normal);
}

/* ---------- Edit button (inline, at bottom of scroll) ---------- */

.pullup__edit-section {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border-subtle);
  text-align: center;
}

.pullup__edit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--color-brand-primary-tint);
  border: 1px solid var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transition: all var(--duration-fast) var(--easing-standard);
}

.pullup__edit:hover {
  background: var(--color-brand-primary);
  color: var(--color-text-on-brand);
  border-color: var(--color-brand-primary);
}

.pullup__edit:hover svg {
  stroke: var(--color-text-on-brand);
}

.pullup__edit svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
