/* Route 66 Copilot: passport screen, state seals, ink stamp, toast, certificate (screen + print). */

/* ---------- Seals (line art used as a mask) ---------- */
.seal { position: relative; display: inline-block; flex-shrink: 0; border-radius: 50%; }
.seal-ink {
  position: absolute; inset: 0; background: var(--line-strong); opacity: .42;
  -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.seal-done { background: radial-gradient(circle, rgba(242, 194, 48, .28) 0 62%, transparent 63%); }
.seal-done .seal-ink { background: var(--rust-strong); opacity: 1; }
.seal-anim { animation: seal-stamp .9s var(--ease) both; }
@keyframes seal-stamp {
  0% { transform: scale(1.45) rotate(-12deg); opacity: 0; }
  55% { transform: scale(.92) rotate(2deg); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.sep { display: inline-block; margin: 0 .45em 0 .3em; }

/* ---------- Header: big count, map, state chips, latest stamps ---------- */
.passport { display: flex; flex-direction: column; gap: 18px; max-width: 620px; padding-top: 12px; }
.pp-head { display: flex; flex-direction: column; gap: 4px; }
.pp-title { margin: 0; font-family: var(--head); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.pp-big { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; color: var(--ink-2); font-size: 1.05rem; }
.pp-big strong { font-family: var(--head); font-size: 3.6rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--ink); }
.pp-lead { margin: 0; font-size: 0.95rem; color: var(--ink-2); font-weight: 600; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-chip {
  min-height: 48px; padding: 6px 14px; border-radius: var(--r-pill); border: 0; background: var(--sand); color: var(--ink);
  font-weight: 700; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px;
}
.pp-chip .num { font-weight: 600; color: var(--ink-2); }
.pp-chip.is-done { background: var(--ink); color: #FFFFFF; }
.pp-chip.is-done .num { color: #FFFFFF; }
.pp-chip.is-done .ico { color: var(--yellow); }
.pp-latest h2 { margin: 0 0 12px; font-family: var(--head); font-size: 1.15rem; font-weight: 700; }
.pp-latest ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
.pp-latest button {
  width: 100%; border: 0; background: none; padding: 0; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
}
.pp-latest img, .pp-latest-blank {
  width: 92px; height: 92px; max-width: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--yellow); background: var(--sand);
}
.pp-latest-blank { display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.pp-latest-name { font-weight: 700; font-size: 0.9rem; line-height: 1.25; overflow-wrap: anywhere; }
.pp-latest-date { font-size: 0.8rem; color: var(--ink-2); }

/* ---------- Certificate card ---------- */
.pp-cert-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--r-shell); }
.pp-cert-card .tile-ico { width: 52px; height: 52px; flex-shrink: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--sand); color: var(--ink); }
.pp-cert-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.pp-cert-top p { margin: 4px 0 0; }
.pp-cert-title { margin: 0; font-family: var(--head); font-weight: 800; font-size: 1.6rem; line-height: 1.05; }
.pp-missing { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--sand); }
.pp-missing ul { margin: 6px 0 0; padding-left: 22px; }
.pp-missing li { margin: 0 0 4px; }
.pp-missing p { margin: 4px 0 0; }
.pp-cert-card.is-ready { border: 2px solid var(--yellow); }

/* ---------- State sections ---------- */
.pp-state { padding-top: 22px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.pp-state-head { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.pp-state-head > div { flex: 1; min-width: 0; }
.pp-state-name { margin: 0; font-family: var(--head); font-weight: 700; font-size: 1.6rem; line-height: 1; letter-spacing: -0.005em; }
.pp-state-count { margin: 6px 0 8px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.pp-bar { display: block; height: 6px; border-radius: 3px; background: var(--sand); overflow: hidden; }
.pp-bar span { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .6s var(--ease); }
.tile-bar { width: 100%; margin-top: 4px; }
.pp-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pp-stop { position: relative; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: var(--paper); }
.pp-stop.is-stamped { background: var(--paper); }
.pp-stop-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
/* Stamped: the options button sits in the bottom-right corner, under the photo */
.pp-stop-act.is-more { position: absolute; right: 14px; bottom: 14px; }
.is-stamped .pp-stop-main:not(:has(.pp-thumb)) .pp-stop-body { padding-right: 56px; }
.is-stamped .pp-stop-main:has(.pp-thumb) .pp-stop-body { min-height: 130px; }
.pp-thumb { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--sand); align-self: start; }
.is-stamped .pp-thumb { box-shadow: 0 0 0 3px var(--yellow); }
.pp-num {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; background: var(--paper); border: 1.5px solid var(--line-strong); align-self: start;
}
.is-stamped .pp-num { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.pp-stop-body { min-width: 0; }
.pp-stop-name { margin: 0; font-family: var(--head); font-weight: 700; font-size: 1.15rem; line-height: 1.08; overflow-wrap: anywhere; }
.pp-status { margin-top: 6px; font-weight: 700; font-size: 0.95rem; color: var(--ink-2); }
.pp-status .ico { vertical-align: -4px; margin-right: 2px; }
.is-stamped .pp-status { color: var(--rust-ink); }
.btn-stamp { border-color: var(--rust-ink); color: var(--rust-ink); white-space: nowrap; }
.btn-stamp:hover { background: var(--ink); color: #fff; }
.pp-more { width: 48px; padding: 0; }
.btn-outline-danger { border-color: var(--error-ink); color: var(--error-ink); }
.pp-panel { margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--paper); border: 1.5px solid var(--line-strong); }
.pp-panel p { margin: 0 0 10px; }
.pp-panel .status-chip { margin: 0; }
.pp-panel .inline-error { margin: 0 0 10px; }
.pp-panel .nav-btns { margin: 0 0 10px; }
.pp-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-far { font-size: 1.1rem; }
.pp-overlay {
  position: absolute; inset: 0; border-radius: 18px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .85); pointer-events: none; animation: pp-fade 2.6s var(--ease) both;
}
.stamp-mark { color: var(--rust-ink); transform: rotate(-8deg); animation: stamp-down .5s var(--ease) both; }
@keyframes stamp-down { 0% { transform: scale(1.6) rotate(-14deg); opacity: 0; } 70% { transform: scale(.96) rotate(-7deg); opacity: 1; } 100% { transform: rotate(-8deg); } }
@keyframes pp-fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 600px) {
  .pp-stop-act:not(.is-more) { grid-column: 1 / -1; }
  .pp-stop-act .btn-stamp { width: 100%; }
  .pp-thumb { width: 64px; height: 64px; }
}

/* ---------- Side tab ---------- */
.pp-side { padding: 8px 4px; }
.pp-side-count { margin: 4px 4px 12px; font-size: 1.05rem; }
.pp-side-count strong { font-family: var(--head); font-size: 2rem; color: var(--ink); }
.pp-side-list { list-style: none; margin: 12px 0 0; padding: 0; }
.pp-side-row { flex-direction: row !important; align-items: center; justify-content: flex-start !important; gap: 12px !important; width: 100%; }
.pp-side-row > span:last-child { display: flex; flex-direction: column; }
.tabs [role="tab"] { padding: 0 6px; }
.side .tabs .ico { display: none; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 120; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: 640px; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px;
  border-radius: 20px; background: var(--ink); color: var(--paper); font-weight: 600; box-shadow: var(--shadow-float); animation: rise .4s var(--ease) both;
}
.toast-undo { min-height: 48px; min-width: 72px; border-radius: var(--r-pill); border: 1.5px solid var(--paper); background: transparent; color: var(--paper); font-weight: 700; margin-left: auto; }

/* ---------- Certificate (full screen) ---------- */
.cert-overlay { position: fixed; inset: 0; z-index: 300; overflow-y: auto; background: var(--cream); padding: 12px 16px 40px; }
.cert-tools { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 820px; margin: 0 auto 12px; padding: 8px 0; background: var(--cream); }
.cert-tools .btn-quiet { margin-right: auto; }
.cert-name-field { max-width: 820px; margin: 0 auto 16px; }
.cert-name-field .field { margin-bottom: 6px; }
.cert-msg { margin: 0; font-weight: 600; }
.cert {
  max-width: 820px; margin: 0 auto; text-align: center; background: var(--paper); padding: 40px 24px;
  border: 6px double var(--rust-strong); border-radius: 6px; box-shadow: var(--shadow-warm);
}
.cert-eyebrow { margin: 0; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rust-ink); }
.cert-title { font-family: var(--head); font-weight: 800; font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1; margin: 10px 0 18px; }
.cert-line { margin: 0; font-size: 1.1rem; }
.cert-name {
  margin: 8px auto 12px; font-family: var(--head); font-weight: 800; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; color: var(--rust-ink);
  padding-bottom: 10px; max-width: 560px; overflow-wrap: anywhere;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 22px, transparent 22px 36px) bottom / 100% 3px no-repeat;
}
.cert-stats { margin: 16px 0 4px; font-weight: 700; font-size: 1.15rem; }
.cert-dates { margin: 0 0 22px; color: var(--ink-2); }
.cert-seals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; justify-items: center; }
@media (max-width: 560px) { .cert-seals .seal { width: 76px !important; height: 76px !important; } .cert { padding: 28px 14px; } }
@media print {
  body.printing-cert #root, body.printing-cert .toast-wrap { display: none !important; }
  body.printing-cert::before { display: none; }
  body.printing-cert .cert-overlay { position: static; overflow: visible; padding: 0; background: #fff; }
  body.printing-cert .cert-tools, body.printing-cert .cert-name-field { display: none !important; }
  body.printing-cert .cert { box-shadow: none; max-width: none; break-inside: avoid; }
  body.printing-cert .seal-ink { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
