:root {
  --royal-blue: #4169e1;
  --royal-blue-dark: #000080;
  --gold: #ffd700;
  --gold-dark: #daa520;
  --emerald-green: #3cb371;
  --emerald-green-dark: #2e8b57;
  --slate-gray: #708090;
  --slate-gray-dark: #696969;
  --slate-gray-darkest: #2f4f4f;
  --slate-gray-lightest: #d3d3d3;
  --page-bg: #f8f9fa;
  --card-bg: #ffffff;
  --border: #e1e8ed;
  --text: #333333;
  --muted: #666666;
  --danger: #a94442;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #ffffff;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
}

a {
  color: #3498db;
  text-decoration: none;
  transition:
    color 0.3s ease,
    background-color 0.3s ease,
    transform 0.3s ease;
}

a:hover {
  color: #2980b9;
}

input,
textarea,
select,
button {
  font: inherit;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.narrow {
  max-width: 820px;
}

h1,
h2,
h3,
h4 {
  color: #2c3e50;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
}

p {
  color: #555555;
  margin-bottom: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(
    135deg,
    var(--royal-blue-dark) 0%,
    var(--royal-blue) 100%
  );
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  color: white;
  padding: 1rem 0;
}

.header-content,
.main-nav,
.footer-grid,
.admin-heading,
.results-line,
.meta,
.actions {
  display: flex;
  align-items: center;
}

.header-content {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-link {
  color: white;
  display: grid;
  text-decoration: none;
}

.logo-link:hover {
  color: white;
}

.logo-link strong {
  color: white;
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1.2;
}

.logo-link span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-weight: 300;
}

.main-nav {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.main-nav a,
.main-nav button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: white;
  cursor: pointer;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.main-nav a:hover,
.main-nav .active,
.main-nav button:hover {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.main-nav form {
  margin: 0;
}

.hero-section,
.article-hero {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.article-hero {
  background: linear-gradient(
    135deg,
    var(--emerald-green) 0%,
    var(--emerald-green-dark) 100%
  );
}

.hero-section h1,
.article-hero h1 {
  color: white;
  font-size: 3rem;
  line-height: 1.2;
  margin: 0 auto 1rem;
  max-width: 900px;
}

.hero-section p,
.article-hero p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.2rem;
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
}

.eyebrow {
  color: white;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  max-width: 760px;
  margin: 2rem auto 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.search-bar input {
  min-width: 0;
  border: 2px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.75rem;
}

.search-bar input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--royal-blue-dark);
  outline: none;
}

button,
.button,
.search-bar button {
  display: inline-block;
  border: 0;
  border-radius: 5px;
  background: var(--royal-blue-dark);
  color: white;
  cursor: pointer;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

button:hover,
.button:hover,
.search-bar button:hover {
  background: var(--royal-blue);
  box-shadow: 0 4px 15px rgba(0, 0, 128, 0.3);
  color: white;
  transform: translateY(-2px);
}

.button.secondary {
  background: transparent;
  border: 2px solid var(--royal-blue-dark);
  color: var(--royal-blue-dark);
}

.button.secondary:hover {
  background: var(--royal-blue-dark);
  color: white;
}

.blog-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 4rem 20px;
}

.blog-sidebar {
  align-content: start;
  display: grid;
  gap: 1.5rem;
}

.panel,
.blog-card,
.admin-card,
.table-wrap,
.empty-state,
.back-panel,
.editor-main,
.editor-side {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 1.5rem;
}

.panel h2 {
  color: #2c3e50;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.panel > a {
  border-radius: 5px;
  color: var(--slate-gray-dark);
  display: block;
  font-weight: 500;
  padding: 0.6rem 0.75rem;
}

.panel > a.selected,
.panel > a:hover {
  background: #ecf0f1;
  color: var(--royal-blue-dark);
}

.tag-cloud,
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud a,
.article-tags a,
.category-pill {
  display: inline-flex;
  border-radius: 20px;
  background: var(--emerald-green);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
}

.tag-cloud a:hover,
.article-tags a:hover,
.category-pill:hover {
  background: var(--emerald-green-dark);
  color: white;
}

.post-list {
  display: grid;
  gap: 1rem;
}

.results-line {
  justify-content: space-between;
  color: var(--slate-gray);
  gap: 1rem;
}

.results-line a {
  color: var(--royal-blue-dark);
  font-weight: 600;
}

.blog-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5rem;
  margin-bottom: 1rem;
  padding: 2rem;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.blog-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}

.blog-card.featured {
  border-left: 4px solid var(--gold);
}

.blog-card h2 {
  font-size: 1.5rem;
  line-height: 1.4;
  margin: 0.75rem 0 0.75rem;
}

.blog-card h2 a {
  color: var(--slate-gray-dark);
}

.blog-card h2 a:hover {
  color: var(--royal-blue);
}

.blog-card p {
  color: var(--slate-gray);
  margin-bottom: 1.5rem;
}

.meta {
  color: var(--slate-gray);
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
}

small {
  color: var(--slate-gray);
  font-size: 0.9rem;
}

.read-link {
  align-self: end;
  color: var(--royal-blue-dark);
  font-weight: 600;
  white-space: nowrap;
}

.read-link:hover {
  color: var(--royal-blue);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination a {
  min-width: 42px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--royal-blue-dark);
  text-align: center;
}

.pagination a:hover,
.pagination .current {
  background: var(--royal-blue-dark);
  color: white;
}

.featured-image {
  width: 100%;
  margin-top: 2rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.article-content {
  margin: 0 auto;
  padding: 4rem 0;
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content h2 {
  color: var(--slate-gray-dark);
  font-size: 2rem;
  margin: 2.5rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--emerald-green);
}

.article-content h3 {
  color: var(--slate-gray-dark);
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

.article-content p,
.article-content li {
  color: var(--slate-gray);
}

.article-content ul,
.article-content ol {
  margin: 0 0 1.5rem 2rem;
}

.article-content a {
  color: var(--royal-blue-dark);
  font-weight: 600;
}

.article-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  border-left: 4px solid var(--emerald-green);
  background: var(--page-bg);
  border-radius: 8px;
  color: var(--slate-gray);
}

.article-tags {
  margin-bottom: 2rem;
}

.back-panel,
.empty-state {
  margin: 2rem 0 4rem;
  padding: 2rem;
}

.site-footer {
  background-color: var(--slate-gray);
  color: white;
  padding: 3rem 0 1rem;
}

.footer-grid {
  align-items: flex-start;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.footer-grid h3,
.footer-grid h4 {
  color: white;
  margin-bottom: 1rem;
}

.footer-grid p,
.footer-grid a {
  color: #bdc3c7;
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.footer-grid a:hover {
  color: white;
}

.admin-auth,
.admin-dashboard,
.admin-editor {
  padding: 4rem 20px;
}

.admin-card {
  padding: 2rem;
}

.stacked-form,
.editor-main,
.editor-side {
  display: grid;
  gap: 1.5rem;
}

label {
  color: #2c3e50;
  display: grid;
  font-weight: 500;
  gap: 0.5rem;
}

input,
textarea,
select {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: white;
  color: var(--text);
  padding: 0.75rem;
  transition: border-color 0.3s ease;
}

.alert {
  border-radius: 4px;
  background-color: #f2dede;
  color: var(--danger);
  padding: 15px;
}

.admin-heading {
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-heading h1 {
  color: #2c3e50;
  font-size: 2.5rem;
  margin-bottom: 0.25rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--slate-gray-dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

.status {
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  background: #ecf0f1;
  color: var(--slate-gray-dark);
  font-size: 0.8rem;
  font-weight: 600;
}

.status.published {
  background: var(--emerald-green);
  color: white;
}

.actions {
  align-items: flex-start;
  gap: 0.75rem;
}

.actions a,
.actions button {
  background: transparent;
  box-shadow: none;
  color: var(--royal-blue-dark);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0;
}

.actions a:hover,
.actions button:hover {
  background: transparent;
  box-shadow: none;
  color: var(--royal-blue);
  transform: none;
}

.actions button {
  color: var(--danger);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 2rem;
}

.editor-main,
.editor-side {
  align-content: start;
  padding: 2rem;
}

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox input {
  width: auto;
}

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
.button:focus {
  outline: 2px solid var(--royal-blue-dark);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .main-nav {
    justify-content: center;
    gap: 0;
  }

  .main-nav a,
  .main-nav button {
    padding: 0.5rem;
  }

  .hero-section h1,
  .article-hero h1,
  .admin-heading h1 {
    font-size: 2rem;
  }

  .hero-section p,
  .article-hero p {
    font-size: 1rem;
  }

  .search-bar,
  .blog-shell,
  .editor-grid,
  .blog-card {
    display: grid;
    grid-template-columns: 1fr;
  }

  .blog-shell,
  .admin-auth,
  .admin-dashboard,
  .admin-editor {
    padding: 3rem 15px;
  }

  .blog-sidebar,
  .editor-side {
    margin-top: 1rem;
  }

  .read-link {
    justify-self: start;
  }

  .admin-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero-section h1,
  .article-hero h1 {
    font-size: 1.8rem;
  }

  .button,
  button,
  .search-bar button {
    width: 100%;
  }

  .actions {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
