/* ── Design tokens ─────────────────────────────────────── */
:root {
  --bg:          #f6f7f9;
  --surface:     #ffffff;
  --border:      #e2e5ea;
  --border-focus:#4f7ef8;
  --text:        #1a1d23;
  --text-muted:  #6b7280;
  --primary:     #4f7ef8;
  --primary-dk:  #3b65d5;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --danger-border:#fca5a5;
  --radius:      10px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --font:        system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ── Reset / base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0 1rem 4rem;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Page wrapper ──────────────────────────────────────── */
.page {
  max-width: 760px;
  margin: 0 auto;
}

/* ── Nav ───────────────────────────────────────────────── */
nav {
  display: flex;
  gap: .25rem;
  align-items: center;
  padding: 1rem 0 1.5rem;
  max-width: 760px;
  margin: 0 auto;
}

nav a {
  padding: .4rem .9rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: .9rem;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}

nav a:hover {
  background: var(--border);
  color: var(--text);
  text-decoration: none;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* ── Form ──────────────────────────────────────────────── */
.card form,
form.card { padding: 1.75rem; }

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

legend {
  font-weight: 700;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0;
  margin-bottom: .75rem;
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--border);
  padding-bottom: .4rem;
}

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: .75rem 0 .3rem;
}

label:has(+ input[required])::after,
label:has(+ textarea[required])::after,
label:has(+ select[required])::after {
  content: " *";
  color: var(--danger);
  font-weight: 700;
}

input[type="text"],
input[type="email"],
input:not([type="file"]):not([type="submit"]):not([type="button"]):not([type="checkbox"]),
textarea,
select {
  width: 100%;
  padding: .55rem .75rem;
  font: inherit;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79,126,248,.15);
}

textarea { resize: vertical; min-height: 80px; }

input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: .875rem;
  color: var(--text-muted);
  padding: .4rem 0;
}

.row {
  display: flex;
  gap: .75rem;
}

.row > * { flex: 1; }

/* ── Group (repeating blocks like backgrounds) ─────────── */
.group {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .9rem 1rem;
  margin-bottom: .6rem;
}

.group label {
  margin-top: 0;
  font-weight: 600;
  color: var(--text);
}

/* ── Buttons ───────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem 1.1rem;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
}

button[type="submit"], .btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

button[type="submit"]:hover, .btn-primary:hover {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
  box-shadow: var(--shadow-md);
}

button[type="button"]:not(.delete-btn) {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border);
}

button[type="button"]:not(.delete-btn):hover {
  background: var(--bg);
  border-color: var(--primary);
}

.delete-btn {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
  font-size: .8rem;
  padding: .35rem .75rem;
}

.delete-btn:hover {
  background: #fee2e2;
  border-color: var(--danger);
}

/* ── Intro card ────────────────────────────────────────── */
.intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  transition: box-shadow .2s;
}

.intro:hover { box-shadow: var(--shadow-md); }

.intro-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}

.intro-header h2 { margin: 0; }
.intro-header h1 { margin: 0; }

.meta {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(79,126,248,.08);
  border: 1px solid rgba(79,126,248,.2);
  border-radius: 20px;
  padding: .2rem .7rem;
  margin-bottom: .85rem;
}

.section { margin: .65rem 0; font-size: .95rem; }

.section-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  margin-bottom: .2rem;
}

ul {
  margin: .3rem 0 .5rem 1.25rem;
  padding: 0;
}

li { margin-bottom: .2rem; font-size: .9rem; }

blockquote {
  border-left: 3px solid var(--primary);
  margin: .75rem 0;
  padding: .5rem 1rem;
  background: rgba(79,126,248,.05);
  border-radius: 0 6px 6px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Image ─────────────────────────────────────────────── */
figure {
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

figure img {
  max-width: 100%;
  display: block;
  max-height: 340px;
  object-fit: cover;
  width: 100%;
}

figcaption {
  font-size: .8rem;
  color: var(--text-muted);
  padding: .4rem .75rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* ── Response pre ──────────────────────────────────────── */
pre {
  background: #1e2130;
  color: #a9b1d6;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: .85rem;
  line-height: 1.6;
  margin: 1rem 0;
}

/* ── States ────────────────────────────────────────────── */
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 1rem;
}

.error { color: var(--danger); font-style: italic; }

/* ── Page heading row ──────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* ── Back link ─────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.back-link:hover { color: var(--text); text-decoration: none; }
