/* Deliberately minimal for milestone 0 — enough to read, nothing more. */
:root {
  --ink: #1a1a1a;
  --paper: #fbfaf7;
  --muted: #6b6b6b;
  --rule: #ddd9d0;
  --up: #1f6b3a;
  --down: #a3231f;
  /* the header and menu bands, a shade off the page they sit above */
  --band: #f3efe6;
  --measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e6e1;
    --paper: #16161a;
    --muted: #9a978f;
    --rule: #33333a;
    --up: #6fcf97;
    --down: #eb5757;
    --band: #1d1d23;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 Georgia, "Iowan Old Style", serif;
}

main { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .25rem; }

.tagline { color: var(--muted); font-style: italic; margin: 0; }

/* masthead: titles on the left, whoever is signed in on the right */
.masthead {
  background: var(--band);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  max-width: var(--measure); margin: 0 auto; padding: 1.5rem 1.25rem;
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem 1.5rem; flex-wrap: wrap;
}
.masthead .titles { min-width: 0; }
.masthead .account {
  display: flex; align-items: baseline; gap: .75rem;
  font-size: .95rem; white-space: nowrap;
}
.masthead .account .who { font-weight: bold; }

/* menu, sitting under the masthead */
nav.mainnav { border-bottom: 1px solid var(--rule); }
.nav-inner {
  max-width: var(--measure); margin: 0 auto; padding: .55rem 1.25rem;
  display: flex; align-items: baseline; gap: 1.5rem; font-size: .95rem;
}
.nav-inner a {
  color: var(--muted); text-decoration: none;
  padding: .15rem 0; border-bottom: 2px solid transparent;
}
.nav-inner a:hover { color: var(--ink); }
.nav-inner a.current { color: var(--ink); border-bottom-color: var(--ink); }

/* Narrow: let the titles have the width and drop the account beneath them,
   left-aligned, rather than squeezing two columns that do not fit. */
@media (max-width: 32rem) {
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: .75rem; }
  h1 { font-size: 1.6rem; }
}

/* auth */
.auth, .signed-in { margin-bottom: 2rem; }

.auth-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.auth-tabs button {
  font: inherit; background: none; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 4px;
  padding: .4rem .9rem; cursor: pointer;
}
.auth-tabs button.active { color: var(--ink); border-color: var(--ink); }

.field { display: block; margin-bottom: 1rem; max-width: 24rem; }
.field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.field input {
  font: inherit; width: 100%; padding: .5rem .6rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}
.field-hint { display: block; font-size: .8rem; color: var(--muted); margin-top: .3rem; }

button.primary {
  font: inherit; padding: .55rem 1.1rem; cursor: pointer;
  background: var(--ink); color: var(--paper);
  border: 1px solid var(--ink); border-radius: 4px;
}
button.primary:disabled { opacity: .5; cursor: default; }

.signed-in button {
  font: inherit; padding: .4rem .9rem; cursor: pointer;
  background: none; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}

.error { color: var(--down); max-width: 24rem; }
.muted { color: var(--muted); }

.masthead h1 a { color: inherit; text-decoration: none; }
button.link {
  font: inherit; background: none; border: none; padding: 0;
  color: var(--ink); text-decoration: underline; cursor: pointer;
}
.banner { border: 1px solid currentColor; padding: .6rem .8rem; border-radius: 4px; }

/* nations */
.nation-list, ul.plain { list-style: none; padding: 0; }
.nation-card { border-bottom: 1px solid var(--rule); padding: 1rem 0; }
.nation-card h3 { margin: 0 0 .25rem; font-size: 1.15rem; }
.excerpt { margin: .4rem 0 0; }
.description { white-space: pre-wrap; }

.badge {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--rule);
  border-radius: 999px; padding: .1rem .5rem; vertical-align: middle;
}

.controls { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 1.25rem 0; }
.controls button {
  font: inherit; padding: .4rem .9rem; cursor: pointer;
  background: none; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}
.controls button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }

a.button {
  display: inline-block; text-decoration: none;
  padding: .5rem 1rem; border: 1px solid var(--ink); border-radius: 4px;
  background: var(--ink); color: var(--paper);
}

