/* The signed-in pages: the brand upload page (/brands/) and the review page
   (/review/). Built on site.css's colours and type. Statuses and
   differences use ink, tint and outline only: red, amber and leaf green
   stay reserved for verdicts. */

:root {
  --tint: #edf3eb;
  --camera-night: #0b0f0c;
}

.portal {
  padding-block: clamp(28px, 5vw, 56px) clamp(64px, 8vw, 104px);
}
.portal[hidden],
[hidden] {
  display: none !important;
}
.portal > * + * {
  margin-top: 24px;
}
.portal h2 {
  font-size: var(--step-2);
}
.portal h3 {
  font-size: var(--step-1);
  font-stretch: 85%;
}

/* Who is signed in, which brand, and the way out. */
.portal-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.portal-bar .who {
  display: grid;
  gap: 2px;
}
.portal-bar .who strong {
  font-size: var(--step-1);
  font-weight: 800;
  font-stretch: 85%;
  line-height: 1.2;
}
.portal-bar .who span {
  font-size: var(--step--1);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.portal-bar .bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.portal-bar select {
  min-width: 12rem;
}

/* Cards and sections */
.card {
  padding: clamp(18px, 3vw, 28px);
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.card > * + * {
  margin-top: 14px;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}
.lead {
  color: var(--ink-2);
  max-width: var(--measure);
}
.muted {
  color: var(--ink-3);
}
.small {
  font-size: var(--step--1);
}

/* Buttons beyond site.css's primary */
.button-outlined {
  background: var(--paper);
  color: var(--green);
  border: 1.5px solid var(--line);
}
.button-outlined:hover {
  color: var(--green-press);
  border-color: var(--green);
}
.button-text {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  background: transparent;
  color: var(--green);
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: var(--step--1);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}
.button-text:hover {
  background: var(--green-tint);
  color: var(--green-press);
}
.button[disabled],
.button-text[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.button-small {
  min-height: 44px;
  padding: 8px 18px;
  font-size: var(--step--1);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Forms */
.portal-form {
  display: grid;
  gap: 16px;
  max-width: 34rem;
}
.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.field label {
  font-weight: 700;
  font-size: var(--step--1);
}
.field .unit {
  font-weight: 400;
  color: var(--ink-3);
}
.field-hint {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.portal input[type="text"],
.portal input[type="email"],
.portal input[type="month"],
.portal select,
.portal textarea,
.sign-in input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
}
.portal textarea {
  resize: vertical;
  min-height: 96px;
}
.portal select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%234b5b51' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.portal input:focus-visible,
.portal select:focus-visible,
.portal textarea:focus-visible,
.sign-in input:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 1px;
  border-color: var(--green);
  background: var(--paper);
}
.portal input.num {
  font-variant-numeric: tabular-nums;
}
.code-input {
  max-width: 12rem;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}
.form-error {
  font-weight: 600;
  color: var(--ink);
  padding-left: 12px;
  border-left: 3px solid var(--ink);
}
.check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
}

/* The details form */
.details-form {
  display: grid;
  gap: 28px;
}
.details-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.details-form legend {
  padding: 0;
  margin-bottom: 12px;
  font-weight: 800;
  font-stretch: 85%;
  font-size: var(--step-1);
}
.details-form fieldset > .field + .field {
  margin-top: 16px;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field-grid + .field-grid {
  margin-top: 16px;
}
.field-grid .field-wide {
  grid-column: 1 / -1;
}
.field-grid-numbers {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.field-grid-lights {
  grid-template-columns: minmax(0, 1fr);
}
.light-pair {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 16px;
}
/* A field the brand (or reviewer) changed from our reading. */
.field.is-changed input,
.field.is-changed select,
.field.is-changed textarea {
  border-color: var(--ink);
  background: var(--paper);
}
.ref-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
}

/* Notices. Errors are ink, never a verdict colour. */
.notice {
  display: grid;
  gap: 6px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--tint);
}
.notice strong {
  font-weight: 800;
}
.notice-error {
  background: var(--paper);
  border: 2px solid var(--ink);
}
.notice-done {
  background: var(--green-tint);
}
.notice-note {
  background: var(--paper);
  border-left: 4px solid var(--ink);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice .actions {
  margin-top: 6px;
}

/* Status chips: sentence case, ink and tints only. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--tint);
  color: var(--ink-2);
}
.status-draft {
  background: transparent;
  border: 1px dashed var(--dashed);
  color: var(--ink-3);
}
.status-returned {
  background: var(--ink);
  color: #fff;
}
.status-live {
  background: var(--green-tint);
  color: var(--green);
}
.status-closed {
  background: var(--nodata-bg);
  color: var(--ink-3);
}

/* Lists of products (brand) and of the queue (review) */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 20px;
  align-items: center;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.item h3 {
  font-size: var(--step-1);
  font-stretch: 85%;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.item h3 a {
  color: inherit;
  text-decoration: none;
}
.item h3 a:hover {
  color: var(--green);
  text-decoration: underline;
}
.item .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.item .note {
  grid-column: 1 / -1;
  font-size: var(--step--1);
}
.digits {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.empty {
  padding: 28px 20px;
  border: 1.5px dashed var(--dashed);
  border-radius: var(--radius-card);
  color: var(--ink-2);
  text-align: center;
}

/* Steps of adding a product */
.step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 16px;
}
.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--night);
  color: var(--mint);
  font-weight: 800;
}
.card > .step + .step {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--card-edge);
}
.step.is-done .step-num {
  background: var(--green-tint);
  color: var(--green);
}
.step.is-waiting {
  opacity: 0.6;
}
.step-body > * + * {
  margin-top: 14px;
}
.step-body > h2 {
  font-size: var(--step-1);
  font-stretch: 85%;
  line-height: 1.3;
  padding-top: 4px;
}

/* Artwork slots: one per view of the pack */
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 14px;
}
.slot {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border: 1.5px dashed var(--dashed);
  border-radius: var(--radius-card);
  background: var(--paper);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.slot.has-images {
  border-style: solid;
  border-color: var(--card-edge);
}
.slot.is-over {
  border-color: var(--green);
  background: var(--green-tint);
}
.slot-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.slot-head strong {
  font-weight: 800;
}
.slot-head span {
  font-size: 0.8125rem;
  color: var(--ink-3);
  white-space: nowrap;
}
.slot .field-hint {
  margin-top: -6px;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tint);
  border: 1px solid var(--card-edge);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(251, 252, 250, 0.7);
}
.thumb .thumb-label {
  position: absolute;
  inset: auto 0 0;
  padding: 2px 4px;
  background: rgba(22, 35, 27, 0.75);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}
