/* =========================
   VARIABLES (LIGHT FIRST)
========================= */

:root {
  --bg: #f7f4ef;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #7a5c3e;
  --border: #ddd;

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 28px;
  --space-lg: 48px;
  --space-xl: 72px;
}

/* DARK MODE */
.dark-mode {
  --bg: #0e0e0e;
  --text: #e0e0e0;
  --muted: #9a9a9a;
  --accent: #a07a52;
  --border: #2a2a2a;
}

/* =========================
   BASE
========================= */

body {
  background: var(--bg);
  color: var(--text);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 19px;
  line-height: 1.9;
  margin: 0;
  padding: 60px 20px;
}

main {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* =========================
   TIPOGRAFÍA
========================= */

h1, h2, h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
}

h1 {
  font-size: 2.3rem;
  line-height: 1.1;
  margin-bottom: 0.3em;
}

h2 {
  font-size: 1.6rem;
  margin-top: 2.6em;
  margin-bottom: 0.5em;
}

h3 {
  font-size: 1.2rem;
  margin-top: 1.8em;
  color: var(--muted);
}

h1, h2 {
  text-wrap: balance;
}

/* =========================
   LINKS (GLOBAL)
========================= */

a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;

  width: 0%;
  height: 1px;
  background: var(--accent);

  transition: width 0.2s ease;
}

a:hover::after {
  width: 100%;
}

/* =========================
   BRAND
========================= */

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
}

header h1 span {
  opacity: 0.65;
  letter-spacing: 1px;
}

.tagline {
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

/* =========================
   HEADER
========================= */

header {
  position: sticky;
  top: 0;
  z-index: 1000;

  background: var(--bg);
  border-bottom: 1px solid var(--border);

  margin-bottom: 28px;
  padding: 12px 0;
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}

header nav {
  display: flex;
  gap: 12px;
  justify-self: center;
}

header nav a {
  color: var(--muted);
}

header nav a:hover {
  color: var(--text);
}

#theme-toggle {
  justify-self: end;

  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

#theme-toggle:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

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

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

/* =========================
   ELEMENTOS
========================= */

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

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

/* =========================
   CONTENIDO
========================= */

.post-content {
  max-width: 62ch;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.95;
}

.post-content p {
  margin-bottom: 1.9em;
}

.post-content p:first-of-type::first-letter {
  font-size: 2.4em;
  float: left;
  margin-right: 8px;
  line-height: 0.95;
}

.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  margin: 2em 0;
  color: var(--muted);
  font-style: italic;
}

/* =========================
   TOC
========================= */

.toc {
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin: var(--space-md) 0;
}

.toc a {
  color: var(--muted);
}

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

/* =========================
   META
========================= */

small {
  font-size: 0.85rem;
  color: var(--muted);
}

.breadcrumbs {
  font-size: 1rem;
  opacity: 0.8;
}

/* =========================
   TAGS
========================= */

.tags a {
  color: var(--muted);
  font-size: 0.9rem;
}

.tags a::after {
  display: none;
}

/* =========================
   BLOG IMAGES
========================= */

.post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* =========================
   AUTHOR BLOCK
========================= */

.author-block {
  margin-bottom: var(--space-lg);
  max-width: 240px;
}

.author-image {
  margin-bottom: 12px;
}

.author-image img {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.05);
}

.author-meta {
  line-height: 1.3;
}

.author-name {
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  margin: 0;
}

.author-role {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.about-content {
  margin-top: var(--space-md);
  max-width: 65ch;
}

/* =========================
   FOOTER
========================= */

.site-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.3px;
  margin: 6px 0;
}

.footer-about a {
  font-family: "Playfair Display", serif;
  font-size: 1.15rem;
  letter-spacing: 0.4px;
  color: var(--accent);
}

.footer-about a:hover {
  opacity: 0.7;
}

/* =========================
   ANCHOR FIX
========================= */

:target {
  scroll-margin-top: 90px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 600px) {

  body {
    padding: 40px 16px;
  }

  .header-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  header nav {
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }

  header h1 {
    font-size: 1.6rem;
  }

  #theme-toggle {
    position: absolute;
    top: 15px;
    right: 20px;
  }

  .post-content {
    max-width: 100%;
  }
}