/*
 * Leaption customer portal (Prompt 33A) — the portal's OWN stylesheet.
 *
 * Fonts are SELF-HOSTED (§7.9/D14): the four 32C brand-font families live in
 * /fonts as woff2 — no Google Fonts link, no CDN, no third-party request of
 * any kind. Inter / DM Sans / Work Sans ship as variable files (one file
 * covers 400–700); Poppins ships static 400/600/700.
 *
 * NOTE — typography guard scope: scripts/check-typography.js guards ONLY
 * frontend/css/styles.css + responsive.css (the main app). These @font-face
 * rules are portal-surface DATA (the tenant's chosen brand font, 32C D6) and
 * must never be copied into the guarded files.
 *
 * Page background is white/cream BY CONTRACT (32C D5b): the tenant's primary
 * colour was contrast-gated against #ffffff at save time — a dark page here
 * would void that guarantee (a flagged decision, not a styling tweak).
 */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("/fonts/work-sans-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("/fonts/poppins-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand vars — overwritten at render time from Settings.brand (32C).
     Defaults keep the un-branded states (not-found / not-available) neutral. */
  --p-primary: #1f5a52;
  --p-cta-text: #ffffff; /* auto black/white per the D5 contrast contract */
  --p-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --p-bg: #f7f3eb;      /* cream (the D5b-gated background family) */
  --p-card: #ffffff;
  --p-ink: #1c2a2b;
  --p-muted: #5f6d69;
  --p-line: #e5e0d5;
  --p-danger: #b3403a;
  --p-radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--p-bg);
  color: var(--p-ink);
  font-family: var(--p-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Mobile-first single column (§11 — links open on phones). */
.p-root {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.p-loading {
  margin: 40vh auto 0;
  color: var(--p-muted);
  text-align: center;
}

/* ── Header (brand) ─────────────────────────────────────────────────────── */
.p-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 4px 14px;
}
.p-logo {
  max-height: 44px;
  max-width: 160px;
  object-fit: contain;
}
.p-shop-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.p-card {
  background: var(--p-card);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  padding: 20px;
  margin-bottom: 16px;
}
.p-card h1, .p-card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  line-height: 1.3;
}
.p-card h3 {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  text-transform: none;
}
.p-muted { color: var(--p-muted); }
.p-small { font-size: 0.85rem; }

/* Per-send personal message from the shop. */
.p-message {
  background: var(--p-bg);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── Line items ─────────────────────────────────────────────────────────── */
.p-lines { margin: 8px 0 0; padding: 0; list-style: none; }
.p-line-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--p-line);
}
.p-line-item:last-child { border-bottom: 0; }
.p-line-name { font-weight: 600; overflow-wrap: anywhere; }
.p-line-code {
  color: var(--p-muted);
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.p-line-qty { color: var(--p-muted); font-size: 0.85rem; }
.p-line-price { text-align: right; white-space: nowrap; font-weight: 600; }

/* ── Totals (amounts shown exactly — trust cue, §11) ───────────────────── */
.p-totals { margin-top: 12px; border-top: 2px solid var(--p-ink); padding-top: 10px; }
.p-total-row { display: flex; justify-content: space-between; padding: 3px 0; }
.p-total-row .p-total-label { color: var(--p-muted); }
.p-total-row.p-grand { font-size: 1.15rem; font-weight: 700; }
.p-total-row.p-grand .p-total-label { color: var(--p-ink); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.p-btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.p-btn-primary {
  background: var(--p-primary);
  color: var(--p-cta-text); /* D5 auto-contrast — computed at render */
}
.p-btn-primary:disabled { opacity: 0.6; cursor: default; }
.p-btn-secondary {
  background: transparent;
  color: var(--p-ink);
  border: 1px solid var(--p-line);
  margin-top: 10px;
}

/* ── Details form ───────────────────────────────────────────────────────── */
.p-field { margin: 12px 0; }
.p-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.p-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--p-line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--p-ink);
}
.p-field input:focus {
  outline: 2px solid var(--p-primary);
  outline-offset: 1px;
}
.p-form-error {
  color: var(--p-danger);
  font-size: 0.85rem;
  margin: 8px 0 0;
  min-height: 1em;
}
.p-form-ok { color: #2c6e49; font-size: 0.85rem; margin: 8px 0 0; }
.p-details-toggle {
  background: none;
  border: 0;
  color: var(--p-primary);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.p-email-note { font-size: 0.8rem; color: var(--p-muted); margin-top: 2px; }

/* ── Designed states (D7) ───────────────────────────────────────────────── */
.p-state {
  text-align: center;
  padding: 36px 20px;
}
.p-state-icon { font-size: 2rem; margin-bottom: 10px; }
.p-state h1 { font-size: 1.25rem; margin: 0 0 8px; }
.p-state p { color: var(--p-muted); margin: 0 0 6px; }

/* Status pill on the K1 read-only view. */
.p-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--p-bg);
  color: var(--p-ink);
  margin-bottom: 10px;
}

/* ── Footer — Contact Us is ALWAYS visible (D7) ────────────────────────── */
.p-footer {
  margin-top: auto;
  padding-top: 22px;
  text-align: center;
}
.p-contact {
  display: inline-block;
  color: var(--p-primary);
  font-weight: 600;
  text-decoration: underline;
  margin-bottom: 10px;
}
.p-legal {
  color: var(--p-muted);
  font-size: 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 6px 0 0;
}
.p-powered {
  color: var(--p-muted);
  font-size: 0.7rem;
  margin-top: 10px;
}

/* Slightly roomier on wider screens; layout is the same single column. */
@media (min-width: 480px) {
  .p-root { padding: 24px 24px 56px; }
  .p-card { padding: 24px; }
}