.add-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--green);
  font-weight: 700;
  font-size: var(--step--1);
  cursor: pointer;
}
.add-image:hover {
  background: var(--green-tint);
}
.add-image input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.add-image:focus-within {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.slot-error {
  font-size: 0.8125rem;
  font-weight: 600;
}

/* Reading in progress */
.working {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.working::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--green-tint);
  border-top-color: var(--green);
  animation: portal-spin 900ms linear infinite;
}
@keyframes portal-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .working::before {
    animation: none;
    border-top-color: var(--green-tint);
    border-color: var(--green);
  }
}

/* A read-only list of details */
.facts {
  display: grid;
  grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
  gap: 8px 20px;
  margin: 0;
  font-size: var(--step--1);
}
.facts dt {
  font-weight: 700;
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- Review page ---------- */

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
.artwork {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
}
.artwork-main {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  border-radius: var(--radius-card);
  background: var(--camera-night);
}
.artwork-main img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  cursor: zoom-in;
}
.artwork-main.is-zoomed {
  place-items: start;
}
.artwork-main.is-zoomed img {
  max-width: none;
  max-height: none;
  width: 200%;
  cursor: zoom-out;
}
.artwork-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.artwork-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.artwork-thumbs button {
  flex: none;
  width: 76px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--tint);
  cursor: pointer;
  overflow: hidden;
  font: inherit;
  text-align: center;
}
.artwork-thumbs button[aria-current="true"] {
  border-color: var(--green);
}
.artwork-thumbs img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.artwork-thumbs span {
  display: block;
  padding: 2px;
  font-size: 0.75rem;
  color: var(--ink-2);
}
.no-image {
  color: var(--on-night-2);
  padding: 24px;
  text-align: center;
}

