: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); }
/* Guild dropdown: opens on hover or keyboard focus. Touch screens just follow the link. */
.nav-menu { position: relative; }
.nav a.nav-menu-top.is-active { color: var(--text); box-shadow: inset 0 -2px 0 var(--berry); }
.caret { display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: 2px; border: 4px solid transparent; border-top-color: currentColor; border-bottom-width: 0; }
.nav-dropdown {
  position: absolute; top: 100%; right: -12px; z-index: 20; margin-top: 10px; min-width: 300px;
  display: grid; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); visibility: hidden; opacity: 0; transform: translateY(-4px);
  transition: opacity .12s, transform .12s, visibility 0s .12s;
}
/* invisible bridge over the gap so the menu doesn't close on the way down */
.nav-dropdown::before { content: ""; position: absolute; inset: -12px 0 auto; height: 12px; }
.nav-menu:hover .nav-dropdown, .nav-menu:focus-within .nav-dropdown { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.nav .nav-dropdown a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--text); font-size: .92rem; white-space: nowrap; }
.nav .nav-dropdown a:hover, .nav .nav-dropdown a:focus-visible { background: var(--berry-soft); color: var(--text); }
.nav .nav-dropdown a[aria-current] { box-shadow: none; background: var(--berry-soft); font-weight: 600; }
.nav-prof-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.nav-prof-grid .prof-icon { border-radius: 50%; }
@media (hover: none) and (pointer: coarse) { .nav-dropdown, .caret { display: none; } }
.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; }
.footer-links { display: flex; gap: 16px; }

/* 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); }

/* home: about */
.about-intro { max-width: 68ch; font-size: 1.06rem; }
.about-intro p { margin: 0 0 1em; }
.about-grid { margin-top: 8px; }
.about-grid h3 { margin-bottom: .4em; }
.about-grid p, .about-grid ul { margin: 0; }
.about-grid ul { padding-left: 1.2em; }
.about-grid li + li { margin-top: .4em; }
.about-grid .about-more { margin-top: .8em; font-weight: 500; }

/* join page */
.join-hero { padding-block: 24px 16px; }
.join-grid .card { display: flex; flex-direction: column; }
.join-grid h3 { margin-bottom: .4em; }
.join-grid p { margin: 0 0 1em; }
.join-grid p:last-child { margin-bottom: 0; }
.join-grid .join-cta { margin-top: auto; }
.schedule table { width: 100%; border-collapse: collapse; }
.schedule th, .schedule td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.schedule th { font-weight: 600; width: 9em; }
.schedule tr:last-child > * { border-bottom: 0; }
.schedule p { margin: 12px 0 0; }
.join-list { max-width: 68ch; padding-left: 1.2em; font-size: 1.06rem; }
.join-list li + li { margin-top: .4em; }

/* 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; }
.roster time { white-space: nowrap; }
.roster th, .roster td { padding-inline: 12px; }
.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; } th, td { white-space: normal; } }

/* professions */
.prof-icon { display: inline-block; flex: none; border-radius: 5px; background: var(--line); box-shadow: 0 0 0 1px rgb(0 0 0 / 35%); vertical-align: middle; }
.profs { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.prof { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums; font-size: .88rem; font-weight: 600; }
.prof:hover { color: var(--berry); }
.prof-head { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.prof-head .prof-icon { border-radius: 10px; }
.prof-head h1 { margin: 0; }
.prof-head p { margin: 0; }
.prof-nav { margin-top: 20px; }
.prof-nav .chip { padding-left: 5px; }
.prof-nav .prof-icon { border-radius: 50%; }
.prof-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.prof-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: var(--text); }
.prof-card:hover { border-color: var(--berry); color: var(--text); }
.prof-card .prof-icon { border-radius: 8px; }
.prof-card > span { display: grid; gap: 2px; min-width: 0; }
.leaderboard .place { color: var(--muted); width: 1%; }
.leaderboard tr.me td { background: var(--berry-soft); }
.skill { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.skill .muted { font-size: .85rem; }
.bar { display: inline-block; width: clamp(60px, 14vw, 160px); height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--leaf); }
.recipes .known-by { white-space: normal; }
.footnote { margin-top: 24px; max-width: 72ch; }

/* 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; }
