:root {
  color-scheme: light;
  font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  --accent: #3366cc;
  --accent-soft: #eaf1fb;
  --border: #c8ccd1;
  --bg: #f8f9fa;
  --text: #202122;
  --muted: #54595d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
}

a {
  color: var(--accent);
}

a:hover,
a:focus {
  text-decoration: underline;
}

.site-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-header h1 {
  font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  font-weight: 400;
  margin: 0;
  font-size: 1.8rem;
}

#search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 30rem;
}

#search-input {
  flex: 1;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

button {
  padding: 0.55rem 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: var(--accent);
}

main.layout {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
  gap: 1.5rem;
  padding: 1.5rem 2rem 2.5rem;
}

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.panel h2,
.panel h3 {
  margin: 0;
  font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  font-weight: 400;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--accent-soft);
}

.panel-body {
  padding: 1rem 1.25rem;
  overflow: auto;
  flex: 1;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.search-result:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.search-result button {
  display: block;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  width: 100%;
  color: var(--accent);
  font-size: 1.05rem;
  cursor: pointer;
}

.search-result button:hover,
.search-result button:focus {
  text-decoration: underline;
}

.search-result p {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.article-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.article-content {
  line-height: 1.6;
  font-size: 1rem;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: 'Linux Libertine', 'Georgia', 'Times New Roman', serif;
  font-weight: 400;
}

.article-content table {
  border-collapse: collapse;
  width: 100%;
}

.article-content table,
.article-content th,
.article-content td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
}

.revision-controls {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.95rem;
}

.revision-list {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.revision-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.revision-list th,
.revision-list td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

.revision-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.revision-panel {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.revision-panel header {
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.revision-panel header span {
  color: var(--muted);
  font-size: 0.85rem;
}

.revision-panel .revision-body {
  padding: 1rem;
  overflow: auto;
  max-height: 55vh;
  background: white;
}

.empty-state {
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 1rem;
}

.status-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

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

@media (max-width: 1200px) {
  main.layout {
    grid-template-columns: 1fr 1.5fr;
    grid-template-areas: 'search article' 'compare compare';
  }

  .search-panel {
    grid-area: search;
  }

  .article-panel {
    grid-area: article;
  }

  .compare-panel {
    grid-area: compare;
  }

  .panel {
    min-height: 50vh;
  }
}

@media (max-width: 900px) {
  main.layout {
    grid-template-columns: 1fr;
  }
}
