/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Design tokens ──────────────────────────────────────────── */
:root {
  --bg:      #faf9f7;
  --text:    #1c1c1c;
  --muted:   #6b6b6b;
  --border:  #e0ded9;
  --link:    #1a4c8a;
  --link-hover: #0f2f5a;
  --badge-contribution-bg:   #fff3cd;
  --badge-contribution-text: #7a5200;
  --badge-resource-bg:       #dbeafe;
  --badge-resource-text:     #1e3a8a;
  --max-width: 720px;
}

/* ─── Base ───────────────────────────────────────────────────── */
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding: 0 1.5rem;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ─── Site chrome: header + nav form one visual block ─────────── */

header {
  max-width: var(--max-width);
  margin: 2.75rem auto 0;   /* no bottom margin — nav attaches directly */
  padding-bottom: 0.85rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.5rem;
  font-weight: normal;
  letter-spacing: -0.02em;
}

.tagline {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
}

.submit-link {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--text);
  color: var(--bg);
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  white-space: nowrap;
}
.submit-link:hover { background: #333; color: var(--bg); text-decoration: none; }

/* Nav sits immediately below the header title row, shares the same
   max-width box, and carries the border that separates chrome from content */
.sitenav {
  max-width: var(--max-width);
  margin: 0 auto 0;          /* zero top and bottom — spacing handled below */
  padding: 0.5rem 0 0.6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.79rem;
  letter-spacing: 0.01em;
  flex-wrap: wrap;
}

.sitenav a {
  color: var(--muted);
  text-decoration: none;
}
.sitenav a:hover { color: var(--text); text-decoration: none; }

/* ─── Content containers ─────────────────────────────────────── */

main {
  max-width: var(--max-width);
  margin: 2rem auto 5rem;
}

.form-wrap {
  max-width: var(--max-width);
  margin: 2rem auto 5rem;
}

/* ─── Blurb ──────────────────────────────────────────────────── */

.blurb {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
}

.blurb p {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 0.85rem;
  color: #2a2a2a;
}
.blurb p:last-child { margin-bottom: 0; }

/* ─── Article list ───────────────────────────────────────────── */

.articles { list-style: none; }

.article {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}
.article:last-child { border-bottom: none; }

.article-title {
  font-size: 1.05rem;
  font-weight: normal;
  line-height: 1.4;
}
.article-title a { color: var(--text); }
.article-title a:hover { color: var(--link); text-decoration: none; }

.article-meta {
  font-family: system-ui, sans-serif;
  font-size: 0.73rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.badge {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.38rem;
  border-radius: 2px;
}
.badge-contribution { background: var(--badge-contribution-bg); color: var(--badge-contribution-text); }
.badge-resource     { background: var(--badge-resource-bg);     color: var(--badge-resource-text); }

.article-description {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.55;
}

.empty-state {
  padding: 3rem 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.93rem;
}

/* ─── Sort controls ──────────────────────────────────────────── */

.sort-controls {
  font-family: system-ui, sans-serif;
  font-size: 0.73rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.sort-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.1rem 0.38rem;
  font-size: 0.71rem;
  font-family: system-ui, sans-serif;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}
.sort-btn:hover { border-color: var(--muted); color: var(--text); }
.sort-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ─── Theory page ────────────────────────────────────────────── */

.theory h2 {
  font-size: 1.05rem;
  font-weight: normal;
  margin: 2rem 0 0.55rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.theory h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.theory p {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 0.85rem;
  color: #2a2a2a;
}
.theory p:last-child { margin-bottom: 0; }

.theory-list {
  margin: 0.4rem 0 1rem 1.2rem;
}
.theory-list li {
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0.45rem;
  color: #2a2a2a;
}

/* ─── Contributors ───────────────────────────────────────────── */

.contributors-list { list-style: none; }

.contributor {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.contributor:last-child { border-bottom: none; }

.contributor-name { font-size: 1rem; color: var(--text); }

.contributor-handle {
  font-family: system-ui, sans-serif;
  font-size: 0.73rem;
  color: var(--muted);
}

.contributor-site {
  font-family: system-ui, sans-serif;
  font-size: 0.73rem;
  color: var(--link);
}
.contributor-site:hover { color: var(--link-hover); text-decoration: underline; }

.contributor-bio {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  width: 100%;
  margin-top: 0.1rem;
}

/* ─── Submit page welcome greeting ──────────────────────────── */

.welcome-greeting {
  font-size: 0.9rem;
  font-family: system-ui, sans-serif;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.profile-link {
  font-size: 0.8rem;
  margin-left: 0.6rem;
  color: var(--link);
}
.profile-link:hover { color: var(--link-hover); text-decoration: underline; }

/* ─── Profile page ───────────────────────────────────────────── */

input[readonly] {
  background: var(--bg);
  color: var(--muted);
  cursor: default;
  border-color: var(--border);
}
input[readonly]:focus { outline: none; border-color: var(--border); }

.form-note {
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 1rem;
}

/* ─── Devlog ─────────────────────────────────────────────────── */

.devlog-intro {
  font-family: system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.devlog-entry {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.devlog-entry:last-child { border-bottom: none; }

.devlog-meta {
  font-family: system-ui, sans-serif;
  font-size: 0.73rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.devlog-entry p {
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 0.6rem;
  color: #2a2a2a;
}
.devlog-entry p:last-child { margin-bottom: 0; }

.devlog-entry code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: #f0ede8;
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

/* ─── Forms ──────────────────────────────────────────────────── */

.form-wrap h2 {
  font-size: 1.15rem;
  font-weight: normal;
  margin-bottom: 0.4rem;
}

.form-wrap .form-intro {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.65;
}

.field { margin-bottom: 1.2rem; }

label {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.79rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}
label .optional { font-weight: normal; color: var(--muted); }

input[type="url"],
input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.4;
  appearance: none;
  transition: border-color 0.1s;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: 1px;
  border-color: var(--link);
}

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

.select-wrap { position: relative; }
.select-wrap::after {
  content: '▾';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted);
  font-size: 0.75rem;
}

button[type="submit"] {
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--text);
  color: var(--bg);
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
button[type="submit"]:hover { background: #333; }
button[type="submit"]:disabled { opacity: 0.5; cursor: default; }

.form-message {
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  margin-top: 1rem;
  padding: 0.55rem 0.75rem;
  border-radius: 3px;
  display: none;
}
.form-message.success { background: #d1fae5; color: #065f46; display: block; }
.form-message.error   { background: #fee2e2; color: #991b1b; display: block; }
