/*
 * munchterm plus: smaller pages (persona, receipt, terms, error). Owned by the MISC flow agent.
 *
 * Linked on every page after base.css (app/root.tsx), so every class in here is prefixed
 * `misc-` to keep it from touching another flow's pages. Anything a second flow needs belongs
 * in base.css (raise it with the orchestrator). Tokens, buttons, forms, notices, cards, the pass, chips,
 * tiles, rails, menus and the action bar are all in base.css already.
 *
 * Markup: app/components/misc/*. Mobile first: designed at 375px, widened at 600 and 900px.
 * The error page is the shared StatusScreen (base.css) and takes only its words from here.
 */

/* --- text sections (TextSection.tsx) ------------------------------------------------- */

.misc-text .section-head {
  margin-bottom: 0;
}

.misc-text .section-head__body p {
  margin: 0;
}

.misc-text .section-head__body p + p {
  margin-top: var(--s2);
}

/* --- persona ------------------------------------------------------------------------- */

.misc-persona .back-link {
  margin-bottom: var(--s3);
}

.misc-persona__form {
  gap: var(--s6);
}

.misc-picker .section-head {
  margin-bottom: var(--s4);
}

/* The current choice in words as well as a ticked card. The tick is ink, like the cards'. */
.misc-picker__current {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: 0 0 var(--s3);
  color: var(--ink);
  font-size: var(--size-small);
}

.misc-picker__current .icon {
  color: var(--ink);
}

.misc-picker__when {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s4) 0 0;
  color: var(--ink-muted);
  font-size: var(--size-small);
  line-height: 1.45;
}

/* --- receipt --------------------------------------------------------------------------- */

.misc-receipt-tools {
  display: grid;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.misc-receipt-tools__print {
  display: grid;
  gap: var(--s1);
  justify-items: start;
}

.misc-receipt-tools__hint {
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--size-tiny);
}

/* The document: a white sheet with the plus mark at the top, a heavy rule under the head and
   over the total, like a till receipt that learned to typeset. */
.misc-receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s5) var(--s4);
}

.misc-receipt__head {
  display: grid;
  gap: var(--s4);
  padding-bottom: var(--s4);
  margin-bottom: var(--s2);
  border-bottom: 2px solid var(--ink);
}

.misc-receipt__mark {
  height: 40px;
  width: auto;
}

.misc-receipt__title h1 {
  margin: 0;
  font-size: var(--size-h2);
}

.misc-receipt__date {
  margin: var(--s1) 0 0;
  color: var(--ink-muted);
  font-size: var(--size-small);
}

.misc-receipt__facts dd {
  overflow-wrap: anywhere;
}

.misc-receipt__totals {
  width: 100%;
  border-collapse: collapse;
  margin-block: var(--s4) var(--s5);
}

.misc-receipt__totals th,
.misc-receipt__totals td {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 400;
}

.misc-receipt__totals td {
  text-align: right;
  color: var(--ink);
}

.misc-receipt__total th,
.misc-receipt__total td {
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
}

.misc-receipt__seller {
  color: var(--ink-muted);
  font-size: var(--size-small);
  line-height: 1.5;
}

.misc-receipt__seller p {
  margin: 0;
}

.misc-receipt__seller-label {
  margin-bottom: var(--s1) !important;
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 700;
}

.misc-receipt__seller-name {
  color: var(--ink);
}

.misc-receipt-note {
  margin-top: var(--s5);
  color: var(--ink-muted);
  font-size: var(--size-small);
}

/* --- terms ----------------------------------------------------------------------------- */

/* The back link stays in reach while the terms scroll: pinned under the sticky header. */
.misc-terms-bar {
  position: sticky;
  top: var(--header-total);
  z-index: 15;
  background: rgba(250, 250, 250, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.misc-terms-bar__inner {
  display: flex;
  align-items: center;
}

.misc-terms__head {
  max-width: 68ch;
  margin-bottom: var(--s6);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line);
}

.misc-terms__head > * + * {
  margin-top: var(--s4);
}

.misc-terms__head .section-head__body {
  font-size: var(--size-lede);
}

.misc-terms__body {
  color: var(--ink-body);
  line-height: 1.7;
}

/* Each numbered term opens with a hairline, so a long page reads as a list of short ones. */
.misc-terms__body h2 {
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  font-size: var(--size-h3);
}

.misc-terms__body > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* The draft notice: "action needed" amber, not the pink of the brand. */
.misc-terms__body blockquote {
  border-left-color: var(--warning-bright);
  background: var(--warning-wash);
  color: var(--ink);
  font-size: var(--size-small);
}

.misc-terms__body blockquote p {
  margin: 0;
}

.misc-terms__body blockquote p + p {
  margin-top: var(--s2);
}

/* --- bigger screens -------------------------------------------------------------------- */

@media (min-width: 600px) {
  .misc-receipt-tools {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .misc-receipt-tools__print {
    justify-items: end;
    text-align: right;
  }

  .misc-receipt {
    padding: var(--s6);
  }

  .misc-receipt__head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .misc-receipt__title {
    text-align: right;
  }
}

@media (min-width: 900px) {
  .misc-receipt__mark {
    height: 48px;
  }
}

/* --- print: the receipt alone ----------------------------------------------------------- */

@media print {
  .misc-receipt {
    border: 0;
    padding: 0;
  }

  .misc-receipt__head {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .misc-receipt__title {
    text-align: right;
  }

  .misc-receipt__head,
  .misc-receipt__total th,
  .misc-receipt__total td {
    border-color: #000;
  }

  .misc-receipt-note {
    color: #000;
  }

  .misc-terms__body blockquote {
    background: none;
    border-left-color: #000;
  }
}
