:root {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --text: #1c1d33;
  --muted: #5d6080;
  --line: #e1e2ef;
  --berry: #3f4fc0;
  --berry-strong: #2c3a9e;
  --berry-soft: #e8eaff;
  --leaf: #3d8b4d;
  --warn: #9a5b00;
  --warn-soft: #fff2d9;
  --danger: #b42335;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 22 60 / 6%), 0 6px 24px rgb(20 22 60 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1024;
    --surface: #181a36;
    --text: #e9eaf8;
    --muted: #a2a5c8;
    --line: #2b2e55;
    --berry: #8f9cff;
    --berry-strong: #b0b9ff;
    --berry-soft: #262a5a;
    --leaf: #7cc98a;
    --warn: #ffc56b;
    --warn-soft: #3a2a10;
    --danger: #ff7d8c;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 28px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding-block: 32px 64px; }
a { color: var(--berry); text-underline-offset: 3px; }
a:hover { color: var(--berry-strong); }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 2.75rem); font-weight: 800; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
code { font-size: .9em; background: var(--berry-soft); padding: .1em .35em; border-radius: 6px; }

.wrap { width: 100%; max-width: 1040px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }

/* preview environment banner (ENVIRONMENT=preview) */
.preview-banner { background: #b45309; color: #fff; text-align: center; font-size: 0.875rem; padding: 6px 16px; }
.preview-banner a { color: #fff; text-decoration: underline; }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 64px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-family: Fraunces, Georgia, serif; font-weight: 800; font-size: 1.15rem; }
.nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:not(.btn):hover, .nav a[aria-current] { color: var(--text); }
.nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--berry); }
.site-footer { border-top: 1px solid var(--line); padding-block: 20px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--berry); color: #fff; border: 0; border-radius: 999px;
  padding: 10px 20px; font: 600 .95rem/1.2 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--berry-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn, .btn:hover { color: #0f1024; } }
.btn-ghost { background: transparent; color: var(--berry); box-shadow: inset 0 0 0 1.5px var(--berry); }
.btn-ghost:hover { background: var(--berry-soft); color: var(--berry-strong); }
@media (prefers-color-scheme: dark) { .btn-ghost, .btn-ghost:hover { color: var(--berry); } }
.btn-small { padding: 7px 14px; font-size: .9rem; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); font-weight: 500; cursor: pointer; }
button.link:hover { color: var(--text); }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }

/* hero */
.hero { padding-block: 40px 48px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600; color: var(--leaf); margin: 0 0 8px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; margin: 0; }
.hero h1 { font-size: clamp(2.5rem, 8vw, 4rem); }

/* cards / lists */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 32px 0 14px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.stack { display: grid; gap: 14px; margin-top: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.post-card h3 { margin: 4px 0 6px; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--berry); }
.post-card p:last-child { margin-bottom: 0; color: var(--muted); }
.meta { color: var(--muted); font-size: .88rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--berry-soft); color: var(--berry-strong); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.message { max-width: 640px; margin: 24px auto; }
.message ul { padding-left: 1.2em; }
.error { color: var(--danger); font-weight: 600; }

/* post */
.post { max-width: 720px; margin-inline: auto; }
.post > h1 { margin-top: 12px; }
.prose { margin-top: 28px; font-size: 1.06rem; }
.prose img { max-width: 100%; height: auto; border-radius: 10px; }
.prose blockquote { margin: 1.2em 0; padding: 4px 18px; border-left: 3px solid var(--berry); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose h2 { margin-top: 1.6em; }

/* guild hall */
.guild-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.guild-head h1 { margin-bottom: 4px; }
.guild-head .muted { margin: 0; }
.stats { display: flex; gap: 12px; margin: 0; flex-wrap: wrap; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 104px; }
.stats dt { font-size: .78rem; color: var(--muted); }
.stats dd { margin: 0; font: 800 1.5rem/1.2 Fraunces, Georgia, serif; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-size: .88rem;
}
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--class); box-shadow: 0 0 0 1px rgb(0 0 0 / 25%); }
.chip b { color: var(--muted); font-weight: 600; }
.chip[aria-current] { border-color: var(--berry); box-shadow: inset 0 0 0 1px var(--berry); }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--text); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.char { font-weight: 600; }
.char::before { content: ""; display: inline-block; width: 4px; height: 1em; margin-right: 8px; border-radius: 2px; background: var(--class); box-shadow: 0 0 0 1px rgb(0 0 0 / 20%); vertical-align: -2px; }
@media (max-width: 560px) { .hide-sm { display: none; } th, td { padding: 9px 12px; } td { white-space: normal; } }

/* editor */
.editor { display: grid; gap: 16px; max-width: 760px; }
.editor label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.editor input, .editor textarea, .editor select {
  font: 400 1rem/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%;
}
.editor textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92rem; resize: vertical; }
.editor input:focus, .editor textarea:focus, .editor select:focus { outline: 2px solid var(--berry); outline-offset: 1px; }
.editor .row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.danger { margin-top: 32px; }
.danger-link { color: var(--danger) !important; }
