/*
 * Page styles for the claim form, the status page and the admin pages.
 * One stylesheet, no web fonts, no images: the Content-Security-Policy allows only files from this
 * site, and the pages must also work inside the embed button's frame.
 *
 * Colour: deep green-slate ink on white, one pine green for actions and approvals, brass for
 * "a person is checking", brick for problems. Text is at least 4.5:1 on its background and
 * control borders at least 3:1.
 */

:root {
  --ink: #14262b;
  --paper: #ffffff;
  --mist: #eef3f1;
  --pine: #0a5c4e;
  --pine-deep: #07463b;
  --muted: #4b5f64;
  --rule: #cfdad7;
  --control: #6b7f84;
  --brass: #7a5200;
  --brass-tint: #fbf1d6;
  --brick: #9b2c24;
  --brick-tint: #fcebe9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --column: 36rem;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--sans);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- page chrome ---- */

.site-header,
.site-footer {
  padding: 0.85rem max(1rem, calc((100% - var(--column)) / 2 + 1rem));
}

.site-header {
  border-bottom: 1px solid var(--rule);
}

.site-footer {
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.brand {
  color: var(--ink);
  font: 700 1.15rem/1.2 var(--serif);
  text-decoration: none;
}

.brand:hover {
  text-decoration: underline;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 1.75rem 1rem 3rem;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 6.5vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  margin: 2rem 0 0.5rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--pine);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--pine-deep);
}

:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 2px;
}

.lead {
  max-width: 32em;
  margin-bottom: 1.75rem;
  color: var(--muted);
}

/* ---- forms ---- */

.field {
  margin: 0 0 1.4rem;
}

label,
.label {
  display: block;
  margin: 0 0 0.2rem;
  font-weight: 600;
}

