/*
 * munchterm plus: member dashboard pages (account, not_member). Owned by the ACCOUNT flow agent.
 *
 * Linked on every page after base.css (app/root.tsx), so every class in here is prefixed
 * `acct-` 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, notices, the pass, chips,
 * tiles, menus and the action bar all come from base.css.
 *
 * Layout: one column on phones, in the page's section order (admin sets it). From 900px a two
 * column grid: the alert, the pass, the drops and any text or banner span both columns, and the
 * smaller blocks (savings, the rest of your stash, manage, payments) sit side by side, still in
 * section order.
 */

/* --- page ------------------------------------------------------------------ */

.acct-notices {
  display: grid;
  gap: var(--s3);
  margin-bottom: var(--s4);
}

.acct-notices:empty {
  display: none;
}

.acct-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s7);
}

/* A section that renders nothing (card_alert with no problem) leaves no gap. */
.acct-section:empty {
  display: none;
}

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

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

/* The alert sits tight on the pass it is about. */
.acct-grid > .acct-section:has(.notice) {
  margin-bottom: calc(var(--s4) - var(--s7));
}

/* --- the pass ------------------------------------------------------------ */

.acct-pass .pass__headline h1 {
  font-size: 1.75rem;
  line-height: 1.1;
}

.acct-pass .pass__body p {
  margin: 0;
}

.acct-pass .pass__body p + p {
  margin-top: var(--s2);
}

.acct-pass .pass__body dd {
  margin: 0;
}

/* --- drops ------------------------------------------------------------------- */

.acct-empty {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
}

.acct-empty p {
  margin: 0;
}

.acct-empty__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--pink-wash);
  color: var(--pink);
}

.acct-empty__title {
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 700;
}

.acct-cta {
  display: grid;
  justify-items: start;
  gap: var(--s2);
  margin: var(--s5) 0 var(--s3);
}

.acct-cta .handoff {
  margin: 0;
}

/* Disclosures and rows (drop history, payments) are base.css `.more` and `.rows` / `.row`. */

/* --- savings ------------------------------------------------------------------ */

.acct-savings__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
}

.acct-savings__grid > div {
  padding: var(--s4) var(--s3);
}

.acct-savings__grid > div + div {
  border-left: 1px solid var(--line);
}

.acct-savings__grid dt {
  color: var(--ink-muted);
  font-size: var(--size-tiny);
}

.acct-savings__grid dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
}

/* --- the rest of your stash ------------------------------------------------------- */

.acct-hub__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line);
  border: 1px solid var(--line);
}

.acct-hub__link {
  position: relative;
  display: grid;
  align-content: start;
  gap: 2px;
  height: 100%;
  min-height: 120px;
  padding: var(--s4);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.acct-hub__link:hover {
  background: var(--ground);
  color: var(--ink);
}

/* A tile admin gave no link: the same tile, not clickable. */
.acct-hub__link--static:hover {
  background: var(--surface);
}

/* Two columns with hairlines drawn by the gap: an odd last tile spans both, so no empty grey cell
   shows. Admin decides how many tiles there are. */
.acct-hub__grid > li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.acct-hub__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s2);
  background: var(--surface-sunk);
}

.acct-hub__label {
  font-family: var(--font-heading);
  font-weight: 700;
}

.acct-hub__detail {
  color: var(--ink-muted);
  font-size: var(--size-small);
  line-height: 1.35;
}

/* The arrow sits level with the middle of the 48px icon tile beside it. */
.acct-hub__go {
  position: absolute;
  top: calc(var(--s4) + 12px);
  right: var(--s4);
  display: flex;
  color: var(--ink-muted);
}

/* --- not a member ------------------------------------------------------------------ */

.acct-text--lead {
  padding: var(--s6) var(--s4);
  background: var(--pink-wash);
  border-left: 4px solid var(--pink);
}

.acct-text--lead .section-head {
  margin-bottom: var(--s5);
}

.acct-text--lead .section-head__body {
  color: var(--ink-body);
}

.acct-text__image {
  display: block;
  max-width: 100%;
  height: auto;
  margin-bottom: var(--s4);
}

.acct-benefits__list {
  display: grid;
  gap: var(--s4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.acct-benefits__list li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: var(--s3);
  align-items: start;
}

.acct-benefits__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--pink);
}

.acct-benefits__list strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-heading);
}

.acct-benefits__body {
  display: block;
  color: var(--ink-muted);
  font-size: var(--size-small);
}

.acct-banner img {
  display: block;
  width: 100%;
  height: auto;
}

.acct-banner__caption {
  margin: var(--s2) 0 0;
  color: var(--ink-muted);
  font-size: var(--size-small);
}

/* --- sign out and the bar ---------------------------------------------------------- */

/* The phone bar's "opens munchterm.co.uk" beside a button that leaves plus. */
.acct-bar-note {
  align-items: center;
}

.acct-signout {
  margin-top: var(--s7);
}

.acct-signout__form {
  display: inline;
}

/* --- wider ------------------------------------------------------------------------------ */

@media (min-width: 600px) {
  .acct-cta {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
    gap: var(--s4);
  }

  .acct-pass .pass__footer {
    display: flex;
    flex-wrap: wrap;
  }

  .acct-text--lead {
    padding: var(--s7) var(--s6);
  }

  .acct-benefits__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .acct-benefits__list li {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .acct-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s7) var(--s6);
    align-items: start;
  }

  .acct-section--wide {
    grid-column: 1 / -1;
  }

  .acct-grid > .acct-section:has(.notice) {
    margin-bottom: calc(var(--s4) - var(--s7));
  }

  .acct-pass .pass__headline h1 {
    font-size: 2.5rem;
  }
}

@media print {
  .acct-signout {
    display: none;
  }
}
