/* =====================================================
   Notas de um Analgesico — dark minimal stylesheet
   ===================================================== */

:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --text: #e0e0e0;
  --text-bright: #f0f0f0;
  --muted: #7e7e8a;
  --accent: #c9a55a;
  --accent-hover: #d4b36e;
  --accent-dim: rgba(201, 165, 90, 0.08);
  --accent-25: rgba(201, 165, 90, 0.25);
  --accent-10: rgba(201, 165, 90, 0.1);
  --accent-glow: rgba(201, 165, 90, 0.06);
  --border: #1f1f23;
  --code-bg: #18181b;
  --max-width: 680px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Selection ── */
::selection {
  background: var(--accent-25);
  color: var(--text-bright);
}

::-moz-selection {
  background: var(--accent-25);
  color: var(--text-bright);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Firefox scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 4px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

/* ── Layout ── */
.site-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

/* ── Header ── */
.site-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title-heading {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  margin: 0;
}

.site-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.site-title:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s ease;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* ── Footer ── */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer p {
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-socials a {
  color: var(--muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.75rem;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.footer-socials a:hover {
  color: var(--accent);
}

.footer-socials a:active {
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Home / latest post ── */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro p {
  color: var(--muted);
  font-size: 0.95rem;
}

.home-tagline {
  color: var(--muted);
  font-size: 0.95rem;
  font-style: italic;
  margin-bottom: 2.5rem;
}

.home-section {
  margin-bottom: 2rem;
}

.home-section + .home-section {
  padding-top: 2rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.875rem;
}

.post-card--intro {
  background: rgba(201, 165, 90, 0.1);
  border: 1px solid rgba(201, 165, 90, 0.15);
  border-left: 2px solid var(--accent);
}

.post-card--intro:hover {
  background: rgba(201, 165, 90, 0.14);
  border-color: var(--accent);
}

.all-posts-link {
  margin-top: 2rem;
}

.all-posts-link .read-more {
  display: inline-block;
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.all-posts-link .read-more:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Post card (used on home + list) ── */
.post-card {
  position: relative;
  margin-bottom: 2rem;
  padding: 1.25rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.post-card:hover {
  background: var(--surface);
  border-left-color: var(--accent);
}

.post-card + .post-card {
  margin-top: 0.5rem;
}

/* Stretched link — makes the entire card clickable via the heading link */
.post-card h2 a::after,
.post-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card .read-more {
  position: relative;
  z-index: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-author {
  color: var(--accent);
  font-weight: 500;
}

.post-author::after {
  content: "·";
  margin-left: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

.reading-time::before {
  content: "·";
  margin-right: 0.75rem;
}

.post-card h2,
.post-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}

.post-card h2 a,
.post-card h3 a {
  color: var(--text-bright);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card:hover h2 a,
.post-card:hover h3 a {
  color: var(--accent);
}

.post-excerpt {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more {
  font-size: 0.83rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.read-more:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── All posts page ── */
.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  text-shadow: 0 0 40px var(--accent-glow);
}

.page-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* ── Search ── */
.search-wrap {
  position: relative;
  margin-bottom: 2.5rem;
}

#search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-10);
}

#search-input::placeholder {
  color: var(--muted);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

#no-results {
  color: var(--muted);
  font-size: 0.9rem;
  display: none;
  padding: 1rem 0;
}

/* ── Single post ── */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--text-bright);
  text-shadow: 0 0 60px var(--accent-glow);
}

.post-description {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 0.5rem;
}

.post-content {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.75rem;
  color: var(--text-bright);
}

.post-content h2 { font-size: 1.25rem; }
.post-content h3 { font-size: 1.05rem; }

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(201, 165, 90, 0.3);
  transition: text-decoration-color 0.2s ease;
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

.post-content ul,
.post-content ol {
  margin: 0 0 1.25rem 1.5rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content li::marker {
  color: var(--muted);
}

.post-content blockquote {
  border-left: 2px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--muted);
  font-style: italic;
  background: var(--accent-dim);
  border-radius: 0 4px 4px 0;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.post-content code {
  font-size: 0.85em;
  background: var(--code-bg);
  color: var(--accent-hover);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.post-content strong {
  color: var(--text-bright);
  font-weight: 600;
}

.post-content em {
  color: var(--text);
}

/* ── Post nav (prev/next) ── */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.post-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: block;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.post-nav a:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.post-nav .next {
  text-align: right;
}

.post-nav .label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.2rem;
  font-weight: 400;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 6px;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.pagination a {
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--border);
}

.pagination a:hover {
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.pagination .current {
  color: var(--bg);
  background: var(--accent);
  font-weight: 600;
}

.pagination .disabled {
  color: var(--muted);
  opacity: 0.4;
}

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.83rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text);
}

/* ── Focus visible ── */
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Fade-in ── */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  animation: fade-in 0.4s ease both;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .site-wrapper {
    padding: 0 1.25rem;
  }

  .post-header h1 {
    font-size: 1.55rem;
  }

  .page-title {
    font-size: 1.35rem;
  }
}

@media (max-width: 600px) {
  html { font-size: 16px; }

  .site-header {
    padding: 1.5rem 0 1rem;
    margin-bottom: 2rem;
  }

  .post-header h1 {
    font-size: 1.45rem;
  }

  .nav-links a {
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  #search-input {
    min-height: 44px;
  }

  .post-nav {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .post-nav a {
    padding: 1rem;
  }

  .post-nav .next {
    text-align: left;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .footer-socials {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
  }

  .post-meta .post-author {
    flex-basis: 100%;
  }

  .post-meta .post-author::after {
    content: none;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
