/* felvieira's blog — editorial, inspirado no Medium
   Corpo: Source Serif 4 · UI e títulos: Inter · temas claro e escuro selecionáveis */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f9f9f9;
  --surface2: #f2f2f2;
  --border: #e6e6e6;
  --text: #242424;
  --muted: #6b6b6b;
  --code-bg: #f2f2f2;
  --link: #242424;
  --accent: #1a8917;
  --accent-soft: rgba(26, 137, 23, 0.07);
  --nav-bg: rgba(255, 255, 255, 0.94);

  --serif: "Source Serif 4", "Source Serif Pro", Charter, "Bitstream Charter", Georgia, Cambria, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --surface: #1a1a1a;
    --surface2: #242424;
    --border: #2e2e2e;
    --text: #e6e6e6;
    --muted: #9b9b9b;
    --code-bg: #1f1f1f;
    --link: #e6e6e6;
    --accent: #3aa832;
    --accent-soft: rgba(58, 168, 50, 0.14);
    --nav-bg: rgba(18, 18, 18, 0.94);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #e6e6e6;
  --muted: #9b9b9b;
  --code-bg: #1f1f1f;
  --link: #e6e6e6;
  --accent: #3aa832;
  --accent-soft: rgba(58, 168, 50, 0.14);
  --nav-bg: rgba(18, 18, 18, 0.94);
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: 728px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.wrap-home {
  max-width: 944px;
  padding-top: 56px;
}

/* ─── Navegação ─────────────────────────────────────────────────────────── */
nav.top {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 57px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 14px;
}

nav.top a { color: var(--muted); text-decoration: none; }
nav.top a:hover { color: var(--text); }

nav.top .brand {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}
nav.top .brand { text-decoration: none; }
nav.top a.brand:hover { color: var(--text); }

nav.top a.nav-cta {
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 500;
}
nav.top a.nav-cta:hover { color: var(--bg); opacity: 0.85; }

.theme-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.theme-switch button {
  min-height: 30px;
  padding: 4px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: 500 12px var(--sans);
  cursor: pointer;
}
.theme-switch button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

/* ─── Título e byline do post ───────────────────────────────────────────── */
h1 {
  font-family: var(--sans);
  font-size: clamp(32px, 5.2vw, 42px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.011em;
  color: var(--text);
  margin: 8px 0 24px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 8px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
}

.meta > span + span::before { content: "·"; margin-right: 8px; }

.meta .tag {
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.meta .author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 500;
}

.meta .author::before {
  content: "FV";
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 0;
}

/* ─── Corpo do artigo ───────────────────────────────────────────────────── */
article {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
  letter-spacing: -0.003em;
  color: var(--text);
}

article > :first-child { margin-top: 0; }

article p { margin: 0 0 29px; }

article h2 {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.016em;
  margin: 56px 0 16px;
}

article h3 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.012em;
  margin: 40px 0 12px;
}

article strong { font-weight: 700; color: inherit; }

article a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
article a:hover { color: var(--accent); }

article ul,
article ol { margin: 0 0 29px 1.5em; padding: 0; }
article li { margin: 0 0 10px; padding-left: 4px; }
article li > ul,
article li > ol { margin: 10px 0 0 1.5em; }

article blockquote {
  margin: 36px 0;
  padding: 0 0 0 23px;
  border-left: 3px solid var(--text);
  font-size: 22px;
  line-height: 1.5;
  font-style: italic;
  color: var(--text);
}
article blockquote p:last-child { margin-bottom: 0; }

article code {
  font-family: var(--mono);
  font-size: 0.82em;
  letter-spacing: 0;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: inherit;
}

article pre {
  margin: 36px 0;
  padding: 20px 24px;
  background: var(--code-bg);
  border-radius: 4px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}
article pre code { background: transparent; padding: 0; font-size: inherit; border-radius: 0; }

article table {
  width: 100%;
  margin: 36px 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

article th {
  padding: 0 16px 10px 0;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--text);
}

article td {
  padding: 12px 16px 12px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 36px 0;
}
.table-wrap table { min-width: 620px; margin: 0; }
/* Colunas curtas (modelo, preço, tempo) não quebram linha */
article td:not(:last-child),
article th:not(:last-child) { white-space: nowrap; }

