* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #f8f8f8;
  color: #111;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 52px;
  padding: 10px 20px;
  background: #333;
  color: #fff;
}

.site-title {
  flex: 0 0 auto;
  font-size: 1.5rem;
  font-weight: 700;
}

.site-title a,
.nav-menu a,
.nav-trigger {
  color: #fff;
  text-decoration: none;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-menu a,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.nav-menu a:hover,
.nav-menu a:focus-visible,
.nav-trigger:hover,
.nav-trigger:focus-visible {
  background: #555;
  outline: none;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  min-width: 150px;
  background: #444;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  display: block;
}

.dropdown a {
  display: block;
  min-height: 0;
  padding: 12px 16px;
}

.dropdown a:hover,
.dropdown a:focus-visible {
  background: #555;
}

.account-link {
  gap: 8px;
}

.account-link::before {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  content: "A";
  font-size: 0.75rem;
  font-weight: 700;
}

.banner {
  width: 100%;
  height: 30vh;
  min-height: 180px;
  max-height: 320px;
  margin-bottom: 18px;
  overflow: hidden;
  background: #fff;
  text-align: center;
}

.banner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-intro {
  max-width: 900px;
  margin: 0 auto 20px;
  padding: 0 20px;
  text-align: center;
}

.site-intro h1 {
  margin: 0 0 6px;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.site-intro p {
  margin: 0;
  color: #555;
  font-size: 1.05rem;
}

.container {
  display: flex;
  gap: 20px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.featured {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  width: 75%;
}

.post-card,
.archive-item {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  color: #111;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover,
.post-card:focus-visible,
.archive-item:hover,
.archive-item:focus-visible {
  transform: translateY(-3px);
  outline: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16);
}

.post-card-image {
  display: block;
  width: 100%;
  height: 260px;
  background: #eee;
  object-fit: cover;
}

.post-card-body {
  padding: 15px;
}

.post-card-title {
  margin: 0 0 8px;
  font-size: 1.22rem;
  line-height: 1.15;
}

.post-card-subtitle,
.post-card-summary,
.post-card-meta {
  margin: 5px 0;
}

.post-card-subtitle,
.post-card-summary {
  font-size: 0.92rem;
}

.post-card-meta {
  color: #666;
  font-size: 0.82rem;
}

.all-posts {
  width: 25%;
  max-height: 80vh;
  padding-left: 0;
  overflow-y: auto;
}

.all-posts h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

#all-posts-list {
  display: grid;
  gap: 10px;
}

.archive-item {
  padding: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.archive-item h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  line-height: 1.15;
}

.archive-item p,
.archive-meta {
  margin: 0;
  color: #666;
  font-size: 0.82rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  color: #555;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

#detail-container,
#create-container {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: 20px;
}

#post-content,
#edit-form,
.composer-card,
.gate-card {
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#post-content {
  padding: 22px;
}

.article-header h1,
#post-content h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
}

.article-header h2,
#post-content h2 {
  margin: 0 0 14px;
  color: #555;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  line-height: 1.2;
}

.article-meta {
  margin: 3px 0;
  color: #666;
  font-size: 0.92rem;
}

.post-hero-image {
  display: block;
  width: 100%;
  max-height: 620px;
  margin: 22px 0;
  border-radius: 8px;
  object-fit: cover;
}

.article-summary {
  margin: 0 0 24px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.article-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  line-height: 1.75;
}

.article-content p,
.article-content ul,
.article-content ol {
  margin-top: 0;
  margin-bottom: 1.1em;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 1.5em 0 0.55em;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.2;
}

.action-bar {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 50;
}

#auth-section {
  display: grid;
  place-items: center;
  min-height: 55vh;
  text-align: center;
}

.gate-card {
  width: min(100%, 520px);
  padding: 28px;
}

.gate-card h1,
.composer-topbar h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.gate-copy {
  margin: 0 0 18px;
  color: #555;
}

.composer-shell,
#edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.composer-topbar,
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-card,
#edit-form {
  padding: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #333;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 400;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: #007bff;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover,
button:focus-visible {
  background: #0056b3;
  outline: none;
}

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

.danger-button,
#delete-btn {
  background: #dc3545;
}

.danger-button:hover,
#delete-btn:hover,
.danger-button:focus-visible,
#delete-btn:focus-visible {
  background: #b02a37;
}

.status-message {
  min-height: 22px;
  margin: 0;
  color: #555;
}

.status-message.is-error {
  color: #b02a37;
}

.status-message.is-success {
  color: #0f6f3e;
}

#editor,
#edit-editor {
  height: 420px;
  margin-bottom: 10px;
}

.ql-toolbar.ql-snow {
  border-radius: 4px 4px 0 0;
  background: #fff;
}

.ql-container.ql-snow {
  border-radius: 0 0 4px 4px;
  background: #fff;
}

.ql-editor {
  min-height: 360px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.65;
}

@media (max-width: 768px) {
  .header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .nav-menu {
    flex-wrap: wrap;
    width: 100%;
  }

  .nav-item {
    margin: 0;
  }

  .nav-menu a,
  .nav-trigger {
    padding: 8px 10px;
  }

  .dropdown {
    position: static;
  }

  .banner {
    height: 240px;
  }

  .container {
    flex-direction: column;
    padding: 10px;
  }

  .featured,
  .all-posts {
    width: 100%;
  }

  .featured {
    grid-template-columns: 1fr;
  }

  .all-posts {
    max-height: none;
  }

  #detail-container,
  #create-container {
    padding: 12px;
  }

  #post-content,
  #edit-form,
  .composer-card,
  .gate-card {
    padding: 16px;
  }

  .composer-topbar,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-actions button {
    width: 100%;
  }
}
