/* PubFit Desk (/desk). Builds on site.css (colours, buttons, logo, focus styles). */

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.desk-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  overflow-wrap: break-word;
}
/* Author-supplied text (file names, quotes, URLs) may hold very long words. */
.desk-file-name, .desk-session-file, .desk-quote, .desk-item-missing,
.desk-finding-message, .desk-item-wording, .desk-attribution { overflow-wrap: anywhere; }

/* ---------- Header ---------- */
.desk-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.96);
  border-bottom: 1px solid var(--line);
}
.desk-header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
}
.desk-brand { display: inline-flex; align-items: center; gap: 12px; }
.desk-product {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--navy-deep);
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.desk-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.8rem;
  color: var(--muted);
  counter-reset: desk-step;
}
.desk-steps li { display: inline-flex; align-items: center; gap: 6px; }
.desk-steps li::before {
  counter-increment: desk-step;
  content: counter(desk-step);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
}
.desk-steps li.is-done { color: var(--ink-soft); }
.desk-steps li.is-done::before { background: rgba(20, 184, 166, 0.15); border-color: var(--teal); color: #0B6B5F; }
.desk-steps li[aria-current="step"] { color: var(--navy-deep); font-weight: 600; }
.desk-steps li[aria-current="step"]::before { background: var(--navy-deep); border-color: var(--navy-deep); color: #fff; }

/* ---------- Main card ---------- */
.desk-main {
  flex: 1;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.desk-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 18px;
}
@media (min-width: 640px) {
  .desk-main { padding-top: 40px; }
  .desk-card { padding: 36px 40px; }
}
.desk-card h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); margin-bottom: 12px; }
.desk-card h2 { font-size: clamp(1.35rem, 4.5vw, 1.75rem); margin-bottom: 12px; line-height: 1.2; }
.desk-card h3 { font-size: 1.2rem; margin: 36px 0 10px; }
.desk-card h4 { font-family: 'DM Sans', sans-serif; font-size: 1rem; font-weight: 600; letter-spacing: 0; }
.desk-card p + p { margin-top: 10px; }
.desk-card [tabindex="-1"]:focus { outline: none; }
.desk-card .btn { white-space: normal; text-align: center; justify-content: center; }
.desk-view > p { color: var(--ink-soft); }

.desk-lead { font-size: 1.02rem; margin-bottom: 28px; }
.desk-subtitle { margin-top: 8px; }
.desk-hint { color: var(--muted); font-size: 0.9rem; }
.desk-meta { color: var(--muted); font-size: 0.95rem; }

.desk-btn-block { width: 100%; margin-top: 18px; }
.desk-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.desk-actions + .desk-hint { margin-top: 10px; min-height: 1.4em; }
.desk-btn-text {
  background: none;
  border: 0;
  padding: 6px 4px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.desk-btn-danger { background: #B91C1C; color: #fff; }
.desk-btn-danger:hover { background: #991B1B; }
.desk-btn-danger:disabled, .btn:disabled { opacity: 0.6; cursor: default; transform: none; }

input:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }

/* ---------- Alerts and notices ---------- */
.desk-alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #7F1D1D;
  font-size: 0.94rem;
}
.desk-privacy {
  margin-top: 20px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}
.desk-privacy a, .desk-attribution a { color: var(--navy); text-decoration: underline; text-underline-offset: 2px; }
.desk-disclaimer {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--navy);
  background: rgba(30, 58, 138, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.94rem;
}
.desk-override {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #FFFBEB;
  border: 1px solid #FCD34D;
  color: #78350F;
  font-size: 0.94rem;
}
.desk-view > p.desk-override, .desk-view > p.desk-disclaimer { color: inherit; }
.desk-view > p.desk-disclaimer { color: var(--ink-soft); }
.desk-view > p.desk-override { color: #78350F; }

/* ---------- Upload ---------- */
.desk-drop {
  position: relative;
  margin-top: 14px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--cream);
  transition: border-color 0.2s, background 0.2s;
}
.desk-drop:hover, .desk-drop.is-dragover { border-color: var(--teal); background: #F0FDFA; }
.desk-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.desk-drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
}
.desk-file-input:focus-visible + .desk-drop-label { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: var(--radius); }
.desk-drop-title { font-weight: 600; color: var(--ink); }
.desk-drop-sub { color: var(--muted); font-size: 0.92rem; }
.desk-drop-link { color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.desk-file {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream);
}
.desk-file-text { min-width: 0; }
.desk-file-name { font-weight: 600; color: var(--ink); }
.desk-file-size { color: var(--muted); font-size: 0.88rem; }

/* ---------- Progress ---------- */
.desk-progress {
  position: relative;
  height: 6px;
  margin: 22px 0 14px;
  border-radius: 999px;
  background: var(--cream-warm);
  overflow: hidden;
}
.desk-progress span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), var(--teal));
  animation: desk-progress 1.6s ease-in-out infinite;
}
@keyframes desk-progress {
  from { left: -35%; }
  to { left: 100%; }
}

/* ---------- Design step ---------- */
.desk-fieldset { border: 0; margin-top: 18px; min-width: 0; }
.desk-legend { font-weight: 600; margin-bottom: 10px; color: var(--ink); }
.desk-options { display: grid; gap: 10px; }
.desk-option { position: relative; }
.desk-option input {
  position: absolute;
  top: 18px;
  left: 16px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--navy-deep);
}
.desk-option label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 14px 14px 14px 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.desk-option label:hover { border-color: rgba(30, 58, 138, 0.35); }
.desk-option input:checked + label { border-color: var(--navy-deep); background: rgba(30, 58, 138, 0.05); box-shadow: 0 0 0 1px var(--navy-deep); }
.desk-option-name { font-weight: 600; color: var(--ink); }
.desk-option-hint { color: var(--muted); font-size: 0.88rem; }
.desk-option-tag {
  flex-basis: 100%;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0B6B5F;
}

