/* =========================================
   Luis E. Pastor — Personal Site Theme
   Typography-first, minimal, clean
   ========================================= */

/* --- CSS Custom Properties --- */
:root {
  /* Layout */
  --max-width: 700px;
  --page-padding: 24px;
  --section-spacing: 48px;
  --post-gap: 32px;

  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Consolas, monospace;
  --font-size-body: 18px;
  --font-size-body-mobile: 16px;
  --line-height: 1.7;

  /* Light mode (default) */
  --bg-primary: #f5f5f5;
  --bg-secondary: #ebebeb;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --accent: #2a5298;
  --border: #e5e7eb;
  --code-bg: #e8e8e8;
}

[data-theme="dark"] {
  --bg-primary: #343434;
  --bg-secondary: #2a2a2a;
  --text-primary: #e5e5e5;
  --text-secondary: #9ca3af;
  --accent: #667eea;
  --border: #4a4a4a;
  --code-bg: #2a2a2a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #343434;
    --bg-secondary: #2a2a2a;
    --text-primary: #e5e5e5;
    --text-secondary: #9ca3af;
    --accent: #667eea;
    --border: #4a4a4a;
    --code-bg: #2a2a2a;
  }
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-body);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  line-height: var(--line-height);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-padding);
  width: 100%;
}

main {
  flex: 1;
  padding: var(--section-spacing) 0;
}

/* --- Links --- */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

h1 { font-size: 1.78rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.17rem; }
h4 { font-size: 1rem; }

