/*
Theme Name: El Anglicano
Theme URI: https://elanglicano.cl
Author: El Anglicano
Description: Tema editorial, fondo blanco, con reproductor de lectura en voz alta.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 7.1
License: GNU General Public License v2 or later
Text Domain: elanglicano
*/

/* ============================ Base ============================ */
:root {
  --paper: #ffffff;
  --paper-2: #f4f1ea;
  --surface: #ffffff;
  --ink: #1b1d22;
  --ink-2: #3c3f47;
  --muted: #6d6b64;
  --line: #e4ded1;
  --accent: #7a1f2b;
  --accent-2: #a32936;
  --gold: #b08d4f;
  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1140px;
  --shadow: 0 12px 34px rgba(27,29,34,.09);
  --shadow-sm: 0 4px 14px rgba(27,29,34,.07);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="dark"] {
  --paper: #131519; --paper-2: #1a1d23; --surface: #1c2027; --ink: #ece7dd; --ink-2: #cbc6bc;
  --muted: #9c988e; --line: #2a2e37; --accent: #e0717f; --accent-2: #ef8a96; --gold: #d3b273;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 18px; line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button { font: inherit; }
.wrap, .container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.skip-link, .screen-reader-text {
  position: absolute !important; left: -999px; top: 0; background: var(--accent); color: #fff;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus, .screen-reader-text:focus { left: 0; clip: auto; width: auto; height: auto; }

/* ============================ Header ============================ */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 92px; }
.brand, .site-branding { display: flex; align-items: center; margin-right: auto; }
.brand-logo, .custom-logo { height: 62px; width: auto; }
.site-title { font-size: 1.28rem; font-weight: 600; margin: 0; }
.nav { display: flex; align-items: center; }
.nav ul.menu { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav ul.menu li a {
  display: block; font-family: var(--sans); font-size: .92rem; padding: 9px 14px;
  border-radius: 999px; color: var(--ink-2); transition: background .18s, color .18s;
}
.nav ul.menu li a:hover { background: var(--paper-2); color: var(--ink); }
.nav ul.menu li.current-menu-item > a { color: var(--accent); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 999px; cursor: pointer; background: transparent; border: 1px solid var(--line);
  color: var(--ink); transition: background .18s, border-color .18s;
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--gold); }
.nav-toggle { display: none; }

/* ============================ Botones ============================ */
.btn, .wp-block-button__link {
  display: inline-flex; align-items: center; gap: 9px; font-family: var(--sans); font-size: .95rem;
  font-weight: 600; padding: 13px 22px; border-radius: 999px; cursor: pointer;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  transition: transform .15s, background .18s, color .18s;
}
.btn:hover, .wp-block-button__link:hover { transform: translateY(-1px); color: var(--paper); background: var(--accent); border-color: var(--accent); }
.btn.ghost, .btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--gold); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ============================ Hero / portada ============================ */
.hero { padding: 56px 0 20px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; align-items: center; }
.kicker, .cat {
  font-family: var(--sans); font-size: .74rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 14px;
}
.hero h1, .hero-title { font-size: clamp(2.3rem, 5vw, 3.5rem); line-height: 1.08; margin: 0 0 18px; font-weight: 600; letter-spacing: -.01em; }
.hero .lead, .hero p { font-size: 1.18rem; color: var(--ink-2); margin: 0 0 26px; max-width: 44ch; }
.hero-media img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-badge { display: inline-block; margin-top: 14px; background: var(--accent); color: #fff; font-family: var(--sans); font-size: .76rem; padding: 9px 16px; border-radius: 999px; }

/* ============================ Secciones ============================ */
.section { padding: 54px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; font-weight: 600; }
.section-head .more { font-family: var(--sans); font-size: .9rem; color: var(--accent); font-weight: 600; white-space: nowrap; }

/* ============================ Tarjetas ============================ */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s, border-color .18s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--gold); }
.card-media, .card-thumb { aspect-ratio: 16/10; overflow: hidden; display: block; background: var(--paper-2); }
.card-media img, .card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card h3, .card-title { font-size: 1.24rem; line-height: 1.3; margin: 0 0 10px; font-weight: 600; }
.card p { margin: 0 0 16px; color: var(--ink-2); font-size: .98rem; }
.card .meta { margin-top: auto; font-family: var(--sans); font-size: .8rem; color: var(--muted); }

/* ============================ Banda ============================ */
.band { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 54px 0; }
.band-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 46px; align-items: center; }
.band img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.band h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); margin: 0 0 16px; font-weight: 600; }
.band p { color: var(--ink-2); margin: 0 0 24px; }
.rule-list { list-style: none; padding: 0; margin: 0 0 26px; }
.rule-list li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.rule-list b { color: var(--accent); font-family: var(--sans); font-size: .82rem; min-width: 34px; }

