/*
 * Graph-paper notebook, blue-black ink, one vermilion receipt stamp.
 * System fonts only; no downloads.
 */

:root {
  --paper: #f6f8fb;
  --grid: #e4ebf3;
  --surface: #ffffff;
  --ink: #18263b;
  --ink-soft: #536379;
  --line: #b4c2d3;
  /* Outline of form controls: at least 3:1 against the surface and the paper. */
  --field-line: #76869c;
  --stamp: #c9352b;
  --focus: #1f6feb;
  --ok: #17694a;

  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Noto Sans JP",
    "Noto Sans CJK JP", Meiryo, system-ui, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Noto Serif CJK JP", serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1826;
    --grid: #172236;
    --surface: #162135;
    --ink: #e7edf5;
    --ink-soft: #a3b3c9;
    --line: #3a4c68;
    --field-line: #7186a8;
    --stamp: #ff7a6b;
    --focus: #8bbcff;
    --ok: #6fd3a6;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: anywhere;
}

main,
.site-header,
.site-footer {
  max-width: 40rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.02em;
  text-wrap: balance;
  word-break: auto-phrase;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 1.2rem + 3vw, 2.5rem);
}

h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

p {
  margin: 0 0 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 1rem;
}

.site-name {
  font-family: var(--serif);
  font-weight: 700;
  text-decoration: none;
}

.logout {
  margin: 0;
}

.button-link {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.button-link:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

/* Hero -------------------------------------------------------------------- */

.hero {
  padding-block: 1.5rem 2.5rem;
}

.intro {
  max-width: 34em;
}

.tally {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.75rem;
}

.tally-text {
  margin: 0;
  font-weight: 700;
}

.stamp {
  flex: none;
  display: grid;
  place-content: center;
  justify-items: center;
  width: 6.5rem;
  height: 6.5rem;
  border: 3px solid var(--stamp);
  border-radius: 50%;
  outline: 1px solid var(--stamp);
  outline-offset: -8px;
  color: var(--stamp);
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.1;
  opacity: 0.92;
  transform: rotate(-9deg);
}

.stamp-top,
.stamp-bottom {
  font-size: 0.8125rem;
  letter-spacing: 0.15em;
  /* Balance the trailing letter-space so the word stays centred. */
  margin-right: -0.15em;
}

.stamp-value {
  font-size: 2rem;
  font-variant-numeric: lining-nums;
}

.stamp-word .stamp-value {
  font-size: 1.375rem;
  letter-spacing: 0.1em;
  margin-right: -0.1em;
}

@media (prefers-reduced-motion: no-preference) {
  .stamp {
    animation: stamp-press 0.22s 0.15s cubic-bezier(0.2, 0.9, 0.3, 1) backwards;
  }

  @keyframes stamp-press {
    from {
      opacity: 0;
      transform: rotate(-9deg) scale(1.4);
    }
  }
}

/* Rules ------------------------------------------------------------------- */

.rules {
  padding: 1.5rem 1.25rem;
  border: 2px solid var(--ink);
  background: var(--surface);
}

.scope {
  margin: 0 0 1.25rem;
}

.scope-item {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: 0.5rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--line);
}

.scope-item:last-child {
  border-bottom: 1px solid var(--line);
}

.scope dt {
  display: contents;
  font-weight: 700;
}

.scope-sign {
  grid-row: span 2;
  align-self: start;
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.2;
  text-align: center;
}

.scope-no .scope-sign {
  color: var(--stamp);
}

.scope dd {
  grid-column: 2;
  margin: 0;
}

.notes {
  margin: 0;
  padding-left: 1.25rem;
}

.notes li + li {
  margin-top: 0.5rem;
}

.notes li::marker {
  color: var(--ink-soft);
}

/* Form -------------------------------------------------------------------- */

.form-section {
  padding-block: 3rem 2rem;
  scroll-margin-top: 1rem;
}

.field {
  min-width: 0;
  margin: 0 0 2rem;
  padding: 0;
  border: 0;
}

.field > label,
.field > legend {
  display: block;
  padding: 0;
  font-weight: 700;
}

