:root {
  /* light is the default; [data-theme="dark"] below overrides.
       flat colors throughout, no gradients — still the same Rams
       instinct for honest materials over decoration, just now
       available in both directions instead of one committed theme. */
  --bg: #fefffa;
  --panel-bg: #ffffff;
  --panel-raised: #f3f0fa;
  --ink: #1a1a1a;
  --ink-soft: #55506b;
  --ink-faint: #8a84a3;
  --border: #ddd4f0;
  --grid-dot: rgba(91, 63, 191, 0.06);

  /* deep, saturated versions of yafira's five design-system hues —
       dark enough for white text to sit on top with real contrast.
       dark mode below uses the lighter pastel versions of the same
       families instead, with dark text on top. */
  --craft: #b5305a;
  --code: #1f7a3f;
  --design: #8b3fa8;
  --electronics: #5b3fbf;
  --text-accent: #1f6fa8;
  --amber: #b8720a;
  --on-accent: #ffffff;

  --missing: var(--craft);
  --weak: var(--amber);
  --pass: var(--code);
  --accent: var(--electronics);

  --font-display: "Space Grotesk", ui-sans-serif, sans-serif;
  --font-mono: "Fira Code", ui-monospace, monospace;
  --font-pixel: "Pixelify Sans", sans-serif;
}

[data-theme="dark"] {
  --bg: #16151c;
  --panel-bg: #1e1c28;
  --panel-raised: #252231;
  --ink: #f0eef5;
  --ink-soft: #c9c5d6;
  --ink-faint: #8b84a3;
  --border: #3a3350;
  --grid-dot: rgba(185, 168, 232, 0.05);

  --craft: #e8a8c8;
  --code: #8ee0a8;
  --design: #d8a8ec;
  --electronics: #b9a8e8;
  --text-accent: #a8d4f0;
  --amber: #e8b86a;
  --on-accent: #16151c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(var(--grid-dot) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.55;
  padding-bottom: 100px;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

header {
  background: var(--panel-raised);
  color: var(--ink);
  padding: 40px 0 32px;
  margin-bottom: 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.nameplate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--electronics);
  border-radius: 6px;
  padding: 6px 14px;
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--electronics);
}

.theme-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--panel-bg);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--electronics);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.theme-icon-moon {
  fill: currentColor;
}
/* icon shows the destination — what clicking switches TO — not the
     current state. light mode shows the moon (click for dark),
     dark mode shows the sun (click for light). */
.theme-icon-sun {
  display: none;
}
[data-theme="dark"] .theme-icon-sun {
  display: block;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.hero-kicker a {
  color: var(--ink-faint);
}

h1 {
  font-family: var(--font-pixel);
  font-size: clamp(2rem, 3vw + 1rem, 2.9rem);
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.lede {
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 58ch;
  margin: 0;
}

/* thick perforated rule — a bold, literal reference to punch-card
     perforation, marking the seam between panels like a hinge. */
.perf-rule {
  height: 14px;
  background-color: var(--bg);
  background-image: radial-gradient(
    circle,
    var(--electronics) 3.5px,
    transparent 3.6px
  );
  background-size: 22px 14px;
  background-position: 0 center;
  background-repeat: repeat-x;
}

.honesty-note {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-left: 6px solid var(--electronics);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.honesty-note strong {
  color: var(--ink);
  font-family: var(--font-mono);
}

section {
  margin-bottom: 40px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
}
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

button {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  border-radius: 6px;
  padding: 11px 22px;
  border: 2px solid var(--border);
  background: var(--panel-bg);
  color: var(--ink);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}
button:hover {
  border-color: var(--ink-faint);
}
button:active {
  transform: scale(0.97);
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover {
  background: var(--text-accent);
  border-color: var(--text-accent);
}

button.copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 14px;
  border-width: 1.5px;
}
button.copy.copied {
  background: var(--pass);
  border-color: var(--pass);
  color: var(--on-accent);
}

#summary {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin: 24px 0 0;
  padding: 14px 16px;
  background: var(--panel-bg);
  border-radius: 6px;
}
#summary .n-flagged {
  color: var(--missing);
}
#summary .n-pass {
  color: var(--pass);
}

/* each finding is a labeled module: a solid color tab on the left
     carries the index number, the body stays on the neutral panel
     color so text keeps full contrast rather than sitting on a tint. */
.finding {
  display: flex;
  border-radius: 6px;
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--panel-bg);
}
.finding-tab {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--on-accent);
  background: var(--missing);
}
.finding.weak-status .finding-tab {
  background: var(--weak);
}
.finding.pass .finding-tab {
  background: var(--pass);
}

.finding-body {
  flex: 1;
  min-width: 0;
  padding: 18px;
}

.finding-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.thumb {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.3rem;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.finding-meta {
  flex: 1;
  min-width: 0;
}

.finding-src {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  word-break: break-all;
  color: var(--ink);
}

.reason-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 4px;
  margin-top: 8px;
  color: var(--on-accent);
}
.reason-tag.missing {
  background: var(--missing);
}
.reason-tag.weak {
  background: var(--weak);
}
.reason-tag.pass {
  background: var(--pass);
}

.current-alt {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 8px;
}
.current-alt code {
  font-family: var(--font-mono);
  background: var(--panel-raised);
  padding: 1px 6px;
  border-radius: 4px;
}

.drafts {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.drafts-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.draft-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  cursor: pointer;
}
.draft-row:hover {
  background: var(--panel-raised);
}
.draft-row.selected {
  background: var(--panel-raised);
}
.draft-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.draft-radio {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
}
.draft-row.selected .draft-radio {
  border-color: var(--accent);
}
.draft-row.selected .draft-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.custom-row {
  cursor: default;
}
.draft-custom-input {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 2px 0;
}
.draft-custom-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.draft-custom-input::placeholder {
  color: var(--ink-faint);
}

.draft-text {
  flex: 1;
  font-size: 0.9rem;
  min-height: 1.4em;
}
/* typewriter reveal — one deliberate moment of motion, tied to the
     generative-text identity, rather than scattered hover effects. */
.draft-text .char {
  opacity: 0;
  animation: reveal-char 0.01s forwards;
}
@keyframes reveal-char {
  to {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .draft-text .char {
    animation: none;
    opacity: 1;
  }
}

.export-wrap {
  margin: 20px 0;
  text-align: center;
}

.export-output-wrap {
  margin-top: 16px;
  padding: 18px;
  background: var(--panel-bg);
  border-radius: 6px;
}
.export-output-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.export-output {
  width: 100%;
  min-height: 140px;
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  resize: vertical;
  margin-bottom: 12px;
}

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 20px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
  font-size: 0.85rem;
  background: var(--panel-bg);
  border-radius: 6px;
}
