/* Guildhall base styles - Phase 0 shell. */

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #2b2620;
  --muted: #6f675c;
  --accent: #8a4b08;
  --accent-ink: #ffffff;
  --border: #e2ddd3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.nav-links a {
  color: var(--ink);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-profile .sign-in {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.profile-menu {
  position: relative;
}

.profile-menu summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 10rem;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.08);
}

.profile-role {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.profile-dropdown button {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0.4rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.site-main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.hero {
  text-align: center;
  padding: 4rem 1rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

/* Phase 1: spaces, pages, editor */

.space-layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 2rem;
}

@media (max-width: 48rem) {
  .space-layout {
    grid-template-columns: 1fr;
  }
}

.space-sidebar h2 {
  font-size: 1rem;
  margin-top: 0;
}

.space-sidebar h2 a {
  color: var(--ink);
  text-decoration: none;
}

.page-tree {
  list-style: none;
  padding-left: 0.75rem;
  margin: 0.25rem 0;
  border-left: 1px solid var(--border);
}

.page-tree a {
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
  padding: 0.1rem 0;
}

.page-tree a:hover,
.page-tree a.current {
  color: var(--accent);
}

.badge {
  background: var(--border);
  color: var(--muted);
  border-radius: 0.3rem;
  font-size: 0.7rem;
  padding: 0.05rem 0.35rem;
  margin-left: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.breadcrumbs a {
  color: var(--muted);
}

.crumb-sep {
  margin: 0 0.35rem;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
}

.page-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.inline {
  display: inline;
}

.button-small {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 0.4rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.button-small.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.button-small.danger {
  color: #a03123;
}

.inline-form {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input {
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.4rem 0.6rem;
  min-width: 16rem;
}

.inline-form button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0.4rem;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.space-list {
  list-style: none;
  padding: 0;
}

.space-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.space-list a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

/* Rendered page content and the editor surface share these styles */

.page-body {
  line-height: 1.65;
}

.page-body img {
  max-width: 100%;
}

.page-body pre {
  background: #2b2620;
  color: #f5f1e8;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
}

.page-body code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.9em;
}

.page-body p code,
.page-body li code {
  background: var(--border);
  border-radius: 0.25rem;
  padding: 0.05rem 0.3rem;
}

.page-body blockquote {
  border-left: 3px solid var(--border);
  margin-left: 0;
  padding-left: 1rem;
  color: var(--muted);
}

.callout {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 0.4rem;
  padding: 0.6rem 1rem;
  margin: 0.75rem 0;
}

.callout-info {
  border-left-color: #3672b5;
  background: #eef4fb;
}

.callout-warning {
  border-left-color: #c28b1c;
  background: #fdf6e6;
}

.callout-success {
  border-left-color: #3d8a4e;
  background: #edf7ef;
}

.callout-danger {
  border-left-color: #a03123;
  background: #fbeeec;
}

.table-wrap {
  overflow-x: auto;
}

.page-body table {
  border-collapse: collapse;
  width: 100%;
}

.page-body th,
.page-body td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.page-body th {
  background: var(--bg);
}

.task-list {
  list-style: none;
  padding-left: 0.5rem;
}

/* Editor chrome */

.editor-topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.title-input {
  flex: 1;
  min-width: 14rem;
  font-size: 1.3rem;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  padding: 0.3rem 0.5rem;
  background: transparent;
}

.title-input:focus {
  border-color: var(--border);
  background: var(--surface);
  outline: none;
}

.save-state {
  font-size: 0.8rem;
  color: var(--muted);
}

.save-error {
  color: #a03123;
}

.editor-toolbar {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 0.5rem 0.5rem 0 0;
  background: var(--surface);
  padding: 0.35rem;
}

.editor-toolbar button,
.toolbar-upload {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 0.3rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.editor-toolbar button:hover,
.toolbar-upload:hover {
  background: var(--bg);
  border-color: var(--border);
}

.toolbar-sep {
  width: 1px;
  background: var(--border);
  margin: 0.15rem 0.25rem;
}

.editor-surface {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 0.5rem 0.5rem;
  background: var(--surface);
  padding: 1rem 1.25rem;
  min-height: 24rem;
}

.editor-surface .tiptap {
  outline: none;
  min-height: 22rem;
}

.editor-surface .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--muted);
  float: left;
  height: 0;
  pointer-events: none;
}

/* Search */

.search-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.search-form input {
  flex: 1;
  max-width: 28rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.45rem 0.7rem;
}

.search-form button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 0.4rem;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}

.search-results {
  list-style: none;
  padding: 0;
}

.search-results li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.search-results a {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.snippet b {
  color: var(--ink);
  background: #f6e8c9;
}

.revision-table td {
  padding: 0.35rem 0.75rem 0.35rem 0;
}
