/* unktok reviewer — "the referee's desk"
   A paper review service styled after the physical artifacts of manuscript
   review: index cards, red-pen correction, the navy ink of an approval
   stamp, ochre for a paper aging on someone's desk. Light-only: paper is
   light, ink is dark — this is a deliberate choice, not an oversight. */

:root {
  color-scheme: light;
  --paper: #eae7dd;
  --paper-raised: #f7f5ee;
  --paper-line: repeating-radial-gradient(
    circle at 1px 1px, rgba(32, 36, 31, 0.05) 0, rgba(32, 36, 31, 0.05) 1px,
    transparent 1px, transparent 100%
  );
  --ink: #20241f;
  --ink-soft: #5c6156;
  --ink-faint: #8b8f83;
  --rule: rgba(32, 36, 31, 0.18);
  --rule-strong: rgba(32, 36, 31, 0.38);
  --blue: #1e3a5f;
  --blue-soft: rgba(30, 58, 95, 0.09);
  --red: #a83226;
  --red-soft: rgba(168, 50, 38, 0.09);
  --ochre: #93691f;
  --ochre-soft: rgba(147, 105, 31, 0.12);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 3px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--paper-line);
  background-size: 3px 3px;
  margin: 0;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--ochre-soft); color: var(--ink); }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red); }

/* ---------- header / footer ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--rule-strong);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand .seal {
  width: 22px;
  height: 22px;
  border: 1.4px solid var(--ink);
  border-radius: 50%;
  position: relative;
  flex: none;
}
.brand .seal::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}

nav { display: flex; align-items: center; gap: 1.4rem; }
nav a, nav .link-button {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
nav a:hover, nav .link-button:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.link-button { background: none; border: none; cursor: pointer; font: inherit; padding: 0 0 2px; }

.site-footer {
  margin-top: auto;
  padding: 1.4rem 2rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ---------- layout ---------- */

main {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}
.narrow { max-width: 34rem; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 560; color: var(--ink); line-height: 1.12; }
h1 { font-size: 2rem; margin: 0 0 0.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; margin: 2.4rem 0 0.7rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 1rem;
}

.hint, .note { color: var(--ink-soft); font-size: 0.92rem; }
.error { color: var(--red); font-size: 0.92rem; font-family: var(--font-mono); }
.mono { font-family: var(--font-mono); font-size: 0.88em; }

/* ---------- hero + specimen ---------- */

.hero { padding: 1.5rem 0 2rem; max-width: 40rem; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 2.9rem); }
.hero h1 em { font-style: italic; color: var(--blue); }
.hero .lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 34rem; margin: 0 0 1.6rem; }
.hero .lede strong { color: var(--ink); font-weight: 600; }
.hero-actions { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; margin-bottom: 3rem; }
.hero-aside { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint); }

.specimen {
  --tilt: -1.6deg;
  position: relative;
  max-width: 30rem;
  margin: 0 0 3rem;
  padding: 1.6rem 1.7rem 1.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
  transform: rotate(var(--tilt));
  box-shadow: 5px 6px 0 rgba(32, 36, 31, 0.08);
}
.specimen .specimen-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.7rem;
}
.specimen .specimen-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0 0 0.9rem;
}
.specimen mark {
  background: linear-gradient(to bottom, transparent 60%, var(--ochre-soft) 60%);
  color: inherit;
}
.specimen mark.mark-red { background: linear-gradient(to bottom, transparent 60%, var(--red-soft) 60%); }
.specimen ul.ticks {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: grid;
  gap: 0.35rem;
}
.specimen ul.ticks li::before { content: "\2713  "; color: var(--blue); }
.specimen ul.ticks li.flag::before { content: "\25b3  "; color: var(--ochre); }

/* ---------- stamp (the signature element) ---------- */

.stamp {
  --stamp-color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stamp-color);
  padding: 0.32rem 0.85rem;
  border: 1.6px solid var(--stamp-color);
  border-radius: 999px;
  box-shadow: 0 0 0 2.5px var(--paper-raised), 0 0 0 3.5px var(--stamp-color);
  transform: rotate(-2deg);
  background: color-mix(in srgb, var(--stamp-color) 6%, transparent);
}
.stamp.stamp-lg { font-size: 0.92rem; padding: 0.5rem 1.2rem; transform: rotate(-4deg); }
.stamp::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* status → stamp ink color mapping (class convention preserved) */
.status-badge { --stamp-color: var(--ink-soft); }
.status-succeeded { --stamp-color: var(--blue); }
.status-failed, .status-rejected, .status-expired, .status-canceled { --stamp-color: var(--red); }
.status-running, .status-finalizing { --stamp-color: var(--ochre); }
.status-running::before, .status-finalizing::before { animation: pulse 1.6s ease-in-out infinite; }
.status-queued, .status-waiting_quota, .status-awaiting_consent { --stamp-color: var(--ink-soft); }

/* ---------- mode cards (specimen index cards) ---------- */