/* ============================ Archivo ============================ */
.page-head { padding: 50px 0 10px; }
.page-head h1, .archive-title { font-size: clamp(2rem, 4vw, 2.9rem); margin: 0 0 10px; font-weight: 600; }
.page-head p { color: var(--muted); margin: 0; }
.list { display: grid; gap: 18px; margin: 20px 0 30px; }
.row, .post-row { display: grid; grid-template-columns: 190px 1fr; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: transform .16s, box-shadow .16s, border-color .16s; }
.row:hover, .post-row:hover { transform: translateX(4px); box-shadow: var(--shadow-sm); border-color: var(--gold); }
.thumb { width: 100%; aspect-ratio: 16/10; border-radius: var(--radius-sm); overflow: hidden; background: var(--paper-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.row h3, .post-row h3 { margin: 0 0 6px; font-size: 1.18rem; font-weight: 600; }
.row .meta, .post-row .meta { font-family: var(--sans); font-size: .8rem; color: var(--muted); }
.row .num { font-family: var(--sans); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; display: block; margin-bottom: 4px; }

/* Paginación WP */
.navigation.pagination { display: flex; justify-content: center; margin: 8px 0 64px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-links .page-numbers {
  min-width: 42px; height: 42px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: .95rem; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.nav-links a.page-numbers:hover { border-color: var(--gold); }
.nav-links .page-numbers.current { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ============================ Artículo ============================ */
.article-hero { padding: 40px 0 0; }
.article-hero .wrap { max-width: 900px; }
.entry-title, .article-hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.1rem); line-height: 1.12; margin: 10px 0 18px; font-weight: 600; }
.entry-meta, .article-meta { font-family: var(--sans); font-size: .88rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.entry-meta a { color: var(--accent); }
.article-figure, .post-thumbnail { max-width: 1040px; margin: 30px auto 0; padding: 0 24px; }
.article-figure img, .post-thumbnail img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }

.entry-content { max-width: 900px; margin: 0 auto; padding: 40px 24px 20px; text-align: justify; text-justify: inter-word; -webkit-hyphens: auto; hyphens: auto; }
.entry-content > p:first-of-type::first-letter { float: left; font-size: 3.6rem; line-height: .8; padding: 8px 12px 0 0; color: var(--accent); font-weight: 600; }
.entry-content p { margin: 0 0 22px; }
.entry-content h2, .entry-content h3 { text-align: left; }
.entry-content img, .entry-content .wp-block-image img { border-radius: var(--radius); }
.entry-content a { color: var(--accent); text-decoration: underline; }
.entry-content blockquote { border-left: 3px solid var(--gold); padding: 6px 0 6px 22px; margin: 30px 0; font-size: 1.3rem; font-style: italic; }
.entry-content ul, .entry-content ol { padding-left: 24px; }
.entry-content .alignleft { float: left; margin: 0 20px 16px 0; }
.entry-content .alignright { float: right; margin: 0 0 16px 20px; }
.entry-content .aligncenter { margin-left: auto; margin-right: auto; }
.entry-content .wp-block-quote { text-align: left; }

.article-foot { max-width: 900px; margin: 0 auto 40px; padding: 0 24px; display: flex; gap: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.chips a { font-family: var(--sans); font-size: .82rem; color: var(--accent); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.chips a:hover { background: var(--paper-2); }

/* ============================ TTS ============================ */
.tts { max-width: 900px; margin: 34px auto 0; padding: 0 24px; }
.tts-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-sm); }
.tts-play { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; height: 46px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-family: var(--sans); font-weight: 600; font-size: .95rem; transition: background .16s, transform .12s; }
.tts-play:hover:not(:disabled) { background: var(--accent-2); transform: translateY(-1px); }
.tts-play:disabled { opacity: .5; cursor: not-allowed; }
.tts-btn { width: 42px; height: 42px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.tts-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--paper-2); }
.tts-meta { margin-left: auto; display: flex; align-items: center; gap: 10px; font-family: var(--sans); font-size: .82rem; color: var(--muted); }
.tts-speed, .tts-voice { font-family: var(--sans); font-size: .85rem; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: var(--paper); }
.tts-voice { max-width: 210px; }
.tts-progress { height: 3px; background: var(--line); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.tts-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.tts-note { font-family: var(--sans); font-size: .78rem; color: var(--muted); margin: 9px 2px 0; }
.tts.is-playing .tts-play { background: var(--ink); }
.entry-content .tts-active { background: rgba(176,141,79,.16); border-radius: 4px; box-shadow: 0 0 0 4px rgba(176,141,79,.16); }

/* ============================ Footer ============================ */
.site-footer { border-top: 1px solid var(--line); background: var(--paper); padding: 46px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
.site-footer h4, .footer-widget .widget-title { font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.site-footer a { display: block; padding: 5px 0; color: var(--ink-2); font-size: .96rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.footer-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--sans); font-size: .82rem; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.top-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font-family: var(--sans); font-weight: 600; }

/* ============================ Responsive ============================ */
@media (max-width: 960px) {
  .hero-grid, .band-grid { grid-template-columns: 1fr; }
  .hero-media { order: -1; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  body { font-size: 17px; }
  .nav { position: absolute; top: 82px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 24px 20px; display: none; }
  .nav.open { display: block; }
  .nav ul.menu { flex-direction: column; align-items: stretch; }
  .nav-toggle { display: inline-flex; }
  .cards { grid-template-columns: 1fr; }
  .row, .post-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .header-inner { min-height: 82px; }
  .brand-logo, .custom-logo { height: 54px; }
  .tts-meta { margin-left: 0; width: 100%; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