p {
  margin-bottom: 1.5em;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.2em;
  margin: 1.5em 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

ul, ol {
  padding-left: 1.5em;
  margin-bottom: 1.5em;
}

li {
  margin-bottom: 0.4em;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1.2em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5em 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.83rem;
}

/* --- Header (amie.so inspired with glass effect) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .site-header {
  background: rgba(29, 29, 29, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-brand a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.site-brand a:hover {
  opacity: 0.8;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1;
}

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

.site-nav a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
  font-weight: 500;
}

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

/* --- Theme Toggle --- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--text-primary);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: inline;
}

/* Default (no data-theme set): follow system preference */
:root:not([data-theme]) .theme-toggle .icon-sun {
  display: none;
}
:root:not([data-theme]) .theme-toggle .icon-moon {
  display: inline;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun {
    display: inline;
  }
  :root:not([data-theme]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* --- Mobile Menu --- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: 4px;
  line-height: 1;
}

@media (max-width: 640px) {
  .header-container {
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
  }

  .menu-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    margin-top: 1rem;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    font-size: 1rem;
  }

  html {
    font-size: var(--font-size-body-mobile);
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  :root {
    --page-padding: 32px;
  }
}

@media (min-width: 769px) {
  :root {
    --page-padding: 32px;
  }
}

/* --- Hero Section (Homepage) --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 48px 40px;
  background: var(--bg-primary);
  position: relative;
}

.hero-heading {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  text-align: center;
  margin-top: 0;
  margin-bottom: 15px;
  letter-spacing: -1px;
}

.hero-heading .name {
  background: linear-gradient(135deg, #4A90D9 0%, #6BB5FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-heading .hero-subline {
  font-weight: 400;
  font-size: 0.82em;
  background: linear-gradient(135deg, #4A90D9 0%, #6BB5FF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  max-width: 600px;
}

.latest-post {
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  max-width: 260px;
}

.latest-post a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.latest-post a:hover {
  color: #4A90D9;
}

.magazine-cover {
  width: 180px;
  max-width: 30vw;
  transform: rotate(6deg);
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
}

.magazine-cover:hover {
  transform: rotate(2deg) scale(1.04);
}

@media (max-width: 640px) {
  .hero {
    padding: 10px 24px 30px;
  }

  .hero-heading {
    margin-bottom: 20px;
  }

  .hero-bottom {
    flex-direction: column;
    gap: 24px;
    text-align: center;
  }

  .latest-post {
    max-width: none;
  }

  .magazine-cover {
    width: 140px;
  }
}

/* --- Post Feed (Homepage & Blog Index) --- */
.post-feed {
  list-style: none;
  padding: 0;
}

.post-entry {
  padding: var(--post-gap) 0;
  border-bottom: 1px solid var(--border);
}

.post-entry:first-child {
  padding-top: 0;
}

.post-entry:last-child {
  border-bottom: none;
}

.post-entry-title {
  font-size: 1.11rem;
  font-weight: 600;
  margin: 0 0 0.3em 0;
  line-height: 1.3;
}

.post-entry-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.post-entry-title a:hover {
  color: var(--accent);
}

.post-entry-excerpt {
  color: var(--text-secondary);
  font-size: 0.89rem;
  margin-bottom: 0.5em;
  line-height: 1.5;
}

.post-entry-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.post-entry-meta .lang-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.67rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.category-label {
  color: var(--accent);
  font-weight: 500;
}

/* --- Category Filter Tabs --- */
.category-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: var(--section-spacing);
  flex-wrap: wrap;
}

.category-tabs a,
.category-tabs button {
  font-size: 0.83rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding-bottom: 4px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.category-tabs a:hover,
.category-tabs a.active,
.category-tabs button:hover,
.category-tabs button.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* --- Single Post --- */
.post-header {
  margin-bottom: 2rem;
}

.post-title {
  font-size: 1.78rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}

.post-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.post-meta .separator {
  color: var(--border);
}

.post-content {
  margin-bottom: var(--section-spacing);
}

.post-content h1 { font-size: 1.56rem; }
.post-content h2 { font-size: 1.33rem; margin-top: 2.5em; }
.post-content h3 { font-size: 1.11rem; margin-top: 2em; }

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* --- Post Tags --- */
.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 2rem 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-tags a {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 3px 10px;
  border-radius: 3px;
  text-decoration: none;
  transition: color 0.15s;
}

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

/* --- Post Navigation --- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.89rem;
}

.post-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  max-width: 48%;
}

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

.post-nav .nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

/* --- Subscribe CTA --- */
.subscribe-cta {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin: var(--section-spacing) 0;
  text-align: center;
}

.subscribe-cta h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.11rem;
}

.subscribe-cta p {
  color: var(--text-secondary);
  font-size: 0.89rem;
  margin-bottom: 1rem;
}

.subscribe-cta .subscribe-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1.5rem;
  border-radius: 5px;
  font-size: 0.89rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.subscribe-cta .subscribe-link:hover {
  opacity: 0.9;
  text-decoration: none;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: space-between;
  padding-top: 2rem;
  font-size: 0.89rem;
}

.pagination a {
  color: var(--text-secondary);
}

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

/* --- Page Title (for static pages) --- */
.page-title {
  font-size: 1.78rem;
  font-weight: 700;
  margin-bottom: 2rem;
  line-height: 1.2;
}

/* --- Speaking Page --- */
.talks-year {
  margin-bottom: var(--section-spacing);
}

.talks-year h2 {
  font-size: 1.17rem;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.talk-entry {
  margin-bottom: 1.5rem;
}

.talk-title {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.talk-event {
  font-size: 0.89rem;
  color: var(--text-secondary);
}

.talk-links {
  font-size: 0.83rem;
  margin-top: 0.3rem;
}

.talk-links a {
  margin-right: 1rem;
}

/* --- Publications Page --- */
.publication-group {
  margin-bottom: var(--section-spacing);
}

.publication-group h2 {
  font-size: 1.17rem;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.publication-entry {
  margin-bottom: 1rem;
}

.publication-entry a {
  font-weight: 500;
}

.publication-entry .pub-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* --- Contact --- */
.contact-links {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
}

.contact-links li {
  margin-bottom: 0.75rem;
  font-size: 0.94rem;
}

/* --- Footer (amie.so inspired) --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-columns {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1rem 0;
}

.footer-col p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.6;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .footer-columns {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-container {
    padding: 0 1.5rem;
  }
}

/* --- About Page --- */
.about-content {
  font-size: 1rem;
}

.about-content h2 {
  margin-top: 2.5rem;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  list-style: none;
  padding: 0;
}

.social-links a {
  color: var(--text-secondary);
  font-size: 0.89rem;
}

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