/* ============================================================
   MANU CONTRERAS — stylesheet
   Fonts: Inter (variable) + Fraunces (display serif)
   ============================================================ */

:root {
  --bg:      #ffffff;
  --bg2:     #f5f5f5;
  --text:    #0f0f0f;
  --mid:     #3a3a3a;
  --muted:   #767676;
  --faint:   #b0b0b0;
  --border:  #e8e8e8;
  --accent:  #16803c;
  --accent2: #d97757;
  --w:       780px;
  --serif:   'Fraunces', Georgia, serif;
}

[data-theme="dark"] {
  --bg:      #1c1c1e;
  --bg2:     #242426;
  --text:    #f0efed;
  --mid:     #c8c6c2;
  --muted:   #8e8e93;
  --faint:   #58585a;
  --border:  #333335;
  --accent:  #4ade80;
  --accent2: #e8956a;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
strong { font-weight: 600; }

.wrap {
  width: 100%;
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 24px;
}

.main { flex: 1; }

/* ── Floating nav ──────────────────────────────────────────── */
.nav-outer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  pointer-events: none;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 5px 8px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.04);
  pointer-events: all;
}

[data-theme="dark"] .nav-inner {
  box-shadow: 0 2px 20px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
}

.logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  padding: 5px 14px;
  border-radius: 9999px;
  transition: color 0.15s;
}
.logo:hover { color: var(--accent); }

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  padding: 5px 14px;
  border-radius: 9999px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover  { color: var(--text); background: var(--bg2); }
.nav-link.active { color: var(--text); font-weight: 500; }

.nav-btn {
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 9999px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
  line-height: 1;
}
.nav-btn:hover { color: var(--text); background: var(--bg2); }

/* ── Home ──────────────────────────────────────────────────── */
.home { padding: 72px 0 120px; }

.intro { margin-bottom: 64px; }

.intro-name {
  font-family: var(--serif);
  font-size: clamp(48px, 9vw, 72px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 24px;
  color: var(--text);
}
.intro-name span { color: var(--accent); }

.intro-bio {
  font-size: 18px;
  font-weight: 300;
  color: var(--mid);
  line-height: 1.65;
  max-width: 520px;
  margin-bottom: 28px;
}

.intro-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.intro-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.intro-link:hover { color: var(--text); }
.intro-link svg { width: 14px; height: 14px; flex-shrink: 0; }

.home-about {
  border-top: 1px solid var(--border);
  padding-top: 48px;
  margin-bottom: 64px;
}
.home-about p {
  font-size: 15px;
  color: var(--mid);
  line-height: 1.8;
  margin-bottom: 14px;
}
.home-about p:last-child { margin: 0; }

.sh {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 20px;
}

/* ── Post list ─────────────────────────────────────────────── */
.posts { border-top: 1px solid var(--border); }

.post-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.post-date {
  font-size: 13px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.post-cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 4px;
}

.post-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
  transition: color 0.15s;
}
.post-title:hover { color: var(--accent); }

.post-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 300;
}

.all-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 28px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  transition: gap 0.15s;
}
.all-link:hover { gap: 10px; }

/* ── Shared page sections ──────────────────────────────────── */
.notes-page { padding: 64px 0 120px; }
.post-page  { padding: 64px 0 120px; }
.about-page { padding: 64px 0 120px; }

.page-head { margin-bottom: 48px; }

.page-title {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 10px;
}

.page-desc {
  font-size: 16px;
  color: var(--muted);
  font-weight: 300;
}

