/* Blog pages (generated by the API in /api). Loaded after styles.css. */

/* There is no scroll script on these pages, so the nav keeps its glass background. */
.blog .nav {
  border-bottom-color: var(--line);
}

.blog .nav::before {
  opacity: 1;
}

.blog main {
  padding-top: calc(var(--nav-h) + var(--subnav-h, 0px) + env(safe-area-inset-top));
}

/* Gentle entrance: pure CSS, so content is never hidden if anything fails. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.blog-head > *,
.cats,
.post-list > li,
.post__head > *,
.post__cover,
.prose {
  animation: rise 0.7s var(--ease) both;
}

.cats { animation-delay: 90ms; }
.blog-head > :nth-child(2),
.post__head > :nth-child(2) { animation-delay: 60ms; }
.post__head > :nth-child(3) { animation-delay: 120ms; }
.post__head > :nth-child(n + 4) { animation-delay: 180ms; }
.post__cover { animation-delay: 220ms; }
.prose { animation-delay: 260ms; }
.post-list > li:nth-child(1) { animation-delay: 120ms; }
.post-list > li:nth-child(2) { animation-delay: 180ms; }
.post-list > li:nth-child(3) { animation-delay: 240ms; }
.post-list > li:nth-child(n + 4) { animation-delay: 300ms; }

/* ---------- Breadcrumbs ---------- */

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 10px;
  color: var(--dim);
  font-size: 0.875rem;
  font-weight: 500;
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.crumbs a:hover {
  color: var(--text);
}

/* ---------- Category chips ---------- */