.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem 1.4rem; margin: 1.3rem 0; }
.mode-card {
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem 1.1rem;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}
.mode-grid .mode-card:nth-child(odd) { transform: rotate(-0.6deg); }
.mode-grid .mode-card:nth-child(even) { transform: rotate(0.6deg); }
.mode-card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.mode-card p { margin: 0 0 0.9rem; color: var(--ink-soft); font-size: 0.9rem; }
.mode-card .turnaround { font-family: var(--font-mono); font-size: 0.76rem; color: var(--blue); }
.mode-card .turnaround::before { content: "\25f7 "; }

/* ---------- buttons ---------- */

.cta, button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1.4px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.6rem 1.3rem;
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper-raised);
  text-decoration: none;
  display: inline-block;
  width: fit-content;
  transition: transform 90ms ease, box-shadow 90ms ease;
  box-shadow: 3px 3px 0 rgba(32, 36, 31, 0.18);
}
.cta:hover, button:hover:not(:disabled) {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 rgba(32, 36, 31, 0.18);
  color: var(--paper-raised);
}
button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.button-secondary, button.button-secondary {
  background: var(--paper-raised);
  color: var(--ink);
  border-color: var(--ink);
}
.button-danger, button.button-danger {
  background: var(--paper-raised);
  color: var(--red);
  border-color: var(--red);
  box-shadow: 3px 3px 0 var(--red-soft);
}

/* ---------- forms ---------- */

form { display: flex; flex-direction: column; gap: 0.3rem; margin: 1.2rem 0; }
label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.9rem;
}
input, select {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1.4px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
}
input::placeholder { color: var(--ink-faint); }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
form button[type="submit"] { margin-top: 1.1rem; }

label.checkbox {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--blue); width: 1.05rem; height: 1.05rem; }

/* ---------- panels / the review slip ---------- */

.panel, #status-fragment {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
  margin: 1.5rem 0;
}
.panel::before, #status-fragment::before {
  content: "";
  position: absolute;
  top: -1px; left: 1.6rem; right: 1.6rem;
  height: 1px;
  background-image: repeating-radial-gradient(circle at 6px 0, var(--paper) 0, var(--paper) 3px, transparent 3px, transparent 12px);
  background-size: 12px 4px;
}
.panel h2 { margin-top: 0; font-size: 1.15rem; }
#status-fragment > :first-child { margin-top: 0; }
#status-fragment > :last-child { margin-bottom: 0; }

/* ---------- tables ---------- */

.table-wrap { border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow-x: auto; margin: 1.2rem 0; }
table { width: 100%; border-collapse: collapse; background: var(--paper-raised); }
th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--rule-strong);
}
td { text-align: left; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--rule); font-size: 0.92rem; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
td.paper-cell {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  max-width: 18rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- progress: the ledger ruler ---------- */

progress {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border: 1px solid var(--ink);
  border-radius: 1px;
  background: var(--paper);
  overflow: hidden;
  margin: 0.5rem 0 0.2rem;
}
progress::-webkit-progress-bar { background: var(--paper); }
progress::-webkit-progress-value {
  background-color: var(--blue);
  background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,0.35) 6px 7px);
}
progress::-moz-progress-bar {
  background-color: var(--blue);
  background-image: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,0.35) 6px 7px);
}

.progress-meta { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft); margin: 0.6rem 0 0.2rem; }
.progress-meta strong { color: var(--ink); font-weight: 600; }

.artifact-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
.artifact-links a:not(.cta) { font-size: 0.9rem; }

/* ---------- token list ---------- */

ul.token-list { list-style: none; padding: 0; margin: 0.8rem 0; }
ul.token-list li {
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  flex-wrap: wrap;
}
ul.token-list .token-meta { font-family: var(--font-mono); color: var(--ink-faint); font-size: 0.78rem; }
ul.token-list .revoked { color: var(--red); font-weight: 600; font-size: 0.78rem; font-family: var(--font-mono); }

#new-token-display:not(:empty) {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  border: 1.4px solid var(--blue);
  background: var(--blue-soft);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  word-break: break-all;
}

#magic-link-status:not(:empty), #submit-status:not(:empty) {
  font-size: 0.92rem;
  color: var(--ink);
  border-left: 2px solid var(--blue);
  padding-left: 0.8rem;
}

/* ---------- motion: a single orchestrated moment ---------- */

.hero, .specimen { animation: rise 500ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.specimen { animation-delay: 90ms; }

.status-succeeded .stamp, #status-fragment .status-succeeded {
  animation: stamp-down 340ms cubic-bezier(0.34, 1.4, 0.4, 1) both;
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes stamp-down {
  0% { opacity: 0; transform: scale(1.5) rotate(-14deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: scale(1) rotate(-2deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  .site-header { padding: 0.9rem 1.1rem; }
  main { padding: 2rem 1.1rem 3.5rem; }
  .specimen { max-width: 100%; }
}
