/* ============================================================
   Proto P button + Connect modal + biomarker personalization
   Scoped to /archive-plated — pomegranate + watercress palette
   ============================================================ */

/* P button in nav (added before .nav__cta) */
.proto-p-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(181, 58, 74, 0.28);
  background: rgba(181, 58, 74, 0.06);
  color: #b53a4a;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 12px;
  padding: 0;
  letter-spacing: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  position: relative;
}
.proto-p-btn:hover {
  background: rgba(181, 58, 74, 0.14);
  border-color: rgba(181, 58, 74, 0.45);
  color: #d05867;
}
.proto-p-btn:active { transform: scale(0.96); }
.proto-p-btn:focus-visible {
  outline: 2px solid #b53a4a;
  outline-offset: 2px;
}

/* Connected state — shifts to a soft sage/ember mix to read clearly on dark */
.proto-p-btn.is-connected {
  background: rgba(176, 122, 62, 0.16);
  border-color: rgba(176, 122, 62, 0.55);
  color: #d4a972;
}
.proto-p-btn.is-connected::after {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #b53a4a;
  box-shadow: 0 0 0 2px #0e0807, 0 0 10px rgba(181, 58, 74, 0.65);
}

/* Mobile — slightly smaller and tucked in */
@media (max-width: 720px) {
  .proto-p-btn { width: 36px; height: 36px; font-size: 19px; margin-right: 8px; }
}

/* ===== Modal overlay ===== */
.proto-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 4, 3, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.proto-overlay.is-open { display: flex; opacity: 1; }

.proto-modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #1a0f0c;
  border: 1px solid rgba(236, 231, 221, 0.10);
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(181, 58, 74, 0.05);
  padding: 36px;
  color: #ece7dd;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.proto-overlay.is-open .proto-modal { transform: translateY(0) scale(1); }

@media (max-width: 540px) {
  .proto-modal { padding: 28px 22px; border-radius: 12px; }
}

.proto-modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.proto-modal__icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: rgba(181, 58, 74, 0.10);
  border: 1px solid rgba(181, 58, 74, 0.32);
  color: #b53a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  font-size: 26px;
  flex-shrink: 0;
}
.proto-modal__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 400;
  font-size: 26px;
  color: #ece7dd;
  margin: 0;
  line-height: 1.1;
}
.proto-modal__subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aa9e8a;
  margin-top: 4px;
}

