/* Blog pages — builds on styles.css, keeps the same look as the top page */
.blog-main {
  padding-top: 79px;
  min-height: 70vh;
}

.blog-title {
  margin-bottom: 16px;
  font-size: clamp(28px, 4.4vw, 46px);
}

.blog-hero {
  padding-bottom: 32px;
  background: var(--sand);
  border-bottom: 1px solid var(--line);
}

.blog-hero .large-text {
  max-width: 760px;
}

.blog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.blog-filter {
  padding: 7px 16px;
  border: 1px solid rgba(36, 89, 72, 0.24);
  border-radius: 999px;
  color: var(--leaf);
  background: #fff;
  font-size: 14px;
  font-weight: 700;
}

.blog-filter.is-active {
  color: #fff;
  background: var(--leaf);
}

.blog-list-section {
  padding-top: 48px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.blog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.blog-card a {
  display: block;
  height: 100%;
}

.blog-card img,
.blog-card-noimage {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.blog-card-noimage {
  display: grid;
  place-items: center;
  background: var(--leaf-soft);
}

.blog-card-noimage img {
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
}

.blog-card-body {
  padding: 18px 20px 22px;
}

.blog-card h3 {
  margin-bottom: 8px;
  font-size: 19px;
}

.blog-card-body > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.blog-category {
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--leaf);
  background: var(--leaf-soft);
  font-weight: 700;
}

.blog-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
  color: var(--muted);
}

.blog-empty {
  display: grid;
  justify-items: start;
  gap: 12px;
  color: var(--muted);
}

/* Article */
.blog-article {
  max-width: 860px;
  margin: 0 auto;
}

.blog-back {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--leaf);
  font-size: 14px;
  font-weight: 700;
}

.blog-cover {
  margin: 8px 0 32px;
}

.blog-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 620px;
  object-fit: cover;
  border-radius: 8px;
}

.blog-content {
  font-size: 17px;
  line-height: 2;
}

.blog-content p {
  margin-bottom: 1.4em;
}

.blog-content a {
  color: var(--leaf);
  text-decoration: underline;
  word-break: break-all;
}

.blog-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 32px 0;
}

.blog-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}

.blog-cta {
  margin-top: 56px;
  padding: 32px clamp(20px, 4vw, 40px);
  border-radius: 8px;
  background: var(--sand);
  border: 1px solid var(--line);
}

.blog-cta h2 {
  font-size: clamp(24px, 3vw, 32px);
}

/* Admin */
.admin-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 111px clamp(16px, 4vw, 32px) 64px;
}

.admin-card {
  max-width: 520px;
  margin: 0 auto;
}

.admin-form {
  padding: clamp(18px, 4vw, 32px);
}

.admin-form .form-field {
  margin-bottom: 18px;
}

.admin-loading {
  color: var(--muted);
  text-align: center;
}

.admin-nav {
  gap: 16px;
}

.admin-link {
  padding: 0;
  border: 0;
  color: var(--leaf);
  background: none;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.admin-danger {
  color: #b2453a;
}

.admin-toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 12px 22px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-weight: 700;
  white-space: nowrap;
}

.admin-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-posts {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-post {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-post img,
.admin-post-noimg {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
}

.admin-post-noimg {
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--leaf-soft);
  font-size: 11px;
}

.admin-post-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-post-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-post-text small {
  color: var(--muted);
}

.admin-post-empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.admin-badge {
  justify-self: start;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #eee9df;
  font-size: 12px;
  font-weight: 700;
}

.admin-badge.is-published {
  color: #fff;
  background: var(--coral);
}

.admin-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.admin-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--leaf-soft);
}

.admin-photo.is-loading {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.admin-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-photo-cover {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--coral);
  font-size: 11px;
  font-weight: 700;
}

.admin-photo-btn {
  position: absolute;
  left: 6px;
  bottom: 6px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  cursor: pointer;
}

.admin-photo-remove {
  left: auto;
  right: 6px;
  top: 6px;
  bottom: auto;
  color: var(--ink);
  font-size: 18px;
}

.admin-photo-add {
  cursor: pointer;
}

.admin-editor textarea {
  min-height: 280px;
  font-size: 16px;
}

.admin-editor input,
.admin-editor select {
  font-size: 16px; /* prevents iOS zoom on focus */
}

.admin-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-editor-actions .button {
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-editor-actions .button.secondary {
  border: 1px solid rgba(36, 89, 72, 0.22);
}

.admin-editor-actions .button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.admin-editor .form-status {
  margin-top: 12px;
}

.admin-editor-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}


/* Admin — view history */
.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-head-actions .button.secondary {
  border: 1px solid rgba(36, 89, 72, 0.22);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin-period {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.admin-period-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.admin-period-btn.is-active {
  color: #fff;
  background: var(--leaf);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.admin-stat {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-stat strong {
  color: var(--ink);
  font-size: clamp(22px, 3.4vw, 30px);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.admin-panel {
  margin-bottom: 16px;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-panel-title {
  margin: 0 0 14px;
  font-size: 16px;
}

.admin-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-panel-grid .admin-panel {
  margin-bottom: 0;
}

.admin-panel-grid + .admin-panel {
  margin-top: 16px;
}

.admin-chart-bars {
  display: grid;
  grid-template-columns: repeat(var(--count), minmax(0, 1fr));
  align-items: end;
  gap: 2px;
  height: 180px;
  border-bottom: 1px solid var(--line);
}

.admin-chart-col {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.admin-chart-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--leaf);
}

.admin-chart-bar.is-zero {
  background: var(--leaf-soft);
}

.admin-chart-col:hover .admin-chart-bar {
  background: var(--coral);
}

.admin-chart-label {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.admin-chart-max {
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.admin-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-table-title {
  display: block;
  text-align: left;
}

.admin-table small {
  color: var(--muted);
}

.admin-table-date {
  color: var(--muted);
  white-space: nowrap;
}

.admin-history {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.admin-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.admin-history li:last-child {
  border-bottom: 0;
}

.admin-history time {
  flex: 0 0 auto;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.admin-history-title {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.admin-history-meta {
  color: var(--muted);
}

.admin-history-empty {
  padding: 18px 0;
  color: var(--muted);
  text-align: center;
}

.admin-breakdown {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.admin-breakdown li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
}

.admin-breakdown-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-breakdown-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.admin-breakdown-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--leaf-soft);
}

.admin-breakdown-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--leaf);
}

.admin-detail-title {
  font-size: clamp(22px, 3.4vw, 34px);
}

.admin-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .blog-main,
  .admin-main {
    padding-top: 0;
  }

  .admin-main {
    padding-top: 24px;
  }
}

@media (max-width: 560px) {
  .blog-pager .button {
    min-height: 42px;
    padding: 8px 14px;
    font-size: 14px;
  }

  .admin-editor-actions {
    grid-template-columns: 1fr;
  }

  .admin-list-head .button,
  .admin-head-actions {
    width: 100%;
  }

  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-panel-grid {
    grid-template-columns: 1fr;
  }

  .admin-period {
    width: 100%;
  }

  .admin-period-btn {
    flex: 1;
  }

  .admin-chart-bars {
    height: 140px;
  }

  .admin-table-date {
    display: none;
  }

  .admin-table th:last-child {
    display: none;
  }
}
