:root {
  --page: #e0eae8;
  --paper: #ffffff;
  --ink: #424d58;
  --muted: #61706c;
  --line: #dce3dd;
  --accent: #009790;
  --accent-light: #cedbd7;
  --content-width: 1100px;
}

* { box-sizing: border-box; }

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

header {
  padding: 1rem 1.5rem 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-header { padding: 0 1.25rem; }
.site-header-inner { width: min(100%, var(--content-width)); margin: 0 auto; }
.site-brand-row { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header .site-name { margin: 0; font-size: 1.25rem; }
.site-actions { display: flex; align-items: center; gap: 0.65rem; margin-left: auto; }
.site-publish-button,
.site-sign-in {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.8rem;
  color: #fff;
  background: #d85252;
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}
.site-publish-button:hover,
.site-sign-in:hover { background: #af4242; }
.site-header .site-nav .site-publish-button { color: #fff; }
.site-header .site-nav .site-sign-in { padding: 0.3rem 1.25rem; color: #fff; }
.account-menu { position: relative; }
.account-menu summary {
  max-width: min(36vw, 15rem);
  overflow: hidden;
  padding: 0.38rem 0.75rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu-items {
  position: absolute;
  z-index: 5;
  top: calc(100% + 0.35rem);
  right: 0;
  display: grid;
  width: max-content;
  min-width: 13rem;
  padding: 0.35rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 22px rgb(25 35 30 / 12%);
}
.account-menu-items a,
.account-menu-items button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account-menu-items a:hover,
.account-menu-items button:hover { background: var(--accent-light); }
.account-menu-items form { margin: 0; border-top: 1px solid var(--line); }
.site-header .site-nav { gap: 0.25rem 1.5rem; }

.topbar {
  max-width: var(--content-width);
  margin: 0 auto;
}

.site-name {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.site-nav a {
  padding: 0.3rem 0.55rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  font-weight: 700;
  border-bottom-color: var(--accent);
}

.content {
  width: min(100% - 2rem, 820px);
  margin: 2rem auto;
}

.page-heading {
  margin-bottom: 1.25rem;
  padding: 1.5rem;
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.2; }
h2 { margin: 0 0 0.75rem; font-size: 1.25rem; }
.subtitle { margin: 0.5rem 0 0; color: var(--muted); }
p { margin: 0.5rem 0; }

section {
  margin-bottom: 1rem;
  padding: 1.4rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.example {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--accent-light);
  border-radius: 4px;
}

.generate-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.55rem 1rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.generate-button:hover { background: #af4242; }
.generate-button:focus-visible { outline: 3px solid #e0a32e; outline-offset: 3px; }

.profile-form { display: grid; gap: 0.5rem; max-width: 28rem; }
.profile-form label { margin-top: 0.5rem; font-weight: 700; }
.profile-form input {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.profile-form input:focus-visible,
.profile-form button:focus-visible,
.logout-button:focus-visible { outline: 3px solid #e0a32e; outline-offset: 3px; }
.profile-feedback { min-height: 1.5rem; }
.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--line);
}
.profile-tab {
  min-height: 44px;
  padding: 0.55rem 0.15rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.profile-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.profile-tab:focus-visible { outline: 3px solid #e0a32e; outline-offset: 2px; }
.article-search-label { display: block; margin: 1rem 0 0.35rem; font-weight: 700; }
.article-search {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.article-search:focus-visible { outline: 3px solid #e0a32e; outline-offset: 2px; }
.owned-pages-header,
.owned-page-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.owned-pages-header h2 { margin: 0; }
.owned-pages-create,
.owned-page-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  color: #fff;
  background: var(--accent);
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
}
.owned-pages-create:hover,
.owned-page-edit:hover { background: #af4242; }
.owned-page-delete {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  color: #8b2f2f;
  background: #fff;
  border: 1px solid #d8a5a5;
  border-radius: 4px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.owned-page-delete:hover { color: #fff; background: #8b2f2f; }
.owned-pages-list { display: grid; gap: 0.75rem; }
.owned-page-item { padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.owned-page-item h3 { margin: 0; font-size: 1rem; }
.owned-page-item p { margin: 0.3rem 0 0; color: var(--muted); }
.owned-page-owner { font-size: 0.85rem; }
.owned-page-actions { display: flex; flex: 0 0 auto; gap: 0.5rem; }
.logout-button {
  min-height: 40px;
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}

.page-form { display: grid; width: 100%; max-width: 44rem; margin-inline: auto; gap: 0.5rem; }
.page-form label { margin-top: 0.5rem; font-weight: 700; }
.page-form input {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.page-form textarea { width: 100%; resize: none; }
.page-form input:focus-visible,
.page-form button:focus-visible { outline: 3px solid #e0a32e; outline-offset: 3px; }
.rich-editor { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.rich-editor-toolbar { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 0.4rem; overflow-x: auto; padding: 0.45rem; background: var(--accent-light); border-bottom: 1px solid var(--line); }
.rich-editor-toolbar-controls,
.rich-editor-toolbar-media { display: flex; flex: 0 0 auto; align-items: center; gap: 0.4rem; }
.rich-editor-toolbar-media { margin-left: auto; }
.rich-editor-group { display: flex; gap: 0.25rem; }
.rich-editor-button,
.rich-editor-alignment,
.rich-editor-font-size { box-sizing: border-box; width: auto; height: 40px; min-height: 40px; padding: 0.35rem 0.6rem; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; font: inherit; cursor: pointer; }
.rich-editor-button:hover,
.rich-editor-alignment:hover,
.rich-editor-font-size:hover { border-color: var(--accent); }
.rich-editor-button:focus-visible,
.rich-editor-alignment:focus-visible,
.rich-editor-font-size:focus-visible,
.rich-editor-color input:focus-visible { outline: 3px solid #e0a32e; outline-offset: 2px; }
.rich-editor-button.is-bold { font-weight: 700; }
.rich-editor-button.is-italic { font-style: italic; }
.rich-editor-button.is-underline { text-decoration: underline; }
.rich-editor .rich-editor-color { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--ink); font-size: 0.9rem; font-weight: 600; }
.rich-editor .rich-editor-color input { box-sizing: border-box; width: 40px; height: 40px; min-height: 40px; padding: 0.15rem; cursor: pointer; }
.rich-editor-area { min-height: 16rem; padding: 0.8rem; overflow-wrap: anywhere; outline: none; }
.rich-editor-area:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.rich-editor-area:empty::before { color: var(--muted); content: attr(data-placeholder); pointer-events: none; }
.rich-editor-area img,
.published-content img { max-width: 100%; height: auto; }
.rich-editor-area video,
.rich-editor-area iframe,
.published-content video,
.published-content iframe,
.activity-description video,
.activity-description iframe { display: block; width: min(100%, 48rem); aspect-ratio: 16 / 9; margin: 0.75rem auto; border: 0; }
.rich-editor-error { margin: 0; padding: 0.5rem 0.8rem; color: #8b2f2f; font-size: 0.9rem; }
.page-feedback { min-height: 1.5rem; }
.published-content { overflow-wrap: anywhere; white-space: normal; }
.public-pages-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
.public-page-item { min-width: 0; padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.public-page-title-line { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; }
.public-page-item h2 { margin: 0; font-size: 1.1rem; }
.public-page-author { color: var(--muted); font-size: 0.9rem; }
.public-page-date { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.85rem; }
.article-meta { margin: 0.65rem 0; color: var(--muted); font-size: 0.9rem; }
.article-sort { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.article-sort label { margin: 0; font-weight: 700; }
.article-sort select {
  min-height: 42px;
  padding: 0.45rem 0.65rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.article-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 1rem 0; }
.vote-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  cursor: pointer;
}
.vote-button:hover { border-color: var(--accent); }
.vote-button:disabled { color: var(--muted); background: #f3f4f2; cursor: not-allowed; opacity: 0.8; }
.vote-button.is-selected { color: #fff; background: var(--accent); border-color: var(--accent); }
.vote-button[data-vote="dislike"].is-selected { background: #8b2f2f; border-color: #8b2f2f; }
.vote-count { min-width: 1.25rem; font-weight: 700; text-align: center; }
.article-list-reactions { margin: 0.65rem 0 0; }

.activity-tabs { display: flex; gap: 1rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.activity-tab {
  min-height: 44px;
  padding: 0.55rem 0.15rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  font: inherit;
  cursor: pointer;
}
.activity-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.activity-tab:focus-visible { outline: 3px solid #e0a32e; outline-offset: 2px; }
.activities-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 1rem; }
.activity-card { min-width: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.activity-card-image { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--accent-light); }
.activity-card-body { display: grid; gap: 0.4rem; padding: 0.9rem; }
.activity-card-body h2 { margin: 0; font-size: 1.1rem; }
.activity-date { margin: 0; color: var(--muted); }
.activity-card-actions { display: flex; justify-content: flex-start; margin-top: 0.35rem; }
.activity-signup-button { width: auto; }
.activity-login-link { align-self: center; font-weight: 700; }
.activity-calendar-list { display: grid; }
.activity-calendar-row { display: grid; grid-template-columns: minmax(9rem, 0.35fr) 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.activity-calendar-date { color: var(--muted); }
.activity-calendar-row h2 { margin: 0; font-size: 1.05rem; }
.activity-calendar-row p { margin: 0.25rem 0 0; color: var(--muted); }
.activity-form { display: grid; width: 100%; max-width: 42rem; margin-inline: auto; gap: 0.5rem; }
.activity-form label { margin-top: 0.5rem; font-weight: 700; }
.activity-form input { width: 100%; min-height: 44px; padding: 0.6rem 0.75rem; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.activity-form input[type="file"] { padding: 0.45rem; }
.activity-detail-image { display: block; width: 100%; max-height: 32rem; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.activity-description { margin: 1rem 0; overflow-wrap: anywhere; }
.activity-attendees { padding-left: 1.25rem; }
.activity-attendees li { padding: 0.25rem 0; }

ol { padding-left: 1.4rem; }
li + li { margin-top: 0.35rem; }

footer {
  padding: 1rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 560px) {
  .site-header { padding: 0 1rem; }
  .site-brand-row { min-height: 54px; gap: 0.5rem; }
  .site-header .site-name { font-size: 1.1rem; }
  .site-actions { gap: 0.35rem; }
  .site-publish-button,
  .site-sign-in { min-height: 38px; padding: 0.35rem 0.55rem; font-size: 0.9rem; }
  .site-header .site-nav { gap: 0.25rem 1.1rem; }
  .owned-pages-header,
  .owned-page-item { align-items: flex-start; }
  .owned-page-item { flex-direction: column; }
  .activity-calendar-row { grid-template-columns: 1fr; gap: 0.35rem; }
}

