/* ===========================================================
   MyAds. — Blog styles
   =========================================================== */

/* ---------- Section heading helper ---------- */
.section-h2 {
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 8px 0 14px;
}
.section-h2 em { font-style: normal; color: var(--accent); }
.section-h2.small { font-size: clamp(28px, 3vw, 40px); margin-bottom: 24px; }
.section-sub {
  color: var(--ink-2);
  font-size: 17px;
  max-width: 56ch;
  line-height: 1.5;
}

/* ---------- Blog teaser on home ---------- */
.blog-teaser-section { background: var(--bg-2); }
.blog-teaser-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.blog-teaser-head .section-h2 { margin-bottom: 8px; }

/* ---------- Grid of cards ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
@media (max-width: 980px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; }
}

/* ---------- Post card ---------- */
.post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: transform 240ms ease, border-color 220ms ease, box-shadow 240ms ease;
  position: relative;
  isolation: isolate;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink);
  box-shadow: 0 18px 38px -22px rgba(12,31,26,0.35);
}
.post-cover,
.blog-cover-ph {
  aspect-ratio: 16 / 10;
  width: 100%;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}
.blog-cover-ph {
  display: grid;
  place-items: center;
}
.bcph-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 1px;
  opacity: 0.18;
}
.bcph-grid span {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.bcph-tag {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.post-meta .post-cat { color: var(--accent); font-weight: 600; }
.post-meta .post-dot { opacity: 0.5; }

.post-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 0 22px;
  margin: 0;
  text-wrap: pretty;
}
.post-excerpt {
  padding: 0 22px;
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 22px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 16px;
}
.author-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}
.post-author { flex: 1; min-width: 0; }
.post-author .pa-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.post-author .pa-role {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.post-arrow {
  color: var(--ink-3);
  font-size: 18px;
  transition: transform 200ms ease, color 200ms ease;
}
.post-card:hover .post-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ---------- Featured post (blog index) ---------- */
.blog-featured {
  margin-bottom: 36px;
}
.post-card.featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: stretch;
}
.post-card.featured .post-cover,
.post-card.featured .blog-cover-ph {
  aspect-ratio: auto;
  height: 100%;
  min-height: 320px;
}
.post-card.featured .post-meta { padding-top: 32px; }
.post-card.featured .post-title {
  font-size: clamp(26px, 2.5vw, 36px);
  padding-top: 12px;
}
.post-card.featured .post-excerpt {
  font-size: 16px;
  -webkit-line-clamp: 4;
}
@media (max-width: 820px) {
  .post-card.featured { grid-template-columns: 1fr; }
  .post-card.featured .post-cover,
  .post-card.featured .blog-cover-ph { min-height: 220px; }
  .post-card.featured .post-meta { padding-top: 22px; }
}

/* ---------- Blog index page ---------- */
.blog-page { display: block; }
.blog-hero {
  padding: clamp(80px, 11vw, 130px) 0 48px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.blog-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 160ms ease;
}
.blog-back:hover { color: var(--accent); }
.blog-h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 12px 0 18px;
  text-wrap: balance;
}
.blog-h1 em { font-style: normal; color: var(--accent); }
.blog-sub {
  color: var(--ink-2);
  font-size: clamp(16px, 1.4vw, 19px);
  max-width: 60ch;
  line-height: 1.5;
}

/* ---------- Toolbar (categories + search) ---------- */
.blog-toolbar {
  position: sticky;
  top: 64px;
  z-index: 40;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.blog-toolbar .container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.blog-cats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.blog-cat {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
}
.blog-cat:hover { border-color: var(--ink); color: var(--ink); }
.blog-cat.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.blog-search {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 360px;
  margin-left: auto;
}
.bs-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 16px;
}
.blog-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  transition: all 180ms ease;
}
.blog-search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 18%, transparent);
}

.blog-empty {
  padding: 80px 0;
  text-align: center;
  color: var(--ink-3);
  font-style: italic;
  font-size: 15px;
}

/* ===========================================================
   Article page
   =========================================================== */
.article-container {
  max-width: 760px;
  margin: 0 auto;
}
.article-hero {
  padding: clamp(60px, 9vw, 110px) 0 32px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg) 80%);
  border-bottom: 1px solid var(--line);
}
.article-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.article-meta-top .post-cat { color: var(--accent); font-weight: 600; }
.article-meta-top .post-dot { opacity: 0.5; }

