/* Base & Layout */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navigation Bar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--borders);
  transition: background 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(10px);
}

.navbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: opacity 0.2s ease;
  flex-shrink: 0;
  min-width: fit-content;
}

.navbar__brand:hover {
  opacity: 0.7;
}

.navbar__avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent);
}

.navbar__name {
  font-weight: 700;
  font-size: 1rem;
  display: none;
}

@media (min-width: 768px) {
  .navbar__name {
    display: inline;
  }
}

.navbar__nav {
  display: flex;
  gap: 2rem;
  flex: 1;
  justify-content: center;
}

.navbar__nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.navbar__nav a:hover,
.navbar__nav a.active {
  color: var(--accent);
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.navbar__actions a,
.navbar__actions button {
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 6px;
  font-size: 0;
}

.navbar__actions a:hover,
.navbar__actions button:hover {
  color: var(--accent);
  background: var(--borders);
}

.navbar__action-link,
.navbar__action-button {
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 6px;
  text-decoration: none;
}

.navbar__action-link:hover,
.navbar__action-button:hover {
  color: var(--accent);
  background: var(--borders);
}

body.light .navbar__actions button#theme-toggle {
  color: #d4d400;
}

body.light .navbar__actions button#theme-toggle:hover {
  background: rgba(212, 212, 0, 0.1);
  color: #e2e240;
}

/* Main Content Area */
.main-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* Footer */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--borders);
  padding: 2rem 1.5rem;
  margin-top: 4rem;
}

.footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer__social {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer__social a {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  transition: color 0.2s ease;
}

.footer__social a:hover {
  color: var(--accent);
}

/* Post List */
.post-list {
  padding: 0;
}

.post-list__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.post-list__filter {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.post-list__clear-filter {
  color: var(--accent);
  text-decoration: none;
  margin-left: 0.5rem;
  transition: opacity 0.2s ease;
}

.post-list__clear-filter:hover {
  opacity: 0.8;
}

.post-list__empty {
  color: var(--text-secondary);
  padding: 2rem 0;
  text-align: center;
}

/* Post Item */
.post-item__link {
  color: var(--text-secondary);
  display: block;
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 2rem 0;
  border-bottom: 1px solid var(--borders);
}

.post-item__link:hover {
  color: var(--accent);
}

.post-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-item__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.post-item__category {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.post-item__date {
  font-size: 0.85rem;
}

.post-item__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.post-item__description {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 0;
  border-top: 1px solid var(--borders);
  margin-top: 2rem;
}

.pagination__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.pagination__link:hover {
  opacity: 0.8;
}

.pagination__info {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Flash Messages */
.flash {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.flash--notice {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash--alert {
  background: #fee2e2;
  color: #7f1d1d;
  border: 1px solid #fecaca;
}

body.dark .flash--notice {
  background: rgba(16, 185, 129, 0.1);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

body.dark .flash--alert {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Search Page */
.search-page {
  padding: 1rem 0;
}

.search-page__form {
  margin-bottom: 2rem;
}

.search-page__input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.search-page__input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--borders);
  border-radius: 6px;
  background: var(--background);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.search-page__input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-page__button {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.2s ease;
}

.search-page__button:hover {
  background: var(--accent-hover);
}

.search-page__count {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.search-page__empty {
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem 0;
}

/* About Page */
.about-page {
  max-width: 680px;
}

.about-page h1 {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  margin-top: 0;
}

.about-page h2 {
  font-size: 2.1rem;
  margin-top: 2rem;
}

.about-page h3 {
  font-size: 1.6rem;
}

.about-page__social {
  margin: 2rem 0;
}

.about-page__social .social-links {
  justify-content: flex-start;
  gap: 1rem;
}

.about-page__social a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.about-page__social a:hover {
  opacity: 0.8;
}

/* Prev/Next Navigation */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  border-top: 1px solid var(--borders);
  margin-top: 3rem;
  padding-top: 2rem;
}

.prev-next__prev,
.prev-next__next {
  display: flex;
  flex-direction: column;
}

.prev-next__next {
  text-align: right;
}

.prev-next__link {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: color 0.2s ease;
}

.prev-next__link:hover {
  color: var(--accent);
}

.prev-next__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 600;
}

.prev-next__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar__inner {
    padding: 0.5rem 1rem;
    gap: 1rem;
  }

  .navbar__nav {
    display: none;
  }

  .main-content {
    padding: 1.5rem 1rem;
  }

  .footer {
    padding: 1.5rem 1rem;
  }

  .post-list__header {
    margin-bottom: 1.5rem;
  }

  .post-item__link {
    padding: 1.5rem 0;
  }

  .post-item__title {
    font-size: 1.25rem;
  }

  .prev-next {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .prev-next__next {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .navbar__brand {
    width: 100%;
  }

  .navbar__actions {
    gap: 0.5rem;
  }

  .navbar__actions a,
  .navbar__actions button {
    width: 2rem;
    height: 2rem;
  }

  .post-item__meta {
    font-size: 0.75rem;
  }

  .post-item__title {
    font-size: 1.1rem;
  }

  .post-item__description {
    font-size: 0.9rem;
  }
}