.desk-warning {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 2px solid #B91C1C;
  background: #FEF2F2;
  color: #7F1D1D;
}
.desk-warning-title { font-family: 'DM Sans', sans-serif; font-size: 1.02rem; font-weight: 700; letter-spacing: 0; color: #7F1D1D; margin: 0 0 6px; }
.desk-warning p { color: #7F1D1D; font-size: 0.95rem; }
.desk-check-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; }
.desk-check-row input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: var(--navy-deep); }
.desk-check-row label { cursor: pointer; font-weight: 600; }
.desk-warning .desk-check-row label { color: #7F1D1D; }

/* ---------- Results ---------- */
.desk-table-wrap { overflow-x: auto; }
.desk-summary { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.desk-summary th, .desk-summary td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.desk-summary thead th { font-size: 0.82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.desk-summary td { font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.desk-summary td, .desk-summary thead th:not(:first-child) { padding-left: 14px; }
.desk-summary .desk-status { border-radius: 10px; }
.desk-summary + .desk-hint, .desk-table-wrap + .desk-hint { margin-top: 10px; }

.desk-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}
.desk-status--reported { background: #E6F7F4; color: #0B5E54; }
.desk-status--incomplete { background: #FEF3C7; color: #8A3B0B; }
.desk-status--not_found { background: #FDE8E8; color: #9B1C1C; }
.desk-status--not_verifiable_figure { background: #E0E7FF; color: #1E3A8A; }
.desk-status--not_applicable,
.desk-status--condition_not_met { background: #F1F5F9; color: #475569; }
.desk-status--not_evaluated { background: #fff; color: #334155; border: 1px dashed #94A3B8; }
.desk-level {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid rgba(30, 58, 138, 0.25);
}

.desk-check {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.desk-check-status { margin-top: 4px; color: var(--muted); font-size: 0.92rem; }
.desk-check-status.has-findings { color: #8A3B0B; font-weight: 600; }
.desk-findings { list-style: none; margin-top: 10px; display: grid; gap: 12px; }
.desk-finding { padding-top: 10px; border-top: 1px solid var(--line); }
.desk-finding-kind { font-weight: 600; color: var(--ink); font-size: 0.94rem; }
.desk-finding-message { color: var(--ink-soft); font-size: 0.94rem; margin-top: 2px; }

.desk-filter { margin: 4px 0 8px; }
.desk-filter label { font-weight: 500; }
.desk-section { margin-top: 22px; }
.desk-section-title {
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  color: var(--navy-deep);
}
.desk-items { list-style: none; }
.desk-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.desk-item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.desk-item-title { font-weight: 600; color: var(--ink); min-width: 0; }
.desk-item-id {
  display: inline-block;
  min-width: 2.2em;
  margin-right: 6px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.desk-item-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.desk-item-wording { margin-top: 6px; color: var(--ink-soft); font-size: 0.94rem; white-space: pre-line; }
.desk-item-help { margin-top: 6px; color: var(--muted); font-size: 0.9rem; }
.desk-item-missing { margin-top: 6px; color: #8A3B0B; font-size: 0.92rem; }
.desk-card .desk-item p + p { margin-top: 6px; }

.desk-evidence { list-style: none; margin-top: 8px; display: grid; gap: 8px; }
.desk-quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--teal); background: var(--cream); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.desk-quote blockquote p { font-size: 0.92rem; color: var(--ink); font-style: italic; }
.desk-quote figcaption { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }

.is-filtered .desk-item.is-clear,
.is-filtered .desk-section.is-all-clear { display: none; }
.desk-filter-empty { display: none; margin-top: 12px; }
.is-filtered .desk-filter-empty { display: block; }

.desk-attribution {
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}
.desk-view > p.desk-attribution { color: var(--muted); }

/* ---------- Session bar ---------- */
.desk-session {
  margin-top: 16px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}
.desk-session-text { font-size: 0.9rem; color: var(--muted); min-width: 0; flex: 1 1 220px; }
.desk-session-file { font-weight: 600; color: var(--ink); }
.desk-session .desk-alert { flex-basis: 100%; margin-top: 0; }
.desk-session .btn { white-space: normal; text-align: center; justify-content: center; }

/* ---------- Dialog ---------- */
.desk-dialog {
  width: min(440px, calc(100vw - 32px));
  margin: auto;
  padding: 24px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: var(--paper);
  color: var(--ink);
}
.desk-dialog::backdrop { background: rgba(8, 21, 48, 0.45); }
.desk-dialog h2 { font-size: 1.3rem; margin-bottom: 10px; }
.desk-dialog p { font-size: 0.95rem; }
.desk-dialog .btn { white-space: normal; }

/* ---------- Footer ---------- */
.desk-footer { padding: 0 16px 32px; text-align: center; background: transparent; color: var(--muted); }
.desk-footer p { font-size: 0.8rem; color: var(--muted); }

@media (max-width: 480px) {
  .desk-actions .btn, .desk-session .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .desk-progress span { animation: none; left: 0; width: 100%; opacity: 0.5; }
  .desk-drop, .desk-option label { transition: none; }
}