.article-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  text-wrap: balance;
}
.article-excerpt {
  font-size: clamp(17px, 1.3vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 36px;
  text-wrap: pretty;
}
.article-author {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.article-author > .author-avatar { width: 44px; height: 44px; font-size: 14px; }
.article-author .pa-name { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.article-author .pa-role {
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.article-share { margin-left: auto; }
.share-btn {
  border: 1px solid var(--line-2);
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 160ms ease;
}
.share-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* ---------- Article body ---------- */
.article-body {
  padding: clamp(40px, 6vw, 80px) 0;
}
.article-body h1,
.article-body h2,
.article-body h3 {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.article-body h1 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.1;
  margin: 56px 0 20px;
}
.article-body h2 {
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.15;
  margin: 48px 0 16px;
}
.article-body h3 {
  font-size: clamp(19px, 1.7vw, 22px);
  line-height: 1.2;
  margin: 36px 0 12px;
}
.article-body p {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 22px;
  text-wrap: pretty;
}
.article-body p > strong { color: var(--ink); font-weight: 700; }
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--ink);
}
.article-body ul {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
  margin: 0 0 24px;
  padding-left: 22px;
}
.article-body ul li { margin-bottom: 8px; }
.article-body ul li::marker { color: var(--accent); }
.article-body blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  font-family: var(--serif);
  font-size: clamp(19px, 1.6vw, 23px);
  line-height: 1.45;
  color: var(--ink);
  font-style: italic;
  border-radius: 0 8px 8px 0;
}
.article-body blockquote em { font-style: italic; color: var(--ink-3); font-size: 0.78em; display: block; margin-top: 12px; }
.article-body img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 28px 0;
  border: 1px solid var(--line);
}
.article-body hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: 48px 0;
}
.md-table-wrap {
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 14.5px;
}
.md-table th,
.md-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.md-table th {
  background: var(--bg-2);
  font-weight: 700;
  color: var(--ink);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.md-table tr:last-child td { border-bottom: 0; }
.md-table td { color: var(--ink-2); }
.md-table td strong { color: var(--ink); }

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.article-tags .tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
}

/* ---------- Article CTA ---------- */
.article-cta {
  padding: 0 0 clamp(40px, 6vw, 80px);
}
.acta-card {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
.acta-card h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 30px);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--bg);
}
.acta-card p {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.5;
  color: rgba(255,255,255,0.78);
  max-width: 56ch;
}
.acta-card .btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  flex-shrink: 0;
}
.acta-card .btn-primary:hover { background: #fff; color: var(--ink); border-color: #fff; }

/* ---------- Related ---------- */
.article-related {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}

/* ===========================================================
   Blog Composer (#blog-admin)
   =========================================================== */
.ba-hero { padding-bottom: 36px; }
.ba-shell { padding-top: 40px; }
.ba-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 980px) { .ba-grid { grid-template-columns: 1fr; } }

.ba-editor { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.ba-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
}
.ba-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.ba-card-head h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.ba-count {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  padding: 2px 10px;
}
.ba-badge-edit {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.ba-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.ba-field label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ba-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ba-field-sm { max-width: 100%; }
@media (max-width: 560px) { .ba-row2 { grid-template-columns: 1fr; } }
.ba-body { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; }
select.cf-input { appearance: none; background-image: none; cursor: pointer; }

/* language tabs */
.ba-langtabs {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin: 8px 0 18px;
  padding-top: 18px;
}
.ba-langtab {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 160ms ease;
}
.ba-langtab:hover { border-color: var(--ink); }
.ba-langtab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ba-langadd { display: flex; gap: 14px; margin-left: auto; }
.ba-langadd label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
}
.ba-langadd label.on { color: var(--accent-deep); }
.ba-langadd input { accent-color: var(--accent); }

.ba-loc { display: flex; flex-direction: column; }
.ba-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.ba-spacer { flex: 1; }

/* article list */
.ba-list { display: flex; flex-direction: column; }
.ba-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.ba-item:first-child { border-top: 0; }
.ba-item-main { flex: 1; min-width: 0; }
.ba-item-title { font-weight: 600; color: var(--ink); font-size: 15px; }
.ba-item-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}
.ba-tagcat { color: var(--accent-deep); }
.ba-lc {
  background: var(--bg-3);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.05em;
}
.ba-item-act { display: flex; gap: 12px; flex-shrink: 0; }
.ba-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.ba-link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.ba-del:hover { color: #b4322a; border-bottom-color: #b4322a; }
.ba-muted { color: var(--ink-3); font-size: 13.5px; line-height: 1.5; }
.ba-filenote { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-2); }

/* preview */
.ba-preview { min-width: 0; }
.ba-preview-sticky { position: sticky; top: 90px; }
.ba-preview-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.ba-preview-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px;
  max-height: calc(100vh - 140px);
  overflow: auto;
}
.ba-pv-title { font-size: clamp(26px, 3vw, 38px); margin: 12px 0 0; }
.ba-pv-author { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ba-pv-body { padding: 8px 0 0; }
.ba-pv-body .container, .ba-pv-body.article-body { padding: 0; }
.ba-pv-body :first-child { margin-top: 0; }

/* export/import modal */
.ba-modal-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(12, 31, 26, 0.55);
  display: grid; place-items: center;
  padding: 24px;
}
.ba-modal {
  position: relative;
  background: var(--bg);
  border-radius: 16px;
  padding: 30px;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
}
.ba-modal h3 { font-family: var(--serif); font-weight: 700; font-size: 26px; margin-bottom: 10px; }
.ba-io { font-family: var(--mono); font-size: 12px; line-height: 1.5; margin: 14px 0; }

/* toast */
.ba-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 1300;
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 22px;
  border-radius: 999px;
  color: #fff;
  box-shadow: 0 10px 30px rgba(12, 31, 26, 0.25);
  animation: baToastIn 220ms ease;
}
.ba-toast.ok { background: var(--accent-deep); }
.ba-toast.err { background: #b4322a; }
@keyframes baToastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