table.members { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.members th, table.members td {
  text-align: left; padding: .4rem .6rem .4rem 0;
  border-bottom: 1px solid var(--rule);
}
table.members th { font-weight: normal; color: var(--muted); font-size: .85rem; }

form.edit textarea, .field textarea {
  font: inherit; width: 100%; padding: .5rem .6rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}
form.edit { margin: 1.5rem 0; }
form.edit button { margin-right: .5rem; }

/* laws */
.crumbs { margin: 0 0 .5rem; font-size: .9rem; }
.law-row { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.laws { margin: 2rem 0; }

.badge.draft { border-style: dashed; }
.badge.open { color: var(--ink); border-color: var(--ink); }
.badge.passed { color: var(--up); border-color: var(--up); }
.badge.rejected, .badge.withdrawn { color: var(--down); border-color: var(--down); }

dl.terms {
  display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem;
  margin: 1.25rem 0; font-size: .95rem;
}
dl.terms dt { color: var(--muted); }
dl.terms dd { margin: 0; }

fieldset.kinds { border: 1px solid var(--rule); border-radius: 4px; margin: 0 0 1.5rem; }
fieldset.kinds legend { color: var(--muted); font-size: .85rem; padding: 0 .4rem; }
label.kind { display: block; padding: .4rem 0; cursor: pointer; }
label.kind .kind-name { margin-left: .4rem; }
label.kind .field-hint { margin-left: 1.7rem; margin-top: 0; }
label.kind.selected .kind-name { font-weight: bold; }

label.checkbox { display: block; margin: .6rem 0; cursor: pointer; }
label.checkbox span { margin-left: .4rem; }

.field select, .field input[type="number"] {
  font: inherit; padding: .5rem .6rem; max-width: 100%;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}

/* voting */
.voting { margin: 2rem 0; }
.tally-bar {
  display: flex; height: .75rem; border-radius: 999px; overflow: hidden;
  background: var(--rule); margin-bottom: .6rem;
}
.tally-bar span.for { background: var(--up); }
.tally-bar span.against { background: var(--down); }
.tally-bar span.abstain { background: var(--muted); }
.tally-counts { margin: 0 0 .75rem; font-size: .95rem; }
.tally-counts .for { color: var(--up); }
.tally-counts .against { color: var(--down); }
.tally-counts .abstain { color: var(--muted); }

.extend { display: inline-flex; align-items: center; gap: .4rem; }
.extend input { width: 5rem; font: inherit; padding: .3rem .4rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px; margin: 0 .3rem; }

.vote .controls button.chosen {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}

.roll { margin-top: 1.5rem; }
.roll h4 { margin: 0 0 .5rem; font-size: 1rem; }
.roll td.for { color: var(--up); }
.roll td.against { color: var(--down); }
.roll td.abstain { color: var(--muted); }
.secret-note {
  margin-top: 1.5rem; padding: .7rem .9rem;
  border-left: 3px solid var(--rule); font-size: .9rem;
}

/* reputation */
.score .net { font-weight: bold; font-size: 1.1rem; }
.standing-total { font-size: 1.05rem; }
.ruler-standing { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; }
table.ledger td .note { color: var(--muted); font-size: .85rem; font-style: italic; }
.disclosure {
  margin-top: 1.25rem; padding-top: .75rem;
  border-top: 1px solid var(--rule);
}
.intervene { margin: 1.25rem 0; }
td.up, .up { color: var(--up); }
td.down, .down { color: var(--down); }

/* amendments */
.amendments { margin: 2rem 0; }
ol.amendment-list { padding-left: 1.2rem; }
ol.amendment-list li { margin-bottom: .8rem; }
form.amend { margin: 1.25rem 0; max-width: 42rem; }
form.amend button { margin-right: .5rem; }

/* discussion */
.discussion { margin: 2.5rem 0; }
ul.thread, ul.replies { list-style: none; padding: 0; }
ul.replies { margin-left: 1.25rem; padding-left: 1rem; border-left: 2px solid var(--rule); }
.post { padding: .8rem 0; border-top: 1px solid var(--rule); }
.post-head { font-size: .9rem; }
.post-body { margin: .4rem 0; white-space: pre-wrap; }
.post-actions { display: flex; gap: .9rem; font-size: .85rem; }
.post-actions .link { color: var(--muted); }
.post-actions .link:hover { color: var(--ink); }
.removed { font-style: italic; }

form.compose { margin: .75rem 0; }
form.compose textarea {
  font: inherit; width: 100%; padding: .5rem .6rem; max-width: 42rem;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--rule); border-radius: 4px;
}
form.compose .controls { margin-top: .4rem; }

.status { border-top: 1px solid var(--rule); padding-top: 1rem; font-size: .95rem; }
.status dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: 0; }
.status dt { color: var(--muted); }
.status dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.up { color: var(--up); }
.down { color: var(--down); }