.review-panel > * + * {
  margin-top: 20px;
}
.review-head h2 {
  font-size: var(--step-2);
  overflow-wrap: anywhere;
}
.review-head .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 8px;
  font-size: var(--step--1);
  color: var(--ink-2);
}

/* The differences the reviewer must look at, one by one. */
.diffs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.diff {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 2px solid var(--ink);
}
.diff.is-checked {
  border-color: var(--card-edge);
  background: var(--tint);
}
.diff-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 16px;
  margin: 10px 0 0 36px;
  font-size: var(--step--1);
}
.diff-values div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.diff-values b {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-3);
  font-weight: 700;
}
.absent {
  color: var(--ink-3);
  font-style: italic;
}

/* Brand / our reading / in HariLens now */
.compare-wrap {
  overflow-x: auto;
}
.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  line-height: 1.45;
  background: var(--paper);
}
.compare th,
.compare td {
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.compare thead th {
  border-bottom: 3px solid var(--ink);
  font-weight: 700;
  white-space: nowrap;
}
.compare tbody th {
  font-weight: 600;
  width: 22%;
}
.compare tr.is-diff th,
.compare tr.is-diff td {
  background: var(--tint);
}
.compare tr.is-diff th {
  box-shadow: inset 4px 0 0 var(--ink);
}
.diff-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: 1px;
}

.decision textarea {
  min-height: 110px;
}

@media (max-width: 960px) {
  .review-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .artwork {
    position: static;
  }
  .artwork-main,
  .artwork-main img {
    max-height: 70vh;
  }
}

@media (max-width: 720px) {
  .field-grid,
  .field-grid-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .item {
    grid-template-columns: minmax(0, 1fr);
  }
  .step {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
  }
  .step-num {
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
  }
  .step-body > h2 {
    padding-top: 0;
  }
  .item .note {
    order: 1;
  }
  .item > .button {
    order: 2;
  }
  .diff-values {
    grid-template-columns: minmax(0, 1fr);
    margin-left: 0;
  }
  /* The comparison table becomes one block per field. */
  .compare thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .compare,
  .compare tbody,
  .compare tr,
  .compare th,
  .compare td {
    display: block;
    width: auto;
  }
  .compare tr {
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .compare th,
  .compare td {
    border: 0;
    padding: 2px 12px;
  }
  .compare tbody th {
    width: auto;
  }
  .compare td::before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--ink-3);
  }
}

@media (max-width: 520px) {
  .field-grid,
  .field-grid-numbers,
  .light-pair {
    grid-template-columns: minmax(0, 1fr);
  }
  .field-grid-numbers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .facts dd + dt {
    margin-top: 8px;
  }
  .portal-bar select {
    min-width: 0;
    width: 100%;
  }
}

/* The page headers: sign-in actions on the brand page, and a shorter title
   band on the review page. */
.doc-actions {
  margin-top: 24px;
}
.doc-title-compact {
  padding-block: clamp(12px, 2vw, 24px) clamp(24px, 3vw, 36px);
}
.sign-in-card {
  max-width: 36rem;
}
.prose .sign-in-card p + .portal-form,
.sign-in-card .notice + .sign-in {
  margin-top: 14px;
}
