/* MyFoodCraving — Cream/editorial design system (recipe page base) */
@import url("tokens.css");

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: var(--orange); color: var(--paper); }

/* Paper grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0 0.08 0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.4'/></svg>");
  opacity: 0.22;
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 1;
}

/* Nav */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: center;
  transition: background 250ms, border-color 250ms, backdrop-filter 250ms;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(247, 241, 227, 0.86);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom-color: var(--rule);
}
/* nav inner pieces (.nav-inner, .brand*, .nav-links*, .nav-user*, .nav-avatar) live in shared/nav.jsx */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  min-height: var(--tap-min);
  transition: transform 200ms cubic-bezier(.2,.8,.2,1), box-shadow 200ms, background 200ms;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
}
.btn-primary:hover { background: var(--orange-text); transform: translateY(-1px); }

/* Tap-target floor for interactive primitives shared across pages. Pages that
   re-declare these classes inherit the floor unless they explicitly override.
   Add new interactive primitives here when they're shared. */
.chip,
.filter-chip,
.cat-chip,
.sort-tab,
.view-toggle button,
button.icon-btn,
a.btn,
input[type="button"],
input[type="submit"] {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
}
/* Form inputs: 44px tall + 16px font (prevents iOS zoom) — applied where
   pages don't override. */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
select,
textarea {
  min-height: var(--tap-min);
  font-size: 16px;
}

/* Layout */
.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 2;
}

/* Editorial polish — eyebrow comments, scribbles, lede serif */
.page-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
  display: inline-block;
}
.page-eyebrow::before { content: "// "; color: var(--orange-text); }
.scribble {
  font-family: var(--hand, "Caveat", cursive);
  font-size: 22px;
  font-weight: 500;
  color: var(--orange);
  display: inline-block;
  transform: rotate(-2deg);
  line-height: 1;
}
.lede-serif {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* Loading-pulse dot — shared across /my/account, /my/profile, /my/markers
   (each used to ship an identical keyframe under a bespoke name). */
.mfc-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  animation: mfc-pulse 1.1s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes mfc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.6); }
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms cubic-bezier(.2,.8,.2,1), transform 700ms cubic-bezier(.2,.8,.2,1);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Responsive nav */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .wrap { padding: 0 20px; }
}

/* Toast (window.MFC.toast — assets/js/lib/toast.js) */
.mfc-toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
/* Clear the fixed bottom tab-bar (≤880px) so toasts don't cover nav labels */
@media (max-width: 880px) {
  .mfc-toast-host { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
.mfc-toast {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(31, 26, 20, 0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2,.8,.2,1);
}
.mfc-toast.is-in { opacity: 1; transform: none; }
.mfc-toast-success { background: var(--matcha-deep); }
.mfc-toast-error { background: var(--berry); }

/* ===================== Shared settings primitives ======================= */
/* Used by /my/account.html and /my/profile.html. Page-local rules (.acc-*,   */
/* .pf-*) compose these or override spacing only — never redefine them.       */

.settings-card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--pop-md);
  overflow: hidden;
}
.settings-rows { padding: 8px 26px 22px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--rule);
  flex-wrap: wrap;
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.settings-row-name {
  font-family: var(--sans); font-weight: 500; font-size: 14px; color: var(--ink);
}
.settings-row-hint {
  font-family: var(--mono); font-size: 11px; color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.settings-row-right {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; justify-content: flex-end;
}
.settings-row-value {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  color: var(--ink); letter-spacing: -0.01em;
}
.settings-row-value.unset {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  color: var(--ink-muted); font-size: 15px;
}

/* locked / write-once */
.settings-lock-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  background: var(--cream-deep);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); cursor: help;
}
.settings-lock-badge::before { content: "🔒"; font-size: 10px; }

/* link-out */
.settings-row-link {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); cursor: pointer;
  background: none; border: none; padding: 4px 0;
  transition: color 160ms;
}
.settings-row-link::before { content: "// "; }
.settings-row-link:hover { color: var(--orange-text); }
.settings-row-link.cta { color: var(--orange-text); }
.settings-row-link.cta:hover { color: var(--orange-text-hover); }

/* inline-edit */
.settings-edit-form {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end; flex: 1; min-width: 0;
}
.settings-edit-input {
  flex: 1; min-width: 200px;
  padding: 9px 12px;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--rule-strong); border-radius: 10px;
  font-family: var(--sans); font-size: 14px; outline: none;
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}
.settings-edit-input:focus {
  border-color: var(--orange-text); box-shadow: 0 0 0 3px var(--orange-soft);
}
.settings-edit-save {
  padding: 8px 14px;
  background: var(--ink); color: var(--paper);
  border: 1.5px solid var(--ink); border-radius: var(--r-pill);
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  cursor: pointer; box-shadow: var(--pop-sm);
  transition: transform 160ms, box-shadow 160ms, background 160ms;
}
.settings-edit-save:hover:not(:disabled) {
  background: var(--orange-text); transform: translate(-1px,-1px);
  box-shadow: 4px 4px 0 var(--ink);
}
.settings-edit-save:disabled { opacity: 0.55; cursor: not-allowed; }
.settings-edit-cancel {
  padding: 8px 4px; background: none; border: none;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-muted); cursor: pointer; transition: color 160ms;
}
.settings-edit-cancel:hover { color: var(--ink); }
.settings-edit-error {
  flex-basis: 100%;
  font-family: var(--mono); font-size: 11px;
  color: var(--berry); letter-spacing: 0.04em; text-align: right;
}

/* date input (used by the one-time DOB set flow) */
.settings-date-input {
  padding: 9px 12px;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--rule-strong); border-radius: 10px;
  font-family: var(--sans); font-size: 14px; outline: none; min-width: 168px;
  transition: border-color 160ms, box-shadow 160ms;
}
.settings-date-input:focus {
  border-color: var(--orange-text); box-shadow: 0 0 0 3px var(--orange-soft);
}

@media (max-width: 720px) {
  .settings-rows { padding: 4px 18px 18px; }
  .settings-row { flex-wrap: wrap; gap: 6px; }
}
