* {
  box-sizing: border-box;
}

:root {
  --bg-main: #f4efe6;
  --bg-soft: #fffaf0;
  --surface: #fffefa;
  --ink: #152226;
  --ink-soft: #405157;
  --line: #decfb4;
  --brand: #004b57;
  --brand-strong: #003640;
  --accent: #be6a1f;
  --shadow-soft: 0 12px 28px rgba(21, 34, 38, 0.09);
  --shadow-strong: 0 16px 36px rgba(21, 34, 38, 0.16);
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 85% 8%, rgba(190, 106, 31, 0.2), transparent 28%),
    radial-gradient(circle at 12% 26%, rgba(0, 75, 87, 0.14), transparent 34%),
    var(--bg-main);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

.topbar {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  padding: 0.65rem 1rem 0.6rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(160deg, #f4efe6 0%, #ece4d4 100%);
  box-shadow: 0 2px 8px rgba(21, 34, 38, 0.06);
  animation: fade-up 0.45s ease both;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    -32deg,
    rgba(255, 255, 255, 0.09),
    rgba(255, 255, 255, 0.09) 3px,
    transparent 3px,
    transparent 16px
  );
  pointer-events: none;
  z-index: -1;
}

.brand-logo {
  display: block;
  width: min(180px, 48vw);
  height: auto;
  border-radius: 0.35rem;
}

.topbar p {
  margin: 0.15rem 0 0;
  max-width: 65ch;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.topbar h1 {
  margin: 0.25rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1rem, 2.8vw, 1.4rem);
  letter-spacing: 0.01em;
}

.hero-meta {
  margin-top: 0.3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: rgba(190, 106, 31, 0.08);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-soft);
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.filters {
  margin-bottom: 1.1rem;
  display: grid;
  gap: 0.5rem;
  animation: fade-up 0.5s ease both;
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-top-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
}

#copy-link {
  margin-top: 0;
}

/* ── Collapsible extras ── */
.filter-extras {
  border: none;
  padding: 0;
}

.filter-extras summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.2rem 0;
  list-style: none;
}

.filter-extras summary::-webkit-details-marker {
  display: none;
}

.filter-extras summary::after {
  content: "▸";
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.filter-extras[open] summary::after {
  transform: rotate(90deg);
}

.filter-extras .filter-row {
  margin-top: 0.35rem;
}

/* ── Shared button / input base (small reset) ── */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

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

/* ── Filter-scoped form elements ── */
.filters label {
  font-weight: 600;
  margin-right: 0.2rem;
  font-size: 0.85rem;
}

.filters select,
.filters input[type="search"] {
  padding: 0.42rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #c7ba9f;
  background: #fffdf8;
  min-width: 140px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  color: var(--ink);
  font-size: 0.88rem;
  font-family: inherit;
}

.filters select:focus,
.filters input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(190, 106, 31, 0.2);
}

.filters button {
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid #c7ba9f;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.filters button:hover:not(:disabled) {
  background: #fff5e7;
  border-color: #be9f70;
}

.filters button:active:not(:disabled) {
  transform: translateY(1px);
}

/* ── Shared .button-primary (usable anywhere) ── */
.button-primary {
  display: inline-block;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.button-primary:hover:not(:disabled) {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

button:focus-visible,
.post-link:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(190, 106, 31, 0.2);
}

/* ── Pagination buttons ── */
.pagination button {
  padding: 0.45rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid #c7ba9f;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.pagination button:hover:not(:disabled) {
  background: #fff5e7;
  border-color: #be9f70;
}

/* ── Empty state / retry ── */
.empty-state button {
  margin-top: 0.6rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
}

.quick-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-category {
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  border: 1px solid #b5d2d6;
  background: #ecf8fa;
  color: #17454d;
  font-size: 0.82rem;
}

.quick-category.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.post-panel {
  padding-top: 0.85rem;
  animation: fade-up 0.58s ease both;
}

/* ── Install guide ── */
.install-guide {
  margin: 0 0 1rem;
  padding: 1.1rem 1rem 0.9rem;
  border-radius: 0.9rem;
  border: 1px solid #8ac5b0;
  background: linear-gradient(160deg, #eefbf4 0%, #f7fdf9 100%);
  color: #1a3d2b;
  font-size: 0.9rem;
  animation: fade-up 0.45s ease both;
  box-shadow: 0 6px 18px rgba(16, 109, 70, 0.08);
}

.ig-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ig-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.1rem;
  color: #0f5132;
}

.ig-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: none;
  background: rgba(15, 81, 50, 0.1);
  color: #0f5132;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ig-close:hover {
  background: rgba(15, 81, 50, 0.18);
}

.ig-subtitle {
  margin: 0.35rem 0 0.8rem;
  color: #3d6b52;
  font-size: 0.86rem;
}