.cats {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.cat-chips {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter);
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cat-chips::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.cat-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.cat-chip[aria-current="page"] {
  border-color: transparent;
  background: var(--text);
  color: #000;
}

/* Shown in English: posts are only written in Portuguese. */
.lang-note {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.lang-note p {
  padding-block: 12px;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Subcategories: text tabs on a hairline, a level below the chips. */
.cat-tabs {
  display: flex;
  gap: 24px;
  margin: 16px calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  list-style: none;
  scrollbar-width: none;
}

.cat-tabs::-webkit-scrollbar {
  display: none;
}

.cat-tab {
  position: relative;
  display: inline-block;
  padding: 10px 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.cat-tab:hover {
  color: var(--text);
}

.cat-tab[aria-current="page"] {
  color: var(--text);
}

.cat-tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}

/* ---------- Listing ---------- */

.blog-head {
  padding-block: clamp(56px, 9vw, 120px) clamp(32px, 5vw, 56px);
}

.blog-head__title {
  padding-right: 0.06em;
  font-size: clamp(3rem, 11vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
}

.blog-head--cat {
  padding-top: clamp(32px, 6vw, 72px);
}

.blog-head--cat .crumbs {
  margin-bottom: 6px;
}

.blog-head--cat .blog-head__title {
  font-size: clamp(2.5rem, 8vw, 4.75rem);
  letter-spacing: -0.045em;
}

.blog-head__lead {
  max-width: 34em;
  margin-top: 20px;
  color: var(--muted);
  font-size: clamp(1.125rem, 2.2vw, 1.3125rem);
  text-wrap: pretty;
}

.post-list {
  display: grid;
  gap: 14px;
  margin: 0 0 clamp(64px, 9vw, 120px);
  padding: 0;
  list-style: none;
}

.post-card {
  display: grid;
  gap: 10px;
  padding: clamp(22px, 3.4vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.25s ease, transform 0.35s var(--ease), background-color 0.25s ease;
}

.post-card__meta {
  color: var(--dim);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.post-card__cat {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

.post-card__title {
  font-size: clamp(1.375rem, 3vw, 1.875rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.post-card__text {
  max-width: 44em;
  color: var(--muted);
  text-wrap: pretty;
}

@media (hover: hover) {
  .post-card:hover {
    border-color: var(--line-strong);
    background: #121214;
    transform: translateY(-2px);
  }
}

.blog-empty {
  margin-bottom: 120px;
  padding: 40px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ---------- Post ---------- */

.post__head,
.prose {
  --container: 720px;
}

.post__head {
  display: grid;
  gap: 16px;
  padding-block: clamp(40px, 7vw, 88px) clamp(28px, 4vw, 44px);
}

.post__head .crumbs {
  margin-bottom: 4px;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--dim);
  font-size: 0.875rem;
  font-weight: 500;
}

.post__title {
  font-size: clamp(2.25rem, 6.4vw, 3.75rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.post__lead {
  color: var(--muted);
  font-size: clamp(1.1875rem, 2.4vw, 1.375rem);
  line-height: 1.45;
  text-wrap: pretty;
}

.post__cover {
  width: min(100% - 2 * var(--gutter), 1000px);
  margin: 0 auto clamp(32px, 5vw, 56px);
}

.post__cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- Prose ---------- */

.prose {
  padding-bottom: clamp(48px, 7vw, 80px);
  font-size: 1.1875rem;
  line-height: 1.7;
  letter-spacing: -0.014em;
  overflow-wrap: break-word;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2em;
  line-height: 1.2;
  letter-spacing: -0.028em;
  text-wrap: balance;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.prose h2 { font-size: 1.75rem; font-weight: 600; }
.prose h3 { font-size: 1.375rem; font-weight: 600; }
.prose h4,
.prose h5,
.prose h6 { font-size: 1.125rem; font-weight: 600; }

.prose h2 + *,
.prose h3 + *,
.prose h4 + * {
  margin-top: 0.6em;
}

.prose p,
.prose li {
  color: #d2d2d7;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(10, 132, 255, 0.6);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.2s ease;
}

.prose a:hover {
  text-decoration-color: var(--blue);
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--dim);
}

.prose blockquote {
  margin-inline: 0;
  padding: 2px 0 2px 22px;
  border-left: 2px solid transparent;
  border-image: linear-gradient(var(--blue), var(--purple), var(--pink)) 1;
}

.prose blockquote p {
  color: var(--text);
  font-size: 1.25rem;
  font-style: italic;
}

.prose code {
  padding: 0.12em 0.4em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

.prose pre {
  overflow-x: auto;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}

.prose figure {
  margin-inline: 0;
}

.prose figcaption {
  margin-top: 10px;
  color: var(--dim);
  font-size: 0.875rem;
  text-align: center;
}

.prose hr {
  height: 1px;
  margin-block: 2.4em;
  border: 0;
  background: var(--line-strong);
}

.prose .table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.prose th {
  color: var(--text);
  font-weight: 600;
}

.prose tr:last-child td {
  border-bottom: 0;
}

/* "Minha leitura": the author's take, set apart from the reporting. */
.prose .my-take {
  margin-block: 2.2em;
  padding: clamp(22px, 3.6vw, 32px) clamp(22px, 3.6vw, 34px);
  border: 1px solid transparent;
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(10, 132, 255, 0.10), rgba(191, 90, 242, 0.08) 45%, rgba(255, 55, 95, 0.05)) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--grad) border-box;
}

.prose .my-take > * + * {
  margin-top: 0.9em;
}

.prose .my-take__label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.3em;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prose .my-take__label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--blue), var(--purple), var(--pink), var(--orange), var(--blue));
}

.prose .my-take p:not(.my-take__label) {
  color: var(--text);
}

.prose p.my-take__label {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Closing CTA ---------- */

.post-cta {
  display: grid;
  justify-items: center;
  gap: 28px;
  margin-bottom: clamp(56px, 8vw, 104px);
  padding: clamp(48px, 7vw, 80px) 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(191, 90, 242, 0.18), transparent 60%),
    var(--surface);
  text-align: center;
}

.post-cta h2 {
  font-size: clamp(1.75rem, 4.4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.032em;
}
