:root {
  --bg: #f8f9fa;
  --panel: #ffffff;
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --soft-line: #eaecf0;
  --blue: #3366cc;
  --blue-dark: #0645ad;
  --green: #14866d;
  --red: #b32424;
  --amber: #8f6200;
  --shadow: 0 16px 40px rgba(32, 33, 34, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, #f6f6f6 0, #f6f6f6 14.25rem, transparent 14.25rem),
    radial-gradient(circle at top right, rgba(51, 102, 204, 0.12), transparent 28rem),
    var(--bg);
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

code {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--soft-line);
  border-radius: 0.25rem;
  background: #f1f3f5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #0645ad;
  border-radius: 0.2rem;
  background: linear-gradient(#447ff5, #3366cc);
  color: #fff;
  padding: 0.72rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: linear-gradient(#356fdf, #254fa8);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.ghost {
  background: #fff;
  color: var(--blue-dark);
}

button.danger {
  border-color: #8f1f1f;
  background: linear-gradient(#d94a4a, #b32424);
}

.page-shell {
  display: grid;
  grid-template-columns: 14.25rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  padding: 1.1rem 1rem;
  border-right: 1px solid var(--soft-line);
  color: var(--muted);
}

.brand {
  display: grid;
  grid-template-columns: 4.4rem 1fr;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.6rem;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 4.2rem;
  height: 4.2rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #e9edf5);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

.brand-copy {
  font-size: 0.8rem;
  line-height: 1.25;
}

.side-card {
  padding: 0.9rem 0;
  border-top: 1px solid var(--soft-line);
}

.side-card h2,
.wiki-tools h2 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.015em;
}

.side-card a {
  display: block;
  padding: 0.18rem 0;
  font-size: 0.9rem;
}

.account-card p,
.note-card p {
  margin: 0.25rem 0 0.7rem;
  font-size: 0.88rem;
  line-height: 1.45;
}

.search-box input,
.form-grid input,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.2rem;
  background: #fff;
  color: var(--ink);
}

.search-box input {
  padding: 0.42rem 0.5rem;
}

.content {
  max-width: 76rem;
  padding: 1rem clamp(1rem, 4vw, 3rem) 3rem;
}

.content-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
}

h2,
h3,
p {
  margin-top: 0;
}

.source-line {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 0.35rem;
  border-bottom: 1px solid var(--blue);
}

.header-actions a {
  padding: 0.45rem 0.7rem;
  background: #f8fbff;
  border: 1px solid #c8ccd1;
  border-bottom: 0;
  font-size: 0.9rem;
}

.panel,
.article-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--soft-line);
  box-shadow: var(--shadow);
}

.article-card,
.panel {
  padding: clamp(1rem, 2vw, 1.35rem);
}

.intro-card {
  margin-top: 1.2rem;
  line-height: 1.7;
}

.security-note {
  margin-bottom: 0;
  padding: 0.75rem;
  border-left: 4px solid var(--amber);
  background: #fff8e5;
}

.login-layout,
.blog-layout {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.login-layout {
  grid-template-columns: minmax(0, 1fr) 18rem;
}

.blog-layout {
  grid-template-columns: minmax(18rem, 0.92fr) minmax(20rem, 1.08fr);
  align-items: start;
}

.toolbar,
.section-heading,
.post-actions,
.button-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.toolbar,
.section-heading {
  justify-content: space-between;
}

.toolbar {
  margin-top: 1rem;
}

.toolbar h2,
.section-heading h2,
.login-panel h2,
.password-panel h2 {
  margin: 0;
  font-size: 1.55rem;
}

.form-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.form-grid input,
.form-grid textarea {
  padding: 0.72rem 0.75rem;
}

.form-grid textarea {
  resize: vertical;
  min-height: 12rem;
}

.hint,
.post-meta,
.empty-state,
.section-heading span {
  color: var(--muted);
}

.message {
  min-height: 1.4rem;
  margin: 0;
  font-weight: 700;
}

.message.success {
  color: var(--green);
}

.message.error {
  color: var(--red);
}

.wiki-tools ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.75;
}

.posts-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.post-card {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--soft-line);
  background: #f8fbff;
}

.post-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.post-card p {
  margin-bottom: 0;
  line-height: 1.55;
}

.post-body {
  white-space: pre-wrap;
}

.post-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.locked {
  opacity: 0.68;
}

.locked .form-grid,
.locked textarea,
.locked input {
  pointer-events: none;
}

.password-panel {
  margin-top: 1rem;
}

.footer {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  body {
    background: var(--bg);
  }

  .page-shell,
  .login-layout,
  .blog-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
    background: #f6f6f6;
  }

  .content-header,
  .toolbar,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }
}