.ig-steps {
  display: grid;
  gap: 0.55rem;
}

.ig-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #c6e4d4;
  border-radius: 0.6rem;
}

.ig-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f5132;
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 50%;
}

.ig-step-body {
  flex: 1;
  min-width: 0;
}

.ig-step-body strong {
  display: block;
  font-size: 0.9rem;
  color: #152226;
  line-height: 1.3;
}

.ig-step-desc {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: #4d7a62;
  line-height: 1.35;
}

.ig-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: -2px;
  margin-left: 2px;
}

.ig-footer {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  color: #6b9e80;
  text-align: center;
}

#reset-install-guide {
  white-space: nowrap;
}

.result-summary {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.93rem;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.post-card {
  background: #fffefc;
  border: 1px solid #d7c8aa;
  border-radius: 0.75rem;
  overflow: hidden;
  display: grid;
  grid-template-columns: 220px 1fr;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  opacity: 0;
  transform: translateY(12px);
  animation: card-in 0.42s ease forwards;
  animation-delay: var(--delay, 0ms);
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: #be9f70;
  box-shadow: var(--shadow-strong);
}

.post-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
  background: #e2e8f0;
}

.post-content {
  padding: 1rem;
}

.post-title {
  margin: 0 0 0.15rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.3;
}

.post-meta {
  margin: 0.5rem 0;
  color: #486067;
  font-size: 0.9rem;
}

.post-excerpt {
  margin: 0 0 0.75rem;
  color: #33484e;
  line-clamp: 3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-link {
  display: inline-block;
  padding: 0.62rem 1rem;
  border-radius: 0.55rem;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.14s ease;
}

.post-link:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.post-link:active {
  transform: translateY(1px);
}

.status {
  margin-top: 1rem;
  color: var(--ink-soft);
  min-height: 1.3rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  animation: fade-up 0.68s ease both;
}

#page-info {
  color: #33545c;
  min-width: 7.5rem;
  text-align: center;
}

.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: #4c5f63;
  border: 1px dashed #c8b596;
  border-radius: 0.75rem;
  background: #fff9ed;
}

.skeleton-card {
  min-height: 170px;
  position: relative;
}

.skeleton-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #ecdac0 8%, #fffaf0 18%, #ecdac0 33%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
}

@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--brand-strong);
  color: #fff;
  padding: 0.62rem 0.85rem;
  border-radius: 0.5rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 12px 24px rgba(21, 34, 38, 0.3);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  background: #106d46;
}

.toast.toast-error {
  background: #9f3519;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 4.4rem;
  z-index: 5;
  border-radius: 999px;
  padding: 0.58rem 0.86rem;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 8px 18px rgba(190, 106, 31, 0.3);
}

.back-to-top:hover:not(:disabled) {
  background: #a95c1b;
  border-color: #a95c1b;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(13px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 700px) {
  .container {
    padding-top: 0.8rem;
  }

  .topbar {
    padding: 0.5rem 0.75rem 0.45rem;
  }

  .topbar p {
    font-size: 0.78rem;
    margin-top: 0.1rem;
  }

  .topbar h1 {
    margin-top: 0.2rem;
    font-size: 0.95rem;
  }

  .hero-pill {
    font-size: 0.68rem;
    padding: 0.18rem 0.45rem;
  }

  .brand-logo {
    width: min(140px, 40vw);
  }

  .panel {
    padding: 0.65rem;
  }

  .filters {
    gap: 0.35rem;
  }

  .filter-row {
    gap: 0.3rem;
  }

  .filters label {
    display: none;
  }

  .filters select,
  .filters input[type="search"] {
    min-width: 0;
    flex: 1;
    font-size: 0.84rem;
    padding: 0.38rem 0.45rem;
  }

  .filters button {
    padding: 0.36rem 0.55rem;
    font-size: 0.8rem;
  }

  .post-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .post-image {
    width: 100%;
    height: 190px;
    min-height: 190px;
    max-height: 190px;
    object-position: top left;
  }

  .post-content {
    position: relative;
    z-index: 1;
    background: #fffefc;
    padding: 0.8rem;
  }

  .post-title {
    font-size: 1rem;
    margin-bottom: 0.1rem;
  }

  .post-meta {
    margin: 0.35rem 0;
    font-size: 0.82rem;
  }

  .post-excerpt {
    margin-bottom: 0.6rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    font-size: 0.92rem;
  }

  .post-link {
    width: 100%;
    text-align: center;
    font-size: 0.97rem;
    padding: 0.66rem 0.9rem;
  }

  #page-info {
    min-width: auto;
  }

  .pagination {
    justify-content: space-between;
  }

  .back-to-top {
    right: 0.7rem;
    bottom: 4.2rem;
  }
}
