/* UltraTools AI — blog index and articles (Flip7 system, builds on site.css) */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-small); font-weight: 700; color: var(--neutral); }
.crumbs a { color: var(--link); }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); }

/* ============ BLOG INDEX ============ */
.blog-hero { padding: 40px 0 36px; background: var(--bg-alt); border-bottom: 2px dashed var(--border-strong); }
.blog-hero .crumbs { margin-bottom: 24px; }
.blog-hero h1 { max-width: 820px; }
.blog-hero .sub { max-width: 720px; }
.blog-chips { margin-top: 28px; }
.blog-list { padding-top: 48px; }

/* Latest post: large featured card */
.latest-head { margin-bottom: 16px; }
.latest-head .overline { margin-bottom: 0; }
.latest-card {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); overflow: hidden;
  background: var(--surface); border-radius: var(--r-lg); border-inline-start: 4px solid var(--gold);
  box-shadow: var(--shadow-accent-glow), var(--shadow-card);
  transition: transform var(--ease-bounce), box-shadow var(--ease);
}
.latest-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-accent-glow), var(--shadow-hover); }
/* The image fills the left column at the height of the text, cropped, so it never dominates the card */
.latest-thumb { position: relative; min-height: 240px; overflow: hidden; background: var(--teal-bg); border-inline-end: 2px dashed var(--border-strong); }
.latest-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; transition: transform .4s ease; }
.latest-card:hover .latest-thumb img { transform: scale(1.03); }
.latest-body { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 30px 32px; }
.latest-body .post-badge { position: static; align-self: flex-start; }
.latest-body h2 { font-size: 26px; line-height: 1.2; }
.latest-body p { color: var(--text-2); font-size: 15px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.latest-body .btn { margin-top: 6px; }

/* Latest posts list in the article sidebar */
.latest { padding: 20px 22px; background: var(--surface); border-radius: var(--r-lg); border-inline-start: 4px solid var(--coral); box-shadow: var(--shadow-card); }
.latest ul { display: grid; gap: 4px; }
.latest a { display: flex; gap: 12px; align-items: center; padding: 6px; border-radius: var(--r-md); font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text-2); transition: background-color var(--ease), color var(--ease); }
.latest a:hover { background: var(--bg-alt); color: var(--text); }
.latest img { flex: none; width: 64px; height: 40px; object-fit: cover; object-position: top left; border-radius: var(--r-sm); border: 1px solid var(--border); }

.editorial {
  margin-top: 48px; padding: 28px 32px; border-radius: var(--r-lg);
  background: var(--surface); border-inline-start: 4px solid var(--gold); box-shadow: var(--shadow-card);
}
.editorial h2 { font-size: 20px; margin-bottom: 8px; }
.editorial p { color: var(--text-2); max-width: 900px; }

/* ============ ARTICLE ============ */
.post-hero { padding: 40px 0 44px; background: var(--bg-alt); border-bottom: 2px dashed var(--border-strong); }
.post-hero-inner { max-width: 900px; }
.post-hero .crumbs { margin-bottom: 24px; }
.post-cat {
  display: inline-block; margin-bottom: 14px; padding: 3px 14px; border-radius: var(--r-round);
  background: var(--teal); color: #fff; font-size: var(--fs-caption); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.post-hero h1 { line-height: 1.12; }
.post-lede { margin-top: 16px; font-size: 19px; line-height: 1.6; color: var(--text-2); }
.post-meta { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--fs-small); color: var(--text-2); }
.post-meta strong { color: var(--text); font-weight: 800; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; align-items: start; padding-top: 44px; padding-bottom: 24px; }

.post-body {
  min-width: 0; padding: 40px 48px; background: var(--surface); border-radius: var(--r-lg);
  border-inline-start: 4px solid var(--teal-light); box-shadow: var(--shadow-card);
  font-size: 17px; line-height: 1.8; color: var(--text);
}
.post-body > :first-child { margin-top: 0; }
.post-body p, .post-body ul, .post-body ol, .post-body table, .post-body pre, .post-body blockquote { margin: 0 0 1.2em; }
.post-body h2 {
  margin: 1.9em 0 .7em; padding-bottom: 10px; font-size: 27px; line-height: 1.25;
  border-bottom: 2px dashed var(--border-strong); scroll-margin-top: 96px;
}
.post-body h3 { margin: 1.5em 0 .5em; font-size: 20px; line-height: 1.3; }
.post-body strong { font-weight: 800; }
.post-body a:not(.btn) { color: var(--link); font-weight: 700; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.post-body a:not(.btn):hover { text-decoration-color: currentColor; }
.post-body ul, .post-body ol { padding-inline-start: 1.4em; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li + li { margin-top: .45em; }
.post-body li::marker { color: var(--teal); font-weight: 800; }
.post-body code { font-family: var(--font-mono); font-size: .86em; background: var(--chip-bg); color: var(--chip-text); padding: 2px 6px; border-radius: var(--r-sm); overflow-wrap: anywhere; }
.post-body pre {
  padding: 16px 20px; overflow-x: auto; border-radius: var(--r-md);
  background: var(--ink); color: #E8F6F5; font-size: 14px; line-height: 1.6;
}
.post-body pre code { background: none; color: inherit; padding: 0; font-size: inherit; overflow-wrap: normal; }
.post-body kbd {
  display: inline-block; padding: 0 7px; border-radius: var(--r-sm); border: 2px solid var(--ink); border-bottom-width: 3px;
  background: var(--cream); color: var(--ink); font-family: var(--font-mono); font-size: .8em; font-weight: 700; line-height: 1.6;
}
.post-body table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; display: block; overflow-x: auto; }
.post-body th, .post-body td { padding: 10px 14px; text-align: start; vertical-align: top; border-bottom: 2px dashed var(--border); }
.post-body th { background: var(--teal-bg); color: var(--teal-dark); font-weight: 800; border-bottom: 2px solid var(--teal-light); white-space: nowrap; }
:root[data-theme="dark"] .post-body th { background: var(--bg-alt); color: var(--teal-light); }

/* Answer-first summary box at the top of each article */
.post-body .tldr {
  padding: 20px 24px; border-radius: var(--r-md); background: var(--teal-bg); border-inline-start: 4px solid var(--teal);
  font-size: 16px;
}
:root[data-theme="dark"] .post-body .tldr { background: var(--bg-alt); }
.post-body .tldr-title { margin-bottom: 6px; font-size: var(--fs-caption); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-dark); }
:root[data-theme="dark"] .post-body .tldr-title { color: var(--teal-light); }
.post-body .tldr p:last-child, .post-body .tldr ul:last-child { margin-bottom: 0; }