.hint,
.error {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.hint {
  color: var(--muted);
}

.error {
  color: var(--brick);
  font-weight: 600;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="search"],
input[type="password"],
select {
  display: block;
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--control);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

textarea {
  display: block;
  width: 100%;
  min-height: 5.5rem;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--control);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.has-error input,
.has-error select {
  border-color: var(--brick);
  box-shadow: inset 0 0 0 1px var(--brick);
}

.button {
  display: inline-block;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border: 2px solid var(--pine);
  border-radius: 6px;
  background: var(--pine);
  color: #ffffff;
  font: 700 1.0625rem/1.2 var(--sans);
  cursor: pointer;
}

.button:hover {
  border-color: var(--pine-deep);
  background: var(--pine-deep);
}

.button:disabled {
  border-color: var(--muted);
  background: var(--muted);
  cursor: progress;
}

/* A link that is the page's main action (Buy now, Back to the product) looks like the button. */
a.button,
a.button:hover {
  color: #ffffff;
  text-align: center;
  text-decoration: none;
}

@media (min-width: 30rem) {
  .button {
    width: auto;
  }
}

.alert {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem 0.5rem;
  border-left: 0.35rem solid var(--brick);
  background: var(--brick-tint);
}

.alert:focus-visible {
  outline-color: var(--brick);
}

.alert ul {
  margin: 0 0 0.5rem;
  padding-left: 1.2rem;
}

.alert a {
  color: var(--brick);
  font-weight: 600;
}

/* ---- claim form ---- */

.locked-product {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  background: var(--mist);
  font-weight: 600;
}

/* Added by app.js above the product list. */
.filter {
  margin-bottom: 0.4rem;
}

.filter-count {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.filter-count:empty,
.checking:empty {
  display: none;
}

.checking {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.fine-print {
  max-width: 32em;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* What the comparison covers, right under the lead. */
.lead:has(+ .compare-note) {
  margin-bottom: 0.75rem;
}

.compare-note {
  max-width: 32em;
  margin: 0 0 1.75rem;
  padding: 0.6rem 0.85rem;
  border-left: 0.3rem solid var(--pine);
  background: var(--mist);
  font-size: 0.95rem;
}

/* ---- status page ---- */

.outcome {
  margin: 0 0 2rem;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 0.4rem solid var(--control);
}

.outcome-approved {
  border-color: var(--pine);
}

.outcome-review {
  border-color: var(--brass);
}

.outcome-rejected {
  border-color: var(--brick);
}

.outcome-product {
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-weight: 600;
}

.deal {
  margin-bottom: 0.25rem;
  font: 400 1.2rem/1.3 var(--serif);
}

.deal-now {
  color: var(--pine);
  font-size: 2.1rem;
  font-variant-numeric: lining-nums tabular-nums;
}

.deal-was {
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  text-decoration-thickness: 2px;
}

/* The Buy now button, a little away from the price above it. */
.buy {
  margin: 0.9rem 0 0;
}

.ticket {
  margin: 0.9rem 0 1rem;
  padding: 0.9rem 1rem;
  border: 2px dashed var(--pine);
  border-radius: 10px;
  background: var(--mist);
  text-align: center;
}

.code {
  margin: 0;
  font: 700 clamp(1.3rem, 7.4vw, 2rem) / 1.25 var(--mono);
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
  user-select: all;
}

.ticket-note {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.ticket-spent {
  border-color: var(--control);
}

.ticket-spent .code {
  color: var(--muted);
  text-decoration: line-through;
}

.notes,
.sent {
  margin: 0 0 1.75rem;
}

.notes h2,
.sent h2 {
  margin-top: 0;
}

.reasons {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
}

.reasons li {
  margin-bottom: 0.5rem;
}

.team-note {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-left: 0.3rem solid var(--control);
  background: var(--mist);
}

.sent dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
}

.sent dt {
  color: var(--muted);
}

.sent dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 24rem) {
  .sent dl {
    grid-template-columns: 1fr;
  }

  .sent dd {
    margin-bottom: 0.5rem;
  }
}

.again {
  margin: 0;
}

.again + .again {
  margin-top: 0.5rem;
}

/* The WELCOME10 pointer under a refusal. */
.welcome {
  padding: 0.65rem 0.85rem;
  border-left: 0.3rem solid var(--pine);
  background: var(--mist);
  font-weight: 600;
}

/* ---- conditions page ---- */

.conditions {
  margin: 0 0 1.75rem;
  padding-left: 1.2rem;
}

.conditions li {
  margin-bottom: 0.6rem;
}

/* ---- inside the embed button's frame ---- */

body.embed {
  min-height: 0;
}

body.embed main {
  max-width: none;
  padding: 0.75rem 1.25rem 1.5rem;
}

body.embed h1 {
  font-size: 1.65rem;
}

/* ---- admin pages: the same look, denser and wider ---- */

body.admin {
  --column: 68rem;
}

body.admin h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.5rem, 5vw, 1.9rem);
}

body.admin h2 {
  margin-top: 1.75rem;
  font-size: 1.15rem;
}

.admin-form {
  max-width: 32rem;
}

.admin-nav {
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.admin-nav ul,
.filters ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-nav a,
.linkish {
  display: inline-block;
  padding: 0.6rem 0;
  font-weight: 600;
}

.admin-nav a {
  border-bottom: 3px solid transparent;
  color: var(--ink);
  text-decoration: none;
}

.admin-nav a:hover {
  border-bottom-color: var(--control);
}

.admin-nav a[aria-current="page"] {
  border-bottom-color: var(--pine);
  color: var(--pine-deep);
}

/* Sign out sits at the far end of the bar. */
.admin-nav li:last-child {
  margin-left: auto;
}

.nav-form {
  margin: 0;
}

/* A button that looks like the links around it (sign out). */
.linkish {
  border: 0;
  background: none;
  color: var(--pine);
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.linkish:hover {
  color: var(--pine-deep);
}

.filters {
  margin: 0 0 1rem;
}

.filters a {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border: 1.5px solid var(--control);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.95rem;
  text-decoration: none;
}

.filters a:hover {
  background: var(--mist);
}

.filters a[aria-current="page"] {
  border-color: var(--pine);
  background: var(--pine);
  color: #ffffff;
}

.count,
.empty,
.muted {
  color: var(--muted);
}

.count {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
}

.crumbs {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

code {
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: var(--mist);
  font: 0.9em var(--mono);
}

/* Tables scroll sideways inside their box on a narrow screen instead of breaking the page. */
.table-wrap {
  position: relative; /* keeps the visually hidden text inside the scrolling box */
  margin: 0 0 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.table {
  width: 100%;
  min-width: 40rem; /* narrower screens scroll the table instead of crushing its columns */
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: var(--mist);
  font-size: 0.85rem;
  white-space: nowrap;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody th {
  font-weight: 600;
}

.table td {
  overflow-wrap: anywhere;
}

/* A note under a pack's name on the products list (the pack's "needs your attention" text). */
.table .pack-note {
  margin: 0.3rem 0 0;
  font-weight: 400;
}

.table .num {
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
  white-space: nowrap;
}

/* Several items in one table cell (the competitor listings of a pack): one under the other, with room between. */
.cell-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cell-list li + li {
  margin-top: 0.6rem;
}

.status,
.tag {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font: 700 0.78rem/1.55 var(--sans);
  vertical-align: middle;
  white-space: nowrap;
}

.status {
  margin-left: 0.35rem;
}

.status-review,
.tag-review {
  background: var(--brass-tint);
  color: var(--brass);
}

.status-approved {
  background: var(--mist);
  color: var(--pine);
}

.status-rejected,
.tag-reject {
  background: var(--brick-tint);
  color: var(--brick);
}

.tag-info {
  background: var(--mist);
  color: var(--muted);
}

/* Label and value pairs: a claim's facts. */
.facts {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0 0 1.5rem;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.facts dd .muted {
  font-weight: 400;
}

.note {
  white-space: pre-wrap;
}

@media (max-width: 36rem) {
  .facts {
    grid-template-columns: 1fr;
  }

  .facts dd {
    margin-bottom: 0.5rem;
  }
}

.reason-list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.reason-list li {
  margin-bottom: 0.6rem;
}

.warning {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-left: 0.35rem solid var(--brass);
  background: var(--brass-tint);
}

.decision {
  display: grid;
  gap: 1.5rem;
  margin: 0 0 1.5rem;
}

.decision section {
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.decision h3 {
  margin: 0 0 0.75rem;
  font: 700 1.1rem/1.3 var(--serif);
}

@media (min-width: 48rem) {
  .decision {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.button-danger {
  border-color: var(--brick);
  background: var(--brick);
}

.button-danger:hover {
  border-color: #74201a;
  background: #74201a;
}

/* ---- admin catalog: products, retailers, settings ---- */

.notice {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border-left: 0.35rem solid var(--pine);
  background: var(--mist);
  font-weight: 600;
}

.status-active,
.status-off,
.status-redeemed {
  background: var(--mist);
}

.status-active {
  color: var(--pine);
}

.status-off,
.status-redeemed {
  color: var(--muted);
}

/* Codes: expired is a warning colour, void is the red of a rejection. A listing in another currency is marked the same way as expired. */
.status-expired,
.status-warn {
  background: var(--brass-tint);
  color: var(--brass);
}

.status-void {
  background: var(--brick-tint);
  color: var(--brick);
}

/* The Active checkbox: the box and its label side by side, the hint on its own line below. */
.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.6rem;
  align-items: center;
}

.check input {
  width: 1.3rem;
  height: 1.3rem;
  margin: 0;
  accent-color: var(--pine);
}

.check label {
  margin: 0;
}

.check .hint {
  grid-column: 2;
  margin: 0.2rem 0 0;
}

input[type="file"] {
  display: block;
  max-width: 100%;
  font: inherit;
}

.cancel {
  display: inline-block;
  margin-left: 0.75rem;
  padding: 0.7rem 0;
  font-weight: 600;
}

.row-actions {
  white-space: nowrap;
}

.row-actions a {
  margin-right: 0.75rem;
  font-weight: 600;
}

.inline-form {
  display: inline;
  margin: 0;
}

.button-small {
  width: auto;
  min-height: 2.25rem;
  padding: 0.3rem 0.9rem;
  font-size: 0.95rem;
}

/* A button that is not the main action: outlined, not filled. */
.button-quiet {
  background: var(--paper);
  color: var(--pine);
}

.button-quiet:hover {
  background: var(--mist);
  color: var(--pine-deep);
}
