/* ---------- Colors and sizes (change these to restyle the whole site) ---------- */
:root {
  --bg: #eef2f4;         /* page background */
  --surface: #ffffff;    /* cards and inputs */
  --ink: #14212b;        /* main text */
  --muted: #566571;      /* secondary text */
  --line: #cdd7dd;       /* borders */
  --accent: #0f766e;     /* teal: buttons and selected items */
  --accent-soft: #e2f3f1;
  --marker: #ffd94a;     /* highlighter yellow, used once on the result card */
  --error-bg: #fdecea;
  --error-ink: #8a1f14;
  --radius: 12px;
}

* { box-sizing: border-box; }

/* Makes the HTML "hidden" attribute always work */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
}

/* Keeps everything in one centered column */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.25rem 2rem;
}

/* ---------- Header ---------- */
.header { margin-bottom: 2rem; }

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.6rem 0 0;
  font-size: 1.25rem;
  color: var(--muted);
}

/* ---------- Input panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 220px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: inherit;
  resize: vertical;
}

textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 0.4rem 0 1.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Mode tiles ---------- */
.modes {
  border: 0;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.modes legend { padding: 0; margin-bottom: 0.5rem; }

.mode { position: relative; display: block; cursor: pointer; }

/* Hide the real radio circle, but keep it usable with the keyboard */
.mode input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.mode-body {
  display: block;
  height: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mode-body strong { display: block; }
.mode-body small { display: block; color: var(--muted); font-size: 0.9rem; }

.mode input:checked + .mode-body {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mode input:focus-visible + .mode-body {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.actions { display: flex; gap: 0.75rem; }

.btn {
  font: inherit;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.85rem 1.4rem;
  cursor: pointer;
  border: 2px solid transparent;
}

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

.btn-primary { background: var(--accent); color: #fff; flex: 1; }
.btn-primary:hover { background: #0b5f59; }
.btn-primary:disabled { background: #7aa8a4; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); }

.btn-small { padding: 0.45rem 0.9rem; background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-small:hover { background: var(--bg); }

/* ---------- Error message ---------- */
.message {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-ink);
}

/* ---------- Loading ---------- */
.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--muted);
}

.spinner {
  width: 1.4rem;
  height: 1.4rem;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result card ---------- */
.result {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 8px solid var(--marker);   /* the "highlighter" bar */
  border-radius: var(--radius);
  padding: 1.5rem;
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.result h2 { margin: 0; font-size: 1.3rem; }

.result-text {
  margin: 0;
  white-space: pre-wrap;   /* keeps Claude's paragraph breaks */
  font-size: 1.125rem;
  line-height: 1.65;
}

.footer { margin-top: 2.5rem; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .page { padding-top: 2rem; }
  .panel, .result { padding: 1.1rem; }
  .modes { grid-template-columns: 1fr; }
  .actions { flex-direction: column-reverse; }
}

/* Respect people who turn off animations */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}
