/* ==========================================================================
   LOCAL FONT DEFINITION (JetBrains Mono from assets)
   ========================================================================== */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/JetBrainsMono-VariableFont_wght.ttf') format('truetype-variations'),
       url('assets/JetBrainsMono-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   DESIGN TOKENS & SYSTEM VARIABLES
   ========================================================================== */
:root {
  /* Subtle Teal Accent */
  --ds-teal-500: #009688;
  --ds-teal-subtle: rgba(0, 150, 136, 0.1);
  --ds-teal-border: rgba(0, 150, 136, 0.35);

  /* Clean Dark Theme Palette */
  --bg-color: #0b0e14;
  --text-primary: #ededed;
  --text-secondary: #9aa4b2;
  --text-muted: #555e6d;
  --border-color: #21262d;
  --border-hover: #30363d;

  /* Typography */
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  overflow-x: hidden;
}

::selection {
  background-color: var(--ds-teal-500);
  color: #ffffff;
}

/* ==========================================================================
   LAYOUT STRUCTURE (Centered Horizontally & Vertically - No Unwanted Scroll)
   ========================================================================== */
.site-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem clamp(1.25rem, 5vw, 2.5rem);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  position: relative;
}

/* Subpages (Privacy, 404, etc.) */
.site-wrapper.privacy-wrapper,
.site-wrapper.subpage-wrapper,
.site-wrapper:has(.privacy-page-frame),
.site-wrapper:has(.subpage-frame) {
  justify-content: center;
  padding: 3rem clamp(1.25rem, 5vw, 2.5rem);
}

@media (max-height: 550px) {
  .site-wrapper.privacy-wrapper,
  .site-wrapper.subpage-wrapper,
  .site-wrapper:has(.privacy-page-frame),
  .site-wrapper:has(.subpage-frame) {
    justify-content: flex-start;
  }
}

.content-frame {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}

/* Specific frame for Privacy / 404 subpage reading width */
.privacy-page-frame,
.subpage-frame {
  max-width: 480px;
  gap: 1.5rem;
}

/* ==========================================================================
   HEADER / TITLES
   ========================================================================== */
.header-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  line-height: 1.2;
}

/* ==========================================================================
   LINKS LIST (Tight, Text Left, Button Right)
   ========================================================================== */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.row-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ds-teal-500);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.action-btn:hover,
.action-btn:focus-visible {
  border-color: var(--ds-teal-500);
  background: var(--ds-teal-subtle);
  color: #ffffff;
  outline: none;
}

/* ==========================================================================
   PRIVACY PAGE STYLES
   ========================================================================== */
.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-exit {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-exit-icon {
  font-size: 0.85rem;
}

.btn-exit:hover,
.btn-exit:focus-visible {
  border-color: var(--ds-teal-500);
  color: var(--ds-teal-500);
  background: var(--ds-teal-subtle);
  outline: none;
}

.privacy-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.privacy-body p {
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.privacy-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.privacy-links-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.text-link {
  color: var(--ds-teal-500);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 0.78rem;
  transition: color 0.15s ease;
}

.text-link:hover {
  color: #ffffff;
}

/* Built With Tags (Centered, wider horizontally, no hover animation) */
.built-with-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2.25rem;
  width: 100%;
}

.tag-link {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
}

.tag-badge {
  width: 125px;
  height: auto;
  border-radius: 4px;
  display: block;
}

/* ==========================================================================
   CORNER PRIVACY LINK (Pinned to Bottom-Right Corner)
   ========================================================================== */
.corner-privacy {
  position: fixed;
  bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
  right: max(1.75rem, env(safe-area-inset-right, 1.75rem));
  z-index: 100;
  margin: 0;
  display: flex;
}

@media (max-width: 600px) {
  .corner-privacy {
    bottom: max(1.25rem, env(safe-area-inset-bottom, 1.25rem));
    right: max(1.25rem, env(safe-area-inset-right, 1.25rem));
  }
}

.privacy-link {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-color);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.privacy-link:hover,
.privacy-link:focus-visible {
  color: var(--ds-teal-500);
  text-decoration-color: var(--ds-teal-500);
  outline: none;
}

/* ==========================================================================
   PUBLICAÇÕES MODULE STYLES (Markdown & MDX)
   ========================================================================== */
.site-wrapper.publ-wrapper,
.site-wrapper:has(.publ-frame) {
  justify-content: flex-start;
  padding: 3rem clamp(1.25rem, 5vw, 2.5rem);
}

.publ-frame {
  max-width: 640px;
  width: 100%;
  gap: 1.5rem;
}

.publ-header {
  margin-bottom: 0.5rem;
}

.publ-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.publ-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

/* Posts List */
.publ-posts-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.publ-card {
  background: rgba(255, 255, 255, 0.012);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.publ-card:hover,
.publ-card:focus-visible {
  border-color: var(--ds-teal-500);
  background: var(--ds-teal-subtle);
  outline: none;
  transform: translateY(-1px);
}

.publ-card-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  transition: color 0.15s ease;
}

.publ-card:hover .publ-card-title {
  color: #ffffff;
}

.publ-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.publ-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.2rem;
}

.publ-read-more {
  font-size: 0.72rem;
  color: var(--ds-teal-500);
  font-weight: 500;
  font-family: var(--font-mono);
}

/* Loading & Empty States */
.publ-loading,
.publ-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.publ-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-top-color: var(--ds-teal-500);
  border-radius: 50%;
  animation: publ-spin 0.75s linear infinite;
}

@keyframes publ-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   ARTICLE / READER VIEW
   ========================================================================== */
.publ-article-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.publ-post-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ds-teal-500);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Markdown Render Body */
.markdown-body {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  word-break: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.35;
  margin-top: 0.75rem;
}

.markdown-body h1 {
  font-size: 1.2rem;
}

.markdown-body h2 {
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.35rem;
}

.markdown-body h3 {
  font-size: 0.95rem;
}

.markdown-body h4 {
  font-size: 0.88rem;
}

.markdown-body p {
  color: var(--text-secondary);
}

.markdown-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.markdown-body em {
  font-style: italic;
  color: #e6edf3;
}

.markdown-body del {
  color: var(--text-muted);
  text-decoration: line-through;
}

.markdown-body blockquote {
  border-left: 3px solid var(--ds-teal-500);
  background: var(--ds-teal-subtle);
  padding: 0.65rem 0.95rem;
  border-radius: 0 4px 4px 0;
  color: var(--text-secondary);
  margin: 0.35rem 0;
  font-style: italic;
}

.markdown-body blockquote p {
  color: var(--text-secondary);
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.markdown-body ul.task-list {
  list-style: none;
  padding-left: 0;
}

.markdown-body .task-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.markdown-body .task-item input[type="checkbox"] {
  accent-color: var(--ds-teal-500);
  cursor: default;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.25rem 0;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  color: var(--ds-teal-500);
}

/* Code Blocks */
.code-block-wrapper {
  margin: 0.65rem 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  background: #080a0f;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: #0f131a;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.code-lang {
  font-family: var(--font-mono);
  text-transform: lowercase;
}

.btn-copy-code {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn-copy-code:hover {
  border-color: var(--ds-teal-500);
  color: var(--ds-teal-500);
  background: var(--ds-teal-subtle);
}

.btn-copy-code.copied {
  border-color: var(--ds-teal-500);
  color: #ffffff;
  background: var(--ds-teal-500);
}

.markdown-body pre {
  margin: 0;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  background: #080a0f;
}

.markdown-body pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: #d1d7e0;
  font-size: 0.78rem;
  line-height: 1.6;
  display: block;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 0.85rem 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.78rem;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.55rem 0.75rem;
}

.markdown-body th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-weight: 600;
}

.markdown-body tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.markdown-body .md-image {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin: 0.65rem 0;
}

.publ-article-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}