.sub-label {
  display: block;
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.mark {
  display: inline-block;
  margin-left: 0.625rem;
  padding: 0 0.4em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: 0.1em;
}

.mark-required {
  color: var(--stamp);
}

.mark-optional {
  color: var(--ink-soft);
}

.hint {
  margin: 0.125rem 0 0.5rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.65;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--field-line);
  border-radius: 4px;
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
}

textarea {
  resize: vertical;
}

input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--stamp);
  border-width: 2px;
}

.counter {
  margin: 0.375rem 0 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.counter[data-state="good"] {
  color: var(--ok);
  font-weight: 700;
}

.feature-list {
  margin: 0;
  padding-left: 1.75rem;
}

.feature-list li {
  padding-left: 0.25rem;
}

.feature-list li + li {
  margin-top: 0.5rem;
}

.feature-list li::marker {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 3rem;
  padding: 0.5rem 1.25rem 0.5rem 0.875rem;
  border: 1.5px solid var(--field-line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
}

.choice:has(:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.choice input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--ink);
}

.field-error {
  margin: 0.5rem 0 0;
  color: var(--stamp);
  font-weight: 700;
}

.verification .cf-turnstile {
  min-height: 65px;
}

.notice {
  margin: 0 0 1.5rem;
  padding: 0.875rem 1rem;
  border-left: 4px solid var(--stamp);
  background: var(--surface);
}

.notice p {
  margin: 0;
  font-weight: 700;
}

.notice ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.notice-ok {
  border-left-color: var(--ok);
  font-weight: 700;
}

.privacy {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.submit,
.button-secondary {
  min-height: 3.25rem;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.submit {
  width: 100%;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.0625rem;
  letter-spacing: 0.05em;
}

.submit:hover {
  opacity: 0.88;
}

.submit:active,
.button-secondary:active {
  transform: translateY(1px);
}

.button-secondary {
  background: var(--surface);
  color: var(--ink);
}

.button-anchor {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Portal ------------------------------------------------------------------ */

.portal-status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-block: 1rem 2rem;
  padding: 1.25rem;
  border: 2px solid var(--ink);
  background: var(--surface);
}

.portal-status .stamp {
  width: 5.5rem;
  height: 5.5rem;
}

.portal-status[data-status="in_progress"] .stamp,
.portal-status[data-status="done"] .stamp {
  transform: rotate(6deg);
}

.portal-status-text {
  margin: 0;
  font-weight: 700;
}

.readonly {
  margin: 0 0 2rem;
}

.readonly dt {
  margin-top: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 700;
}

.readonly dd {
  margin: 0.125rem 0 0;
}

.readonly ol {
  margin: 0;
  padding-left: 1.5rem;
}

.readonly.identity {
  margin-bottom: 0.75rem;
  padding: 0 1.25rem 1.25rem;
  border-left: 3px solid var(--line);
}

.readonly.identity dt:first-child {
  margin-top: 0;
}

.pre {
  white-space: pre-wrap;
}

.muted {
  color: var(--ink-soft);
}

.last-saved {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.attachments,
.delivery {
  margin-block: 3rem 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
}

.delivery {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 2px solid var(--ok);
  background: var(--surface);
}

.count-tag {
  margin-left: 0.75rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.file-list {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.file-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px solid var(--line);
}

.file-name {
  flex: 1 1 12rem;
  font-weight: 700;
}

.file-size {
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.upload-form {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
}

.upload-form input[type="file"] {
  padding-block: 0.5rem;
}

/* Plain pages (thanks, errors) and footer --------------------------------- */

.plain {
  padding-block: 2.5rem 3rem;
}

.plain .stamp {
  margin-bottom: 1.75rem;
}

/* "Show the password", under a password field. Revealed by form.js. */
.show-password {
  margin: 0.625rem 0 0;
}

.show-password input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0 0.5rem 0 0;
  vertical-align: middle;
  accent-color: var(--ink);
}

.show-password label {
  display: inline;
  margin: 0;
  font-weight: 400;
  vertical-align: middle;
}

/* "Forgot the edit password", below the password form. */
.password-reset {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.password-reset h2 {
  font-size: 1.125rem;
}

.site-footer {
  padding-block: 1.5rem 3rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

.site-footer p + p {
  margin-top: 0.5rem;
}
