/*
Theme Name: Forma
Author: Gabriel Pimentel
Description: Tema minimalista para escrita. Tipografia geométrica, espaçamento preciso, sem serifa.
Version: 1.0.0
Requires at least: 6.2
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: forma
Tags: minimal, blog, portfolio, writing, sans-serif, modern
*/

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

/* ─────────────────────────────────────────
   TOKENS
───────────────────────────────────────── */
:root {
  --bg:         #fafafa;
  --surface:    #f4f4f5;
  --border:     #e4e4e7;
  --border-mid: #d4d4d8;

  --tx:         #111827;
  --tx-2:       #374151;
  --tx-3:       #6b7280;
  --tx-4:       #9ca3af;

  --accent:     #2563eb;
  --accent-bg:  #eff6ff;

  --font: 'Figtree', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --content-w: 680px;
  --wide-w:    1100px;
  --pad:       clamp(1.25rem, 5vw, 2.5rem);

  --radius: 6px;
  --transition: 0.15s ease;
}

/* ─────────────────────────────────────────
   BASE
───────────────────────────────────────── */
html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  tab-size: 2;
}

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

main { flex: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ─────────────────────────────────────────
   LAYOUT
───────────────────────────────────────── */
.outer {
  width: 100%;
  max-width: var(--wide-w);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.inner {
  width: 100%;
  max-width: var(--content-w);
  margin-inline: auto;
}

/* ─────────────────────────────────────────
   READING PROGRESS BAR
───────────────────────────────────────── */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
  display: none;
}

body.is-single .progress-bar { display: block; }

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  gap: 2rem;
}

.site-logo {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tx);
  transition: opacity var(--transition);
}
.site-logo:hover { opacity: 0.6; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tx-3);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.site-nav a:hover,
.site-nav .current-menu-item a {
  color: var(--tx);
  background: var(--surface);
}

/* ─────────────────────────────────────────
   HOME — INTRO
───────────────────────────────────────── */
.home-intro {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
}

.home-intro__name {
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--tx);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}

.home-intro__bio {
  font-size: 0.95rem;
  color: var(--tx-3);
  line-height: 1.6;
  max-width: 46ch;
}

/* ─────────────────────────────────────────
   HOME — FEATURED POST
───────────────────────────────────────── */
.featured-wrap {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-block: 2rem;
}

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tx-4);
  margin-bottom: 1.25rem;
}

.featured-post__title {
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--tx);
  margin-bottom: 0.5rem;
  transition: color var(--transition);
}
.featured-post__title:hover { color: var(--accent); }

.featured-post__meta {
  font-size: 0.78rem;
  color: var(--tx-4);
  margin-bottom: 0.75rem;
}

.featured-post__excerpt {
  font-size: 0.93rem;
  color: var(--tx-3);
  line-height: 1.7;
  max-width: 58ch;
  margin-bottom: 1rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  transition: gap var(--transition);
}
.read-more::after { content: '→'; transition: transform var(--transition); }
.read-more:hover { gap: 0.5rem; }

/* ─────────────────────────────────────────
   HOME — POST LIST
───────────────────────────────────────── */
.post-list-wrap {
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.year-block { margin-bottom: 0.25rem; }

.year-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-4);
  padding-block: 1.75rem 0.6rem;
}

.post-row {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding-block: 0.45rem;
  border-radius: var(--radius);
  margin-inline: -0.5rem;
  padding-inline: 0.5rem;
  transition: background var(--transition);
  cursor: pointer;
}
.post-row:hover { background: var(--surface); }

.post-row__title {
  font-size: 0.92rem;
  font-weight: 450;
  color: var(--tx-2);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition);
}
.post-row:hover .post-row__title { color: var(--tx); }

.post-row__date {
  font-size: 0.72rem;
  color: var(--tx-4);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ─────────────────────────────────────────
   SINGLE POST
───────────────────────────────────────── */
.single-wrap {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 8vw, 6rem);
}