article img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}
article p:has(> img:only-child) { margin: 40px 0; }

article video {
  display: block;
  width: 100%;
  height: auto;
  background: #0b0d10;
  border-radius: 4px;
}

article figure { margin: 40px 0; }
article figure img { margin: 0; }

article figcaption {
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--muted);
  text-align: center;
}

article hr {
  border: 0;
  margin: 48px 0;
  text-align: center;
}
article hr::before {
  content: "•••";
  font-size: 16px;
  letter-spacing: 0.6em;
  padding-left: 0.6em;
  color: var(--text);
}

/* ─── Componentes editoriais ────────────────────────────────────────────── */
.stats-grid,
.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 32px;
  margin: 40px 0;
  font-family: var(--sans);
  letter-spacing: 0;
}

.stat-card { border-top: 2px solid var(--text); padding-top: 14px; }

.stat-card strong {
  display: block;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}

.media-card { margin: 0; }

.media-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin: 0;
}

.media-card video { aspect-ratio: 9 / 16; object-fit: cover; }

/* Vídeos verticais: 3 por linha em vez de 2 gigantes */
.media-grid:has(video) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 20px; }

.media-card-body {
  display: block;
  margin: 0;
  padding: 12px 0 0;
  text-align: left;
}
.media-card-body p:last-child { margin-bottom: 0; }