/* Tool screenshot */
.post-figure { margin: 2em 0; }
.post-figure a { display: block; border-radius: var(--r-lg); overflow: hidden; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); background: var(--bg); transition: transform var(--ease-bounce); }
.post-figure a:hover { transform: translateY(-2px); }
.post-figure img { display: block; width: 100%; height: auto; }
.post-figure figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--text-2); text-align: center; }
.post-figure figcaption a { display: inline; border: 0; box-shadow: none; background: none; border-radius: 0; }

.post-body .note, .post-body .warn {
  padding: 16px 20px; border-radius: var(--r-md); font-size: 16px;
  background: var(--cream); border-inline-start: 4px solid var(--gold); color: var(--ink);
}
.post-body .warn { border-inline-start-color: var(--coral); }
.post-body .note strong, .post-body .warn strong { color: var(--ink); }
.post-body .note a:not(.btn), .post-body .warn a:not(.btn) { color: var(--teal-dark); }

/* Inline tool call-to-action */
.post-cta {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  margin: 2em 0; padding: 20px 22px; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--cream) 0%, var(--surface) 70%);
  border: 2px solid var(--gold); box-shadow: var(--shadow-accent-glow);
}
:root[data-theme="dark"] .post-cta { background: linear-gradient(160deg, #2C3A26 0%, var(--surface) 70%); }
.post-cta p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.post-cta .post-cta-title { font-size: 17px; font-weight: 800; color: var(--text); }
.post-cta .tool-icon { width: 52px; height: 52px; }

.post-end { margin-top: 2.4em; padding-top: 20px; border-top: 2px dashed var(--border-strong); font-size: 14px; color: var(--text-2); }
.post-end p { margin: 0; }

/* Sidebar */
.post-side { display: grid; gap: 20px; }
.toc { padding: 20px 22px; background: var(--surface); border-radius: var(--r-lg); border-inline-start: 4px solid var(--teal-light); box-shadow: var(--shadow-card); }
.toc-title { margin-bottom: 10px; font-size: var(--fs-caption); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--neutral); }
.toc ol { display: grid; gap: 2px; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: flex; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text-2);
  transition: background-color var(--ease), color var(--ease);
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-family: var(--font-mono); font-size: 12px; color: var(--teal); padding-top: 1px; }
.toc a:hover { background: var(--bg-alt); color: var(--text); }

.side-tool {
  display: grid; justify-items: start; gap: 6px; padding: 22px; border-radius: var(--r-lg);
  background: var(--surface); border-inline-start: 4px solid var(--gold); box-shadow: var(--shadow-card);
  transition: transform var(--ease-bounce), box-shadow var(--ease);
}
.side-tool:hover { transform: translateY(-3px); box-shadow: var(--shadow-accent-glow), var(--shadow-hover); }
.side-tool[data-cat="image"], .post-card[data-cat="image"] { --cat: var(--coral); }
.side-tool[data-cat="text"] { --cat: var(--teal); }
.side-tool[data-cat="extract"] { --cat: var(--sky); }
.side-tool[data-cat="dev"] { --cat: var(--gold-dark); }
.side-tool .tool-icon { width: 48px; height: 48px; margin-bottom: 6px; }
.side-tool-name { font-size: 17px; font-weight: 800; color: var(--text); }
.side-tool-sub { font-size: var(--fs-small); color: var(--text-2); margin-bottom: 8px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: 1fr; gap: 24px; }
  .post-side { position: static; order: -1; }
  .side-tool { display: none; }
  .latest { display: none; }
}
@media (max-width: 640px) {
  .blog-hero, .post-hero { padding: 24px 0 28px; }
  .post-lede { font-size: 17px; }
  .post-body { padding: 24px 20px; font-size: 16px; }
  .post-body h2 { font-size: 23px; }
  .post-cta { grid-template-columns: 1fr; text-align: start; }
  .editorial { padding: 22px 20px; }
  .latest-card { grid-template-columns: 1fr; }
  .latest-thumb { min-height: 0; height: 180px; border-inline-end: 0; border-bottom: 2px dashed var(--border-strong); }
  .latest-body { padding: 22px 20px; }
  .latest-body h2 { font-size: 21px; }
}
