/* ------------------------------------------------------------------
   Pay check

   The hero photo lives in app/static/background.jpg (a smaller copy,
   background-small.jpg, is served to phones). Swap either file and the
   layout is unchanged - but bump the ?v= on both url()s below, or
   browsers keep showing the old photo.
   ------------------------------------------------------------------ */

:root {
  --ink:        #14232e;   /* deep petrol blue, the main text colour   */
  --ink-muted:  #5c6b75;
  --paper:      #f6f5f1;
  --rule:       #dcd8ce;
  --short:      #9c3320;   /* underpaid                                */
  --square:     #2e6a4f;   /* matches                                  */
  --surface:    #0f1a22;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --column: 44rem;
  --gutter: 1rem;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 0 2rem;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
}

/* Hero: the aeroplane, with the masthead sitting in the scrim --------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(210px, 40vh, 380px);
  padding: 3rem var(--gutter) 1.75rem;
  background-color: #8ea6bb;
  background-image:
    linear-gradient(180deg,
      rgba(15, 26, 34, 0.30) 0%,
      rgba(15, 26, 34, 0.12) 38%,
      rgba(15, 26, 34, 0.78) 88%,
      var(--surface) 100%),
    url("/static/background.jpg?v=2");
  background-size: cover;
  background-position: center 42%;
  background-repeat: no-repeat;
}

.masthead {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.masthead-text { min-width: 0; }

.masthead-logo {
  flex: 0 0 auto;
  width: auto;
  height: clamp(20px, 3.4vw, 28px);
  margin-bottom: 0.3rem;
  opacity: 0.92;
  filter: drop-shadow(0 1px 8px rgba(10, 20, 28, 0.55));
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #f4f6f7;
  text-shadow: 0 1px 12px rgba(10, 20, 28, 0.55);
}

.masthead-sub {
  margin: 0.35rem 0 0;
  max-width: 34rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #d3dce1;
  text-shadow: 0 1px 10px rgba(10, 20, 28, 0.6);
}

.sheet {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
}

/* Credit -------------------------------------------------------------- */

.credit {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 0;
}

.credit p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: #8098a6;
  max-width: 34rem;
}

.credit-name {
  font-weight: 500;
  color: #b3c4cd;
  margin-bottom: 0.3rem !important;
}

/* The paper ---------------------------------------------------------- */

