@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --paper: #FAFAF7;
  --paper-card: #FFFFFF;
  --ink: #16181A;
  --ink-soft: #55585C;
  --ink-faint: #9A9D9F;
  --line: #E4E3DE;
  --accent: #2F5D50;
  --accent-soft: #E7EFEC;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

html.dark {
  --paper: #15171A;
  --paper-card: #1D2023;
  --ink: #F2F1EC;
  --ink-soft: #B7BAB9;
  --ink-faint: #787C7B;
  --line: #2C2F32;
  --accent-soft: #1E2E29;
}

* { box-sizing: border-box; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  margin: 0;
  line-height: 1.5;
  transition: background .3s ease, color .3s ease;
}

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

.p-container { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* Masthead */
.p-masthead {
  padding: 40px 0 20px;
  text-align: center;
  position: relative;
}
.p-logo { display: inline-flex; align-items: center; gap: 10px; }
.p-logo-img { height: 68px; width: auto; display: block; }
.p-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); display: inline-block;
  animation: p-pulse 3s ease-in-out infinite; flex-shrink: 0;
}
@keyframes p-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.p-logo-text {
  font-family: var(--font-display); font-size: 32px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink);
}
.p-tagline {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-faint); margin-top: 8px;
}
.p-today {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em;
  color: var(--ink-faint); margin-top: 6px; opacity: 0.85;
}

/* Interruptor de modo claro/oscuro */
.moon-toggle {
  position: absolute; top: 40px; right: 24px;
  width: 52px; height: 28px; border-radius: 999px;
  background: var(--ink); border: 1px solid var(--line);
  cursor: pointer; padding: 3px; display: flex; align-items: center;
  justify-content: flex-start; transition: background .3s;
}
.moon-toggle.on { justify-content: flex-end; }
.moon-toggle .knob {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.moon-toggle svg { width: 12px; height: 12px; }

/* Nav */
.p-nav {
  display: flex; align-items: center; justify-content: center;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 12px 0; gap: 12px; flex-wrap: wrap;
}
.p-chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.p-chip {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; background: none; border: none; color: var(--ink-faint);
  padding: 7px 12px; cursor: pointer; border-radius: 3px; position: relative;
  transition: color .15s;
}
.p-chip::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform .25s ease;
}
.p-chip:hover::after, .p-chip.active::after { transform: scaleX(1); }
.p-chip.active, .p-chip:hover { color: var(--ink); }

.p-new-btn {
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  background: var(--ink); color: var(--paper); border: none;
  padding: 9px 16px; border-radius: 3px; cursor: pointer; white-space: nowrap;
  transition: opacity .15s; display: inline-block;
}
.p-new-btn:hover { opacity: .85; }

/* Featured */
@keyframes p-fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.p-featured {
  padding: 40px 0 32px; border-bottom: 1px solid var(--line); display: block;
  animation: p-fade-up .5s ease both;
}
.p-eyebrow {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--accent); display: flex; align-items: center;
  gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.p-eyebrow .sep { color: var(--ink-faint); }
.cat-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.p-featured h1 {
  font-family: var(--font-display); font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 14px;
}
.p-featured p { font-size: 17px; color: var(--ink-soft); max-width: 640px; margin: 0; }
.p-featured-img {
  width: 100%; max-height: 340px; object-fit: cover; border-radius: 8px; margin-top: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Grid */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 24px; padding: 32px 0 60px; }
.p-card {
  display: block; border-radius: 8px; transition: transform .25s ease, box-shadow .25s ease;
  animation: p-fade-up .5s ease both;
}
.p-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,0.09); }
.p-card-img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 12px; background: var(--accent-soft); }
.p-card h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.25; margin: 0 0 8px; }
.p-card p { font-size: 14px; color: var(--ink-soft); margin: 0; }

/* Detail */
.p-back {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-faint); display: inline-block; padding: 20px 0 0;
}
.p-back:hover { color: var(--accent); }
.p-detail { padding: 20px 0 80px; max-width: 700px; }
.p-detail h1 { font-family: var(--font-display); font-size: clamp(30px, 5vw, 46px); font-weight: 600; line-height: 1.1; margin: 14px 0 18px; }
.p-detail-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 4px; margin: 20px 0; }
.p-detail-body { font-size: 17px; color: var(--ink); line-height: 1.7; }
.p-detail-body p { margin: 0 0 1.1em; }
.p-detail-body a { color: var(--accent); text-decoration: underline; }
.p-detail-body h2, .p-detail-body h3, .p-detail-body h4 { font-family: var(--font-display); margin: 1.3em 0 .5em; }
.p-detail-body blockquote { margin: 1.2em 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.p-signature {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* Empty & loading */
.p-empty { padding: 80px 0; text-align: center; }
.p-empty .p-dot { margin: 0 auto 16px; }
.p-empty h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 0 0 8px; }
.p-empty p { color: var(--ink-soft); font-size: 15px; margin: 0 0 20px; }

/* Panel / forms */
.p-panel { padding: 32px 0 80px; max-width: 620px; }
.p-panel h2 { font-family: var(--font-display); font-size: 28px; font-weight: 600; margin: 4px 0 24px; }
.p-field { margin-bottom: 18px; }
.p-field label {
  display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-soft); margin-bottom: 6px;
}
.p-field input, .p-field select, .p-field textarea {
  width: 100%; font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--paper-card); border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px;
}
.p-field textarea { resize: vertical; min-height: 90px; }
.p-field.two { display: flex; gap: 14px; }
.p-field.two > div { flex: 1; }
.p-form-error { font-size: 13px; color: #A83B32; background: #FBEAE8; padding: 10px 14px; border-radius: 3px; margin-bottom: 16px; }
.p-form-success { font-size: 13px; color: var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 3px; margin-bottom: 16px; }
.p-submit-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.p-cancel { font-family: var(--font-body); font-size: 13px; background: none; border: none; color: var(--ink-soft); cursor: pointer; padding: 9px 12px; }
.p-cancel:hover { color: var(--ink); }

/* Admin list */
.p-manage-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--line); gap: 12px;
}
.p-manage-row h4 { font-family: var(--font-display); font-size: 17px; margin: 0 0 4px; font-weight: 600; }
.p-manage-row .meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.p-delete-link { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); border: 1px solid var(--line); padding: 8px 12px; border-radius: 3px; white-space: nowrap; }
.p-delete-link:hover { color: #A83B32; border-color: #A83B32; }

/* Login */
.p-login-wrap { max-width: 360px; margin: 80px auto; padding: 0 24px; }
.p-login-wrap h2 { font-family: var(--font-display); font-size: 26px; margin-bottom: 20px; }

.p-admin-bar {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-faint); text-align: right; padding: 10px 0;
}
.p-admin-bar a { color: var(--accent); margin-left: 12px; }

@media (prefers-reduced-motion: reduce) { .p-dot { animation: none; } .p-card, .p-featured { animation: none; } }

/* Footer */
.p-footer {
  margin-top: 20px; padding: 34px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.p-footer-social { display: flex; justify-content: center; gap: 12px; margin-bottom: 16px; }
.p-social-badge {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; flex-shrink: 0; transition: background .15s, border-color .15s, color .15s;
}
.p-social-badge:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.p-footer-copy { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }

@media (max-width: 640px) {
  .moon-toggle { right: 12px; top: 36px; }
}
