/*
 * The one stylesheet of the upload page and the error pages (spec/user_interface/markup-and-style.md:
 * Design Tokens, Layout, Interaction Style). It loads nothing: no image, no other sheet, no font.
 * An element the hidden attribute toggles gets no display of its own, so hidden keeps it boxless.
 * The rules of one part of the page follow each other without a blank line; a blank line ends a part.
 */

:root {
  --color-brand: rgb(0 170 220);
  --color-brand-strong: rgb(0 119 163);
  --color-brand-tint: rgb(230 246 251);
  --color-accent: rgb(240 130 50);
  --color-navy: rgb(34 35 75);
  --color-text: rgb(51 51 51);
  --color-muted: rgb(102 102 102);
  --color-surface: rgb(240 245 245);
  --color-border: rgb(220 220 220);
  --color-danger: rgb(198 40 40);
  --color-success: rgb(46 125 50);
  --radius-pill: 9999px;
  --radius-card: 12px;
  --shadow-card: 0 0 2rem rgb(0 0 0 / 7%);
  --font:
    "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic",
    Meiryo, system-ui, sans-serif;
  --column: 47.5rem;
  --white: rgb(255 255 255);
}

/* Base: header, main and footer are the body's rows, main taking the free height. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background-color: var(--color-surface);
  font-family: var(--font);
  line-height: 1.6;
  overflow-wrap: break-word;
}
a {
  color: var(--color-brand-strong);
  text-decoration: underline;
}
button:enabled {
  cursor: pointer;
}
:focus-visible {
  outline: 3px solid var(--color-brand-strong);
  outline-offset: 2px;
  scroll-margin: 0.5rem;
}
main > p,
.card,
.message {
  margin: 0 0 1rem;
  padding: 1.5rem;
  border-radius: var(--radius-card);
  background-color: var(--white);
  box-shadow: var(--shadow-card);
}

/* Header, column and footer; the footer's rule spans its text's box, as wide as the cards. */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem max(1rem, calc((100% - var(--column)) / 2 + 1rem));
  border-bottom: 3px solid var(--color-brand);
  background-color: var(--white);
}
header img {
  width: clamp(6.5rem, 40vw, 9.0625rem);
  height: auto;
}
main,
footer {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
footer,
.limits {
  color: var(--color-muted);
  font-size: 0.875rem;
}
footer {
  padding-top: 0;
  text-align: center;
}
footer p {
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}
footer p,
.staging-banner p,
.limits,
.caption {
  margin: 0;
}

/* Controls shared by several parts. */
.language,
.checking,
.progress,
.consent,
.notices-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.language button,
.pill,
.row-button {
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--color-brand-strong);
  border-radius: var(--radius-pill);
  color: var(--color-brand-strong);
  background-color: var(--white);
  font: inherit;
  font-weight: bold;
  white-space: nowrap;
}
.language button[aria-pressed="true"],
.pill {
  color: var(--white);
  background-color: var(--color-brand-strong);
}
.pill {
  justify-self: center;
  padding: 0.5rem 1.5rem;
}
.pill:disabled {
  border-color: var(--color-muted);
  color: var(--color-muted);
  background-color: var(--white);
}
.caption,
.drop-zone,
.notices-toggle {
  padding: 0.25rem 0;
  border: 0;
  color: var(--color-navy);
  background-color: transparent;
  font: inherit;
  font-weight: bold;
}

/* Staging banner, title band, messages and tones; a message's accent takes its tone's colour. */
.staging-banner,
.title-band {
  margin: 0 0 1.5rem;
  color: var(--color-navy);
}
.staging-banner {
  padding: 0.75rem 1rem;
  background-color: var(--color-accent);
  font-weight: bold;
}
.title-band > * {
  margin: 0 0 0.25rem;
}
.title-band h1 {
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2rem);
}
.message {
  padding: 0.75rem 1rem;
  border-left: 0.25rem solid;
  color: var(--color-navy);
}
.message.waiting {
  border-left-color: var(--color-accent);
}
.success {
  color: var(--color-success);
}
.danger,
.error {
  color: var(--color-danger);
}
.announcement {
  position: fixed;
  clip-path: inset(50%);
}

/* The Checking indicator's spinner. */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-brand-strong);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* The card draws the drop area around the drop zone, Select and Limits; drag-over fills both. */
.drop-card {
  display: grid;
  gap: 0.75rem;
  border: 2px dashed var(--color-brand-strong);
  text-align: center;
}
.drop-card:has(.drag-over),
.drop-zone.drag-over {
  border-style: solid;
  background-color: var(--color-brand-tint);
}
.drop-zone::before {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.5rem;
  background-color: var(--color-brand);
  clip-path: polygon(50% 0, 100% 50%, 68% 50%, 68% 100%, 32% 100%, 32% 50%, 0 50%);
  content: "";
}

/* Rows: name, size and button on the first line at the name's first baseline; the bar or status below. */
.file-list {
  list-style: none;
}
.file-list > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
}
.file-list > li + li {
  border-top: 1px solid var(--color-border);
}
.row-name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.row-size,
.status {
  white-space: nowrap;
}
.row-button {
  grid-area: 1 / 3;
  min-width: 2.5rem;
  min-height: 2.5rem;
}
.status,
.progress {
  grid-column: 1 / -1;
  text-align: right;
}
.bar {
  flex: 1;
  height: 0.5rem;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background-color: var(--color-border);
}
.fill {
  height: 100%;
  background-color: var(--color-brand-strong);
}

/* Notices, Consent and Upload; the triangle is drawn, and the Notices text indented past it. */
.form {
  display: grid;
  gap: 1rem;
}
.notices-toggle::before {
  border-width: 0.35em 0 0.35em 0.55em;
  border-style: solid;
  border-color: transparent transparent transparent currentcolor;
  content: "";
}
.notices-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}
.notices-text {
  margin: 0.25rem 0 0;
  padding-left: calc(0.55em + 0.5rem);
}
.consent {
  gap: 0.75rem;
  align-items: flex-start;
}
.consent input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.175rem 0 0;
}