.panel {
  background: var(--paper);
  border-radius: 3px;
  padding: clamp(1.35rem, 4vw, 2.5rem);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: lift 420ms cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes lift {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* Verdict: the one place this page raises its voice ------------------ */

.verdict {
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
}

.verdict-line {
  margin: 0;
  font-size: clamp(1.3rem, 4.6vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.verdict-sub {
  margin: 0.45rem 0 0;
  max-width: 34rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.is-short  { color: var(--short); }
.is-square { color: var(--square); }

/* Checks ------------------------------------------------------------- */

.checks {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.check {
  padding: 0.9rem 0 0.9rem 1.5rem;
  border-top: 1px solid var(--rule);
  position: relative;
}

.check:last-child { border-bottom: 1px solid var(--rule); }

.check--flag {
  background: linear-gradient(90deg, rgba(156, 51, 32, 0.06), transparent 65%);
  box-shadow: inset 2px 0 0 var(--short);
}

.check-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.check-mark {
  position: absolute;
  left: 0.35rem;
  font-size: 0.8rem;
  color: var(--square);
  line-height: 1.6;
}

.check--flag .check-mark { color: var(--short); font-size: 0.55rem; }
.check--info .check-mark { color: var(--ink-muted); }

.check-name {
  flex: 1;
  font-weight: 500;
  font-size: 1rem;
}

.check-diff {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.check-figures {
  margin: 0.3rem 0 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.check-detail {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 38rem;
}

.check-notes {
  margin: 0.6rem 0 0;
  padding: 0 0 0 1rem;
  list-style: none;
  border-left: 1px solid var(--rule);
  display: grid;
  gap: 0.4rem;
}

.check-notes li {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
  max-width: 36rem;
}

/* Forms -------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: 1.4rem;
}

.field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.field-hint {
  display: block;
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-bottom: 0.55rem;
}

.field input[type="password"],
.field input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.7rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.field input[type="file"] { padding: 0.5rem; }

.button {
  display: inline-block;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.65rem 1.4rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.button:hover { background: #24394a; }

.button:disabled,
.button.is-working {
  cursor: progress;
  background: #4a5f6d;
  border-color: #4a5f6d;
}

.button.is-working { animation: working 1.4s ease-in-out infinite; }

@keyframes working {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.62; }
}

.button--quiet {
  background: transparent;
  color: var(--ink);
}

.button--quiet:hover { background: rgba(20, 35, 46, 0.07); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.alert {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--short);
  background: rgba(156, 51, 32, 0.08);
  border-left: 2px solid var(--short);
}

.fineprint {
  margin: 1.5rem 0 0;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 34rem;
}

:where(a, button, input):focus-visible {
  outline: 2px solid #3d7ea6;
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Narrow screens ------------------------------------------------------ */

@media (max-width: 30rem) {
  .check-head { flex-wrap: wrap; }
  .check-diff { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .button.is-working { animation: none; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* Periods, dates, the full report, extra form controls ---------------- */

.period + .period { margin-top: 2rem; }

.period-label {
  margin: 1.75rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.check-dates {
  margin: 0.45rem 0 0;
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.fullreport pre {
  margin: 1rem 0 1.25rem;
  padding: 0.9rem;
  max-height: 26rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

.field-row .field { flex: 1 1 12rem; }
.field-row .field--narrow { flex: 0 0 6rem; }

.field select {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.7rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 2px;
}


/* The how-to panel under the form ------------------------------------- */

.panel--guide {
  margin-top: 1.25rem;
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
  background: rgba(246, 245, 241, 0.94);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.guide-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* Section headings: a rule above sets each block apart from the last. */
.guide-sub {
  margin: 1.9rem 0 0.7rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.guide-title + .guide-sub {
  margin-top: 1.4rem;
}

.guide-steps {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 0.55rem;
}

.guide-steps li {
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 36rem;
  padding-left: 0.2rem;
}

.guide-steps b { font-weight: 600; }

.guide-notes { list-style: none; padding-left: 0; }

.guide-notes li {
  position: relative;
  padding-left: 1.1rem;
}

.guide-notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  background: var(--ink-muted);
}

.guide-note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 36rem;
}

/* Collapsibles: made to look like something you press --------------------- */

.guide-details,
.fullreport {
  margin: 1.9rem 0 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
}

.fullreport { margin-top: 1.75rem; padding-top: 0; }

.guide-details > summary,
.fullreport > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(20, 35, 46, 0.045);
  transition: background-color 140ms ease;
}

.guide-details > summary::-webkit-details-marker,
.fullreport > summary::-webkit-details-marker { display: none; }

.guide-details > summary:hover,
.fullreport > summary:hover { background: rgba(20, 35, 46, 0.09); }

/* The chevron, drawn rather than typed so it stays crisp. */
.guide-details > summary::after,
.fullreport > summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 160ms ease;
}

.guide-details[open] > summary::after,
.fullreport[open] > summary::after {
  transform: rotate(-135deg) translate(-3px, -3px);
}

.guide-details[open] > summary,
.fullreport[open] > summary {
  border-bottom: 1px solid var(--rule);
}

/* Everything after the summary is the opened body. */
.guide-details > *:not(summary),
.fullreport > *:not(summary) {
  margin-left: 1rem;
  margin-right: 1rem;
}

.guide-details > *:not(summary):first-of-type { margin-top: 1rem; }
.guide-details > *:last-child { margin-bottom: 1.25rem; }

/* Inside a collapsible the rules would fight the border, so drop them. */
.guide-details .guide-sub {
  border-top: none;
  padding-top: 0;
  margin-top: 1.5rem;
}

.guide-details .guide-sub:first-of-type { margin-top: 1rem; }

.guide-note--last {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

@media (max-width: 34rem) {
  .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }
  .masthead-logo { margin-bottom: 0; order: -1; }
}

@media (max-width: 40rem) {
  .hero {
    background-image:
      linear-gradient(180deg,
        rgba(15, 26, 34, 0.30) 0%,
        rgba(15, 26, 34, 0.12) 38%,
        rgba(15, 26, 34, 0.78) 88%,
        var(--surface) 100%),
      url("/static/background-small.jpg?v=2");
  }
}


/* .guide-details and .guide-sub--tight are styled above. */

/* What's changed page ------------------------------------------------- */

.changelog h3 {
  margin-top: 2rem;
  margin-bottom: 0;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
}

.changelog h4 {
  margin-top: 1.1rem;
  margin-bottom: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  font-weight: 500;
}

.changelog h5 {
  margin-top: 0.7rem;
  margin-bottom: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.changelog ul { margin-top: 0.3rem; margin-bottom: 0; padding-left: 1.2rem; }
.changelog li { margin: 0.2rem 0; font-size: 0.92rem; line-height: 1.5; }
.changelog hr { margin: 2rem 0 0; border: none; border-top: 1px solid var(--rule); }

.credit-links { margin-top: 0.3rem !important; }
.credit-links a { color: #b3c4cd; }

/* Printing: give them a clean PDF, not a screenshot of the page ------- */

@media print {
  :root { --paper: #fff; }

  body { background: #fff; padding: 0; }

  .hero {
    min-height: 0;
    padding: 0 0 0.75rem;
    background: none;
    border-bottom: 2px solid var(--ink);
  }

  .masthead h1,
  .masthead-sub { color: var(--ink); text-shadow: none; }

  .masthead-logo { display: none; }

  .sheet, .credit { max-width: none; padding: 0; }

  .panel {
    padding: 1rem 0 0;
    box-shadow: none;
    animation: none;
    background: #fff;
  }

  .actions, .panel--guide { display: none; }

  .credit p { color: var(--ink-muted); }

  .fullreport { border: none; }
  .fullreport > summary { display: none; }
  .fullreport > *:not(summary) { margin-left: 0; margin-right: 0; }

  .fullreport pre {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
    border: 1px solid var(--rule);
    font-size: 0.65rem;
  }

  .check { break-inside: avoid; }

  .check--flag {
    background: none;
    box-shadow: inset 2px 0 0 var(--short);
  }

  a[href]::after { content: ""; }
}