.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--tx-4);
  margin-bottom: 2.5rem;
}
.post-breadcrumb a {
  color: var(--tx-4);
  transition: color var(--transition);
}
.post-breadcrumb a:hover { color: var(--tx); }
.post-breadcrumb__sep { color: var(--border-mid); }

.post-header { margin-bottom: 2.5rem; }

.post-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--tx);
  margin-bottom: 1rem;
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-meta-item {
  font-size: 0.78rem;
  color: var(--tx-4);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.post-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
}

/* ─────────────────────────────────────────
   ENTRY CONTENT
───────────────────────────────────────── */
.entry-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--tx-2);
}

.entry-content > * + * { margin-top: 1.5em; }

.entry-content p { max-width: 68ch; }

.entry-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tx);
  margin-top: 2.75em;
  line-height: 1.3;
}

.entry-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tx);
  margin-top: 2.25em;
  line-height: 1.35;
}

.entry-content a {
  color: var(--tx);
  text-decoration: underline;
  text-decoration-color: var(--border-mid);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--transition), text-decoration-color var(--transition);
}
.entry-content a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.entry-content strong { font-weight: 700; color: var(--tx); }
.entry-content em { font-style: italic; }

.entry-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
  color: var(--tx-3);
  font-size: 1.05rem;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.5rem;
}
.entry-content ul { list-style: disc; }
.entry-content ol { list-style: decimal; }
.entry-content li + li { margin-top: 0.4em; }

.entry-content code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--tx);
}

.entry-content pre {
  background: var(--tx);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow-x: auto;
  margin-block: 2em;
}
.entry-content pre code {
  font-size: 0.83rem;
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  line-height: 1.7;
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin-block: 2.5em;
}

.entry-content img {
  border-radius: var(--radius);
  width: 100%;
}

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

.post-nav__item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition);
}
.post-nav__item:hover {
  border-color: var(--border-mid);
  background: var(--surface);
}

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

.post-nav__label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-4);
}

.post-nav__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tx-2);
  line-height: 1.4;
  transition: color var(--transition);
}
.post-nav__item:hover .post-nav__title { color: var(--tx); }

/* Related */
.related-wrap {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.related-list { margin-top: 1rem; }

.related-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-block: 0.4rem;
  border-radius: var(--radius);
  margin-inline: -0.4rem;
  padding-inline: 0.4rem;
  transition: background var(--transition);
  cursor: pointer;
}
.related-item:hover { background: var(--surface); }

.related-item__title {
  font-size: 0.88rem;
  color: var(--tx-3);
  transition: color var(--transition);
}
.related-item:hover .related-item__title { color: var(--tx); }

/* ─────────────────────────────────────────
   STATIC PAGE
───────────────────────────────────────── */
.page-wrap {
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 8vw, 6rem);
}

.page-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

/* ─────────────────────────────────────────
   404
───────────────────────────────────────── */
.wrap-404 {
  padding-block: 5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
.wrap-404__code {
  font-size: 5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--border);
  line-height: 1;
}
.wrap-404__msg { font-size: 0.9rem; color: var(--tx-3); }
.wrap-404__link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  transition: opacity var(--transition);
}
.wrap-404__link:hover { opacity: 0.75; }

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.75rem 2rem;
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.site-footer__name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tx-3);
}
.site-footer__copy {
  font-size: 0.72rem;
  color: var(--tx-4);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}
.footer-links a {
  font-size: 0.78rem;
  color: var(--tx-4);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--tx); }

/* ─────────────────────────────────────────
   PAGE FADE-IN
───────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
main {
  animation: fadeUp 0.35s ease both;
}

/* ─────────────────────────────────────────
   MOBILE
───────────────────────────────────────── */
@media (max-width: 600px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__item--next { text-align: left; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}

/* ─────────────────────────────────────────
   UTILITY
───────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}