/* ── Article ───────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--text); }

.post-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 14px;
}

.post-h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: 16px;
}

.post-deck {
  font-size: 18px;
  font-weight: 300;
  color: var(--mid);
  line-height: 1.6;
  margin-bottom: 28px;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.post-byline-name { font-weight: 500; color: var(--text); }
.byline-sep       { color: var(--faint); }

.post-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--mid);
  border-top: 1px solid var(--border);
  padding-top: 40px;
  margin-top: 40px;
}
.post-content p          { margin-bottom: 24px; }
.post-content ul,
.post-content ol         { margin: 0 0 24px 24px; }
.post-content li         { margin-bottom: 6px; }
.post-content h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 48px 0 16px;
}
.post-content h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}
.post-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 20px;
  margin: 32px 0;
  color: var(--muted);
  font-style: italic;
  font-weight: 300;
}
.post-content code {
  font-size: 0.9em;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
}
.post-content pre {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 24px;
}
.post-content pre code { background: none; border: none; padding: 0; font-size: 14px; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.post-nav-row {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; }

.pn-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}
.pn-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.15s;
}
.pn-title:hover { color: var(--text); }

/* ── About page ────────────────────────────────────────────── */
.about-content {
  font-size: 16px;
  line-height: 1.85;
  color: var(--mid);
}
.about-content p  { margin-bottom: 20px; }
.about-content h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 48px 0 20px;
}
.about-content a { color: var(--accent); }

/* About photo */
.about-photo {
  float: right;
  margin: 0.25rem 0 2rem 2.5rem;
  shape-outside: border-box;
}
.about-photo img {
  width: 340px;
  height: auto;
  display: block;
  border-radius: 4px;
  border: 8px solid #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  transform: rotate(2deg);
  filter: grayscale(100%);
}
[data-theme="dark"] .about-photo img {
  border-color: #1e1e1e;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
}
@media (max-width: 640px) {
  .about-photo {
    float: none;
    margin: 0 0 2rem 0;
  }
  .about-photo img {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }
}

.contact-list { display: flex; flex-direction: column; }

.contact-item {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  text-decoration: none;
}
.contact-item:first-child { border-top: 1px solid var(--border); }
.contact-type {
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.contact-val {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  transition: color 0.15s;
}
.contact-item:hover .contact-val { color: var(--text); }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-copy { font-size: 13px; color: var(--faint); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 13px; color: var(--faint); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ── Mobile nav ────────────────────────────────────────────── */
.nav-hamburger { display: none; }
.nav-dropdown  { display: none; }

@media (max-width: 640px) {
  .nav-outer { padding: 10px 16px; }

  .nav-inner { width: 100%; justify-content: space-between; }
  .nav-links { display: none; }
  .nav-sep   { display: none; }
  .nav-btn   { display: none; }

  .nav-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 9999px;
    transition: background 0.15s;
  }
  .nav-hamburger:hover { background: var(--bg2); }
  .nav-hamburger span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.22s;
    transform-origin: center;
  }
  .nav-hamburger.open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .nav-hamburger.open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

  .nav-dropdown {
    position: absolute;
    top: calc(100% - 8px);
    left: 16px;
    right: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    flex-direction: column;
    gap: 2px;
    pointer-events: all;
    z-index: 50;
    animation: fadeDown 0.15s ease;
  }
  [data-theme="dark"] .nav-dropdown {
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
  }
  .nav-dropdown.open { display: flex; }

  @keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .nav-dropdown-link {
    font-size: 15px;
    font-weight: 400;
    color: var(--mid);
    padding: 11px 16px;
    border-radius: 11px;
    text-decoration: none;
    display: block;
    transition: color 0.15s, background 0.15s;
  }
  .nav-dropdown-link:hover { color: var(--text); background: var(--bg2); }
  .nav-dropdown-link.on    { color: var(--text); font-weight: 600; }

  .nav-dropdown-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 8px;
  }

  .nav-dropdown-theme {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
    padding: 11px 16px;
    border-radius: 11px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    text-align: left;
    transition: color 0.15s, background 0.15s;
  }
  .nav-dropdown-theme:hover { color: var(--text); background: var(--bg2); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  .home  { padding: 48px 0 80px; }
  .intro { margin-bottom: 48px; }
  .post-row     { grid-template-columns: 1fr; gap: 4px; }
  .post-date    { font-size: 12px; padding-top: 0; }
  .contact-item { grid-template-columns: 1fr; gap: 2px; padding: 12px 0; }
  .post-nav-row { flex-direction: column; gap: 12px; }
  .post-nav-next { text-align: left; }
  .footer-inner { flex-direction: column; gap: 12px; }
}