.proto-modal__close {
  position: absolute;
  top: 18px; right: 18px;
  background: transparent;
  border: none;
  color: #aa9e8a;
  font-size: 20px;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.proto-modal__close:hover { background: rgba(236, 231, 221, 0.06); color: #ece7dd; }

.proto-modal { position: relative; }

.proto-body {
  font-size: 15px;
  line-height: 1.6;
  color: #d4cfc4;
}
.proto-body p { margin: 0 0 14px 0; }
.proto-body p:last-child { margin-bottom: 0; }
.proto-body strong { color: #ece7dd; font-weight: 500; }

.proto-checklist {
  margin: 20px 0;
  padding: 18px 20px;
  background: rgba(236, 231, 221, 0.03);
  border: 1px solid rgba(236, 231, 221, 0.08);
  border-radius: 10px;
}
.proto-checklist__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aa9e8a;
  margin-bottom: 10px;
}
.proto-checklist ul { list-style: none; padding: 0; margin: 0; }
.proto-checklist li {
  font-size: 14px;
  color: #d4cfc4;
  padding: 5px 0 5px 22px;
  position: relative;
}
.proto-checklist li::before {
  content: '';
  position: absolute;
  left: 0; top: 11px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #b53a4a;
}

.proto-privacy {
  font-size: 12px;
  color: #aa9e8a;
  line-height: 1.55;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(236, 231, 221, 0.06);
}
.proto-privacy a { color: #b07a3e; text-decoration: none; border-bottom: 1px solid transparent; }
.proto-privacy a:hover { border-bottom-color: #b07a3e; }

.proto-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.proto-btn {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.proto-btn--primary {
  background: #b53a4a;
  color: #fff;
  border-color: #b53a4a;
}
.proto-btn--primary:hover { background: #d05867; border-color: #d05867; }
.proto-btn--ghost {
  background: transparent;
  color: #ece7dd;
  border-color: rgba(236, 231, 221, 0.18);
}
.proto-btn--ghost:hover { background: rgba(236, 231, 221, 0.05); border-color: rgba(236, 231, 221, 0.32); }

/* ===== Loading state ===== */
.proto-loading {
  text-align: center;
  padding: 12px 0 8px;
}
.proto-loading__spinner {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: rgba(181, 58, 74, 0.08);
  border: 1px solid rgba(181, 58, 74, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 32px;
  color: #b53a4a;
  position: relative;
  margin-bottom: 18px;
}
.proto-loading__spinner::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  border: 2px solid transparent;
  border-top-color: #b53a4a;
  animation: protoSpin 0.9s linear infinite;
}
@keyframes protoSpin {
  to { transform: rotate(360deg); }
}
.proto-loading__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 400;
  color: #ece7dd;
  margin: 0 0 6px;
}
.proto-loading__text {
  font-size: 14px;
  color: #aa9e8a;
}

/* ===== Connected summary state ===== */
.proto-summary {
  margin-top: 4px;
}
.proto-summary__panel {
  margin: 18px 0 22px;
  padding: 18px 20px;
  background: rgba(181, 58, 74, 0.06);
  border: 1px solid rgba(181, 58, 74, 0.22);
  border-radius: 10px;
}
.proto-summary__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aa9e8a;
  margin-bottom: 10px;
}
.proto-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.proto-summary__chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(236, 231, 221, 0.05);
  border: 1px solid rgba(236, 231, 221, 0.10);
  color: #d4cfc4;
}
.proto-summary__chip--high { background: rgba(181, 58, 74, 0.14); border-color: rgba(181, 58, 74, 0.42); color: #e89178; }
.proto-summary__chip--low  { background: rgba(176, 122, 62, 0.14); border-color: rgba(176, 122, 62, 0.42); color: #d4a972; }
.proto-summary__chip--wearable {
  background: rgba(111, 139, 74, 0.12);
  border-color: rgba(111, 139, 74, 0.40);
  color: #a8c478;
  letter-spacing: 0.03em;
}

.proto-recs {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}
.proto-recs__item {
  display: grid;
  grid-template-columns: 24px 60px 1fr;
  align-items: start;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid rgba(236, 231, 221, 0.06);
}
.proto-recs__item:first-child { border-top: none; }
.proto-recs__rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: #b53a4a;
  padding-top: 4px;
}
.proto-recs__media {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(236, 231, 221, 0.05);
  border: 1px solid rgba(236, 231, 221, 0.08);
}
.proto-recs__media--ease {
  filter: grayscale(0.6) brightness(0.78);
  opacity: 0.78;
}
.proto-recs__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.proto-recs__body {
  min-width: 0;
}
.proto-recs__pill {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  margin-bottom: 5px;
}
.proto-recs__pill--rec {
  background: rgba(181, 58, 74, 0.16);
  border: 1px solid rgba(181, 58, 74, 0.42);
  color: #e89178;
}
.proto-recs__pill--ease {
  background: rgba(170, 158, 138, 0.10);
  border: 1px solid rgba(170, 158, 138, 0.28);
  color: #aa9e8a;
}
.proto-recs__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  color: #ece7dd;
  line-height: 1.25;
  margin: 0 0 3px;
}
.proto-recs__why {
  font-size: 13px;
  color: #aa9e8a;
  line-height: 1.5;
}

/* ===== Error state ===== */
.proto-error {
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(181, 58, 74, 0.08);
  border: 1px solid rgba(181, 58, 74, 0.28);
  color: #e89178;
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.proto-error strong { color: #ece7dd; font-weight: 500; }

/* ===== Personalization markers — appear on dish/mode cards when connected ===== */

/* Personalized dish badge */
.dish__card { position: relative; }
.proto-tag {
  display: none; /* hidden until body.proto-connected */
  position: absolute;
  top: 14px; left: 14px;
  z-index: 2;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(181, 58, 74, 0.92);
  color: #fff;
  box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.proto-tag--rec  { background: rgba(181, 58, 74, 0.92); }
.proto-tag--ease { background: rgba(176, 122, 62, 0.92); }

body.proto-connected .proto-tag { display: inline-block; }

/* Inline ember-red insight line under dish title */
.proto-note {
  display: none;
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 2px solid #b53a4a;
  background: rgba(181, 58, 74, 0.06);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #d4cfc4;
  border-radius: 0 6px 6px 0;
}
.proto-note strong { color: #ece7dd; font-weight: 500; }
body.proto-connected .proto-note { display: block; }

/* When connected, brand badge gets ember dot + "Personalized" */
.proto-personalized-banner {
  display: none;
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 9px 18px 9px 14px;
  border-radius: 999px;
  background: rgba(26, 15, 12, 0.92);
  border: 1px solid rgba(181, 58, 74, 0.42);
  backdrop-filter: blur(8px);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ece7dd;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.75);
  align-items: center;
  gap: 10px;
}
.proto-personalized-banner::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #b53a4a;
  box-shadow: 0 0 8px rgba(181, 58, 74, 0.7);
  display: inline-block;
}
.proto-personalized-banner button {
  background: transparent;
  border: none;
  color: #aa9e8a;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0 0 0 8px;
  letter-spacing: 0.10em;
  border-left: 1px solid rgba(236, 231, 221, 0.15);
  margin-left: 4px;
}
.proto-personalized-banner button:hover { color: #ece7dd; }
body.proto-connected .proto-personalized-banner { display: inline-flex; }

/* === Plate composer (v2 ingredient %DV) ============================= */

.plate-card{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:16px;
  align-items:center;
  background: linear-gradient(135deg, rgba(181,58,74,.10), rgba(181,58,74,.02));
  border:1px solid rgba(181,58,74,.30);
  border-radius:14px;
  padding:14px;
  margin-bottom:18px;
}
.plate-card__media{
  aspect-ratio: 1 / 1;
  border-radius:10px;
  overflow:hidden;
  background:#0a0c0a;
}
.plate-card__img{ width:100%; height:100%; object-fit:cover; display:block; }
.plate-card__body{ display:flex; flex-direction:column; gap:6px; }
.plate-card__pill{
  display:inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size:10px;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#b53a4a;
  border:1px solid rgba(181,58,74,.45);
  background:rgba(181,58,74,.08);
  padding:3px 9px;
  border-radius:999px;
  width:max-content;
}
.plate-card__title{
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 26px;
  line-height:1.1;
  color:#f6f1e8;
}
.plate-card__cover{ display:flex; align-items:baseline; gap:8px; margin-top:4px; }
.plate-card__cover-num{
  font-family: 'JetBrains Mono', monospace;
  font-size:32px;
  font-weight:600;
  color:#b53a4a;
  letter-spacing:-.02em;
}
.plate-card__cover-label{
  font-size:12px;
  color:rgba(246,241,232,.66);
  letter-spacing:.02em;
}

.plate-section-label{
  font-family: 'JetBrains Mono', monospace;
  font-size:10.5px;
  letter-spacing:.18em;
  text-transform:uppercase;
  color:rgba(246,241,232,.50);
  margin: 18px 0 10px;
}

.ingr-stack{ display:flex; flex-direction:column; gap:12px; }
.ingr-row{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:18px;
  align-items:flex-start;
  padding:12px 14px;
  background: rgba(246,241,232,.025);
  border:1px solid rgba(246,241,232,.06);
  border-radius:10px;
}
.ingr-row__left{ display:flex; flex-direction:column; gap:3px; }
.ingr-row__label{
  font-family: 'Inter', system-ui, sans-serif;
  font-size:14px;
  font-weight:500;
  color:#f6f1e8;
  letter-spacing:-.005em;
}
.ingr-row__notes{
  font-size:11.5px;
  color:rgba(246,241,232,.50);
  line-height:1.35;
}
.ingr-row__bars{ display:flex; flex-direction:column; gap:8px; }
.ingr-bar{ display:flex; flex-direction:column; gap:3px; }
.ingr-bar__label{
  font-family: 'JetBrains Mono', monospace;
  font-size:10.5px;
  letter-spacing:.04em;
  color:rgba(246,241,232,.68);
}
.ingr-bar__track{
  height:5px;
  border-radius:999px;
  background: rgba(246,241,232,.06);
  overflow:hidden;
}
.ingr-bar__fill{
  height:100%;
  border-radius:999px;
  transition: width .6s cubic-bezier(.2,.7,.2,1);
}
.ingr-bar__fill--abs{
  background: linear-gradient(90deg, #6f8b4a, #a8c46e);
}
.ingr-bar__fill--gap{
  background: linear-gradient(90deg, #b53a4a, #e26276);
}

.plate-alts{ display:flex; gap:10px; flex-wrap:wrap; }
.plate-alt{
  flex:1 1 calc(50% - 5px);
  min-width:180px;
  display:flex;
  gap:10px;
  align-items:center;
  padding:8px;
  background: rgba(246,241,232,.02);
  border:1px solid rgba(246,241,232,.06);
  border-radius:10px;
}
.plate-alt__img{
  width:54px; height:54px;
  border-radius:8px;
  object-fit:cover;
  display:block;
}
.plate-alt__body{ display:flex; flex-direction:column; gap:2px; }
.plate-alt__name{
  font-family: 'Inter', system-ui, sans-serif;
  font-size:13px;
  color:#f6f1e8;
  font-weight:500;
}
.plate-alt__why{
  font-size:11px;
  color:rgba(246,241,232,.45);
}

@media (max-width: 560px){
  .plate-card{ grid-template-columns: 100px 1fr; gap:12px; }
  .plate-card__title{ font-size:22px; }
  .plate-card__cover-num{ font-size:26px; }
  .ingr-row{ grid-template-columns: 1fr; gap:10px; }
}