.media-card-title {
  display: block;
  margin-bottom: 2px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.media-card-meta {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.callout,
.verdict {
  margin: 36px 0;
  padding: 20px 24px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

.callout { background: var(--surface2); border-left: 4px solid var(--text); }
.verdict { background: var(--accent-soft); border-left: 4px solid var(--accent); }

.callout p,
.verdict p { margin: 0 0 12px; }
.callout p:last-child,
.verdict p:last-child { margin-bottom: 0; }

.prompt-details {
  margin: 28px 0;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 15px;
  letter-spacing: 0;
}
.prompt-details summary { cursor: pointer; font-weight: 600; color: var(--text); }
.prompt-details pre { margin: 14px 0 0; }
.prompt-details p { margin: 14px 0 0; color: var(--muted); }

/* ─── Compartilhar (LinkedIn) ───────────────────────────────────────────── */
.share-block {
  margin-top: 64px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.share-block .share-label {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-block .share-hook {
  margin: 0 0 24px;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.45;
  font-style: italic;
  color: var(--text);
  white-space: pre-wrap;
}

.share-block .share-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.share-block button.copy-share,
.share-block a.share-linkedin {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 20px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}

.share-block button.copy-share {
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}
.share-block button.copy-share:hover { opacity: 0.85; }
.share-block button.copy-share.copied { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
.share-block button.copy-share.copy-failed { background: var(--surface2); border-color: var(--text); color: var(--text); }
:root[data-theme="dark"] .share-block button.copy-share.copied { color: #0b190a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .share-block button.copy-share.copied { color: #0b190a; } }

.share-block a.share-linkedin {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--muted);
}
.share-block a.share-linkedin:hover { border-color: var(--text); }

.share-block .share-text { display: none; }
.share-block .share-text.visible-copy { display: block; margin-top: 16px; padding: 16px; border: 1px solid var(--border); background: var(--surface); white-space: pre-wrap; user-select: text; }

.related-posts { margin: 48px 0; padding: 24px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.related-posts h2 { margin-bottom: 12px; font-size: 21px; }
.related-posts a { display: block; padding: 12px 0; color: var(--text); font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.related-posts a span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 400; }
.post-list [hidden], .featured [hidden] { display: none !important; }

footer.post {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}
footer.post a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
footer.post a:hover { color: var(--text); }

/* ─── Home: masthead ────────────────────────────────────────────────────── */
.masthead {
  padding: 24px 0 48px;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--border);
}

.masthead h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
}

.masthead .tagline {
  max-width: 34em;
  font-family: var(--serif);
  font-size: clamp(18px, 2.4vw, 22px);
  line-height: 1.5;
  color: var(--muted);
}

/* ─── Home: destaques (1 principal + 2 secundários) ─────────────────────── */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 48px;
  padding-bottom: 48px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.feat-hero,
.feat-sec,
.list-item { display: flex; color: inherit; text-decoration: none; }

.feat-hero-body,
.feat-sec-body,
.list-body { display: flex; flex-direction: column; min-width: 0; }

.featured .meta,
.list-item .meta {
  display: block;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.excerpt {
  font-family: var(--serif);
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feat-hero { flex-direction: column; }

.feat-hero-img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.feat-hero h2 {
  order: 1;
  margin: 0 0 10px;
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.feat-hero .excerpt { order: 2; font-size: 18px; line-height: 1.5; -webkit-line-clamp: 3; }
.feat-hero .meta { order: 3; margin-top: 14px; }

.feat-secondary { display: flex; flex-direction: column; }

.feat-sec {
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 24px;
}
.feat-sec + .feat-sec { padding: 24px 0 0; border-top: 1px solid var(--border); }

.feat-sec-img {
  display: block;
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  min-width: 104px;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  object-fit: cover;
}

.feat-sec-body { flex: 1; }
.feat-sec h3 { order: 1; margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; letter-spacing: -0.012em; }
.feat-sec .meta { order: 2; margin-top: 10px; }

/* ─── Home: feed com miniatura à direita ────────────────────────────────── */
.post-list { display: flex; flex-direction: column; }

.section-label {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.list-item {
  flex-direction: row-reverse;
  align-items: center;
  gap: 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }

.list-thumb {
  display: block;
  flex: 0 0 200px;
  width: 200px;
  height: 133px;
  min-width: 0;
  aspect-ratio: 3 / 2;
  border-radius: 4px;
  object-fit: cover;
}

.list-body { flex: 1; }
.list-item h3 { order: 1; margin: 0 0 8px; font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.016em; }
.list-item .excerpt { order: 2; font-size: 16px; line-height: 1.5; -webkit-line-clamp: 2; }
.list-item .meta { order: 3; margin-top: 14px; }

.eyebrow { color: var(--accent); font: 600 12px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.archive-tools { margin: 0 0 44px; padding: 26px 0 30px; border-bottom: 1px solid var(--border); }
.archive-heading-row { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.archive-heading-row h2 { margin-top: 4px; font: 650 clamp(22px, 3vw, 30px)/1.15 var(--sans); letter-spacing: -.025em; }
.archive-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.search-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.archive-tools input[type="search"] { width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: 16px var(--sans); }
.archive-tools input[type="search"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topic-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.topic-filter { min-height: 40px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); font: 500 14px var(--sans); cursor: pointer; }
.topic-filter:hover, .topic-filter.is-active { border-color: var(--text); background: var(--text); color: var(--bg); }
.archive-status { min-height: 22px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.archive-status:empty { display: none; }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; padding: 26px 0; }
.pagination button, .pagination a { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); font: 500 14px var(--sans); text-decoration: none; cursor: pointer; }
.pagination [aria-current="page"] { border-color: var(--text); background: var(--text); color: var(--bg); }
.pagination button:disabled { cursor: not-allowed; opacity: .5; }

.feat-hero:hover h2,
.feat-sec:hover h3,
.list-item:hover h3 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.wrap-home footer.post {
  margin-top: 80px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ─── Responsivo ────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .featured { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 640px) {
  .wrap { padding: 32px 20px 72px; }
  .wrap-home { padding-top: 32px; }
  nav.top { padding: 0 16px; gap: 16px; }
  nav.top .brand { font-size: 22px; }

  article { font-size: 18px; }
  article h2 { font-size: 24px; margin-top: 44px; }
  article h3 { font-size: 20px; }
  article blockquote { font-size: 19px; }
  .share-block .share-hook { font-size: 20px; }

  .masthead { padding-bottom: 32px; margin-bottom: 32px; }

  .list-item { gap: 16px; padding: 22px 0; }
  .list-thumb { flex-basis: 96px; width: 96px; height: 96px; aspect-ratio: 1 / 1; }
  .list-item h3 { font-size: 18px; }
  .list-item .excerpt { font-size: 15px; }

  .stat-card strong { font-size: 26px; }
  .media-grid,
  .media-grid:has(video) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
}

@media (max-width: 480px) {
  nav.top { gap: 10px; }
  nav.top > a:not(.brand) { display: none; }
  .theme-switch { margin-left: auto; }
  .theme-switch button { padding: 4px 7px; }
  .archive-heading-row { align-items: start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }
