/*
Theme Name: ~/blog
Theme URI: https://github.com/example/tech-4
Author: raw-mono
Author URI: https://github.com/example
Description: Tema minimalista brutalist/terminal inspirado em Unix. Fundo #f4f4f0, fonte JetBrains Mono, bordas pretas grossas, hover invertido. Design originalmente criado como SPA HTML e convertido para WordPress.
Version: 1.0.0
License: MIT
License URI: https://opensource.org/licenses/MIT
Text Domain: blog-mono
Tags: minimal, brutalist, terminal, monospace, one-column, custom-colors, custom-logo, featured-images, theme-options

WordPress theme for the ~/blog minimal/terminal aesthetic.
*/

/* ============================================================
   VARIÁVEIS — cores, fontes, espaçamentos
   ============================================================ */
:root {
  --bg:       #f4f4f0;
  --text:     #1a1a1a;
  --muted:    #555;
  --accent:   #ff3b30;
  --border:   #000;
  --code-bg:  #1e1e1e;
}

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

html,
body {
  background: var(--bg);
}

body {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 400;
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0 16px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

::-moz-selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ============================================================
   WRAPPER — contêiner central
   ============================================================ */
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 0 80px;
}

/* ============================================================
   HEADER — "~/blog" com contador de posts
   ============================================================ */
header.site {
  border: 2px solid var(--border);
  padding: 16px 18px;
  margin-bottom: 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

header.site .logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
}

header.site .logo .caret {
  color: var(--accent);
}

header.site .status {
  font-size: 12px;
  color: var(--muted);
}

header.site .status b {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   LISTING VIEW — index, archive, search
   ============================================================ */
.listing-intro {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

.post-list {
  list-style: none;
}

.post-item {
  border: 2px solid var(--border);
  padding: 16px 18px;
  margin-bottom: -2px; /* collapse borders */
  display: block;
  background: var(--bg);
  transition: none; /* brutalist: instant */
}

.post-item:hover,
.post-item:focus-visible {
  background: var(--text);
  color: var(--bg);
  outline: none;
}

.post-item:hover .p-excerpt,
.post-item:focus-visible .p-excerpt,
.post-item:hover .post-excerpt,
.post-item:focus-visible .post-excerpt {
  color: var(--bg);
}

.post-item:hover .p-date,
.post-item:focus-visible .p-date,
.post-item:hover .post-date,
.post-item:focus-visible .post-date {
  color: var(--accent);
}

.post-item:hover .p-arrow,
.post-item:focus-visible .p-arrow {
  color: var(--bg);
}

.p-meta,
.post-meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.p-date,
.post-date {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.p-title,
.post-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.p-excerpt,
.post-excerpt {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.p-arrow {
  float: right;
  color: var(--muted);
  font-weight: 700;
}

/* ============================================================
   SINGLE / ARTICLE VIEW
   ============================================================ */
.back-btn {
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  margin-bottom: 24px;
  display: inline-block;
}

.back-btn:hover {
  background: var(--text);
  color: var(--bg);
}

.article-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.25;
  margin-bottom: 12px;
}

.article-title .hash {
  color: var(--accent);
}

.article-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 16px;
}

.article-body {
  min-height: 40px;
}

.article-body p {
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.7;
}

.article-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 14px;
  letter-spacing: -0.3px;
}

.article-body h2::before {
  content: "## ";
  color: var(--accent);
}

.article-body h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 12px;
  letter-spacing: -0.3px;
}

.article-body h3::before {
  content: "### ";
  color: var(--accent);
}

.article-body h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 10px;
}

.article-body ul {
  margin: 0 0 18px 0;
  padding-left: 22px;
}

.article-body ol {
  margin: 0 0 18px 0;
  padding-left: 22px;
}

.article-body li {
  font-size: 14px;
  margin-bottom: 6px;
}

.article-body strong {
  font-weight: 700;
}

.article-body em {
  font-style: italic;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
  margin: 0 0 18px 0;
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
}

.article-body code:not(pre code) {
  background: var(--text);
  color: var(--bg);
  padding: 1px 5px;
  font-size: 13px;
}

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 28px 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 13px;
}

.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

.article-body th {
  font-weight: 700;
  background: var(--text);
  color: var(--bg);
}

.article-body img {
  width: 100%;
  margin-bottom: 24px;
  border: 2px solid var(--border);
  display: block;
}

/* typewriter caret while revealing */
.article-body.typing::after {
  content: "█";
  color: var(--accent);
  animation: none;
}

/* ============================================================
   CODE BLOCKS
   ============================================================ */
.code-block,
.article-body pre.wp-block-code,
.article-body pre {
  border: 2px solid var(--border);
  margin: 24px 0;
  background: var(--code-bg);
  overflow: hidden;
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--code-bg);
  border-bottom: 2px solid var(--border);
  padding: 8px 12px;
}

.code-lang {
  font-size: 12px;
  color: #8a8a8a;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.code-lang::before {
  content: "// ";
  color: var(--accent);
}

.copy-btn {
  border: 2px solid #555;
  background: transparent;
  color: #d4d4d4;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.copy-btn:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.copy-btn.copied {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.code-scroll {
  overflow-x: auto;
}

pre.code-pre,
.article-body pre {
  margin: 0;
  display: flex;
  font-size: 13px;
  line-height: 1.6;
  background: var(--code-bg);
}

.line-numbers {
  user-select: none;
  -webkit-user-select: none;
  text-align: right;
  padding: 14px 10px 14px 14px;
  color: #555;
  border-right: 1px solid #333;
  font-size: 13px;
  line-height: 1.6;
  background: var(--code-bg);
  flex: 0 0 auto;
}

.line-numbers span {
  display: block;
}

pre.code-pre code,
.article-body pre code {
  padding: 14px 16px;
  display: block;
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 13px;
  background: var(--code-bg) !important;
  flex: 1 1 auto;
  white-space: pre;
  overflow-x: auto;
}

.article-body pre:not(.code-pre) {
  display: block;
  padding: 14px 16px;
  overflow-x: auto;
}

.article-body pre:not(.code-pre) code {
  padding: 0;
  background: transparent !important;
}

.hljs {
  background: var(--code-bg) !important;
}

/* ============================================================
   WORDPRESS CORE ALIGNMENTS
   ============================================================ */
.alignleft {
  float: left;
  margin: 0 18px 12px 0;
}

.alignright {
  float: right;
  margin: 0 0 12px 18px;
}

.aligncenter {
  display: block;
  margin: 0 auto 18px;
}

.wp-caption {
  max-width: 100%;
  margin-bottom: 18px;
}

.wp-caption-text {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px;
}

.gallery {
  margin: 24px 0;
}

.gallery-item {
  display: inline-block;
  vertical-align: top;
  margin: 0 8px 8px 0;
}

/* ============================================================
   NAVIGATION — paginação
   ============================================================ */
.pagination {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination a {
  border: 2px solid var(--border);
  padding: 6px 12px;
  font-weight: 500;
}

.pagination a:hover {
  background: var(--text);
  color: var(--bg);
}

/* ============================================================
   COMMENTS
   ============================================================ */
.comments-area {
  margin-top: 40px;
  border-top: 2px solid var(--border);
  padding-top: 20px;
}

.comments-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.comment-list {
  list-style: none;
  margin-bottom: 24px;
}

.comment {
  border-left: 2px solid var(--border);
  padding-left: 14px;
  margin-bottom: 16px;
}

.comment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.comment-author {
  font-weight: 700;
  color: var(--text);
}

.comment-content {
  font-size: 13px;
  line-height: 1.6;
}

.comment-content p {
  margin-bottom: 8px;
}

.reply {
  font-size: 12px;
}

.reply a {
  color: var(--accent);
}

.comment-respond {
  margin-top: 24px;
}

.comment-reply-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.comment-form p {
  margin-bottom: 12px;
  font-size: 13px;
}

.comment-form input,
.comment-form textarea {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 8px 10px;
  width: 100%;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  background: var(--text);
  color: var(--bg);
}

.comment-form .submit {
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  width: auto;
}

.comment-form .submit:hover {
  background: var(--text);
  color: var(--bg);
}

/* ============================================================
   SEARCH FORM
   ============================================================ */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.search-form input[type="search"] {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 8px 10px;
  flex: 1;
}

.search-form input[type="search"]:focus {
  outline: none;
  background: var(--text);
  color: var(--bg);
}

.search-form button {
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--text);
  color: var(--bg);
}

/* ============================================================
   404 PAGE
   ============================================================ */
.error-404 {
  text-align: center;
  padding: 60px 0;
}

.error-404 h1 {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}

.error-404 .error-code {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.error-404 .error-suggestion {
  font-size: 13px;
  color: var(--muted);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer.site {
  margin-top: 48px;
  border-top: 2px solid var(--border);
  padding-top: 16px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

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

/* Screen reader text */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* ============================================================
   RESPONSIVO
   ============================================================ */
@media (max-width: 480px) {
  body {
    padding: 0 12px;
    font-size: 14px;
  }

  .wrap {
    padding: 20px 0 60px;
  }

  header.site {
    padding: 14px;
  }

  header.site .logo {
    font-size: 17px;
  }

  .article-title {
    font-size: 20px;
  }

  .p-arrow {
    display: none;
  }

  pre.code-pre,
  .line-numbers,
  pre.code-pre code,
  .article-body pre,
  .article-body pre code {
    font-size: 12px;
  }

  .line-numbers {
    padding: 14px 6px 14px 8px;
  }
}
