/*
Theme Name: Teófilo Math Professional
Theme URI: https://teofiloteves.com/
Author: Teófilo Teves
Author URI: https://teofiloteves.com/
Description: Tema profesional y responsive para un matemático, con listados visuales de publicaciones, soporte MathJax y lightbox con zoom para imágenes destacadas.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: teofilo-math-professional
*/

:root {
  --tm-bg: #f7f6f2;
  --tm-surface: #ffffff;
  --tm-ink: #172033;
  --tm-muted: #677084;
  --tm-accent: #b3822e;
  --tm-accent-dark: #805a17;
  --tm-navy: #0f2747;
  --tm-line: #e3dfd6;
  --tm-shadow: 0 10px 30px rgba(15, 39, 71, .08);
  --tm-radius: 16px;
  --tm-max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--tm-bg);
  color: var(--tm-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--tm-navy); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { color: var(--tm-accent-dark); }
button, input, textarea { font: inherit; }

.tm-container { width: min(calc(100% - 32px), var(--tm-max)); margin-inline: auto; }
.tm-skip-link { position: absolute; left: -9999px; }
.tm-skip-link:focus { left: 16px; top: 16px; z-index: 99999; background: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--tm-shadow); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 246, 242, .94);
  border-bottom: 1px solid rgba(15,39,71,.08);
  backdrop-filter: blur(14px);
}
.admin-bar .site-header { top: 32px; }
.tm-header-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.tm-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.custom-logo { max-height: 54px; width: auto; }
.tm-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.tm-site-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: clamp(1.2rem, 2vw, 1.65rem); letter-spacing: -.02em; }
.tm-site-title a { text-decoration: none; color: var(--tm-navy); }
.tm-tagline { margin-top: 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tm-muted); }

.tm-nav-toggle { display: none; border: 1px solid var(--tm-line); background: #fff; border-radius: 10px; padding: 9px 12px; cursor: pointer; color: var(--tm-navy); }
.tm-main-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin: 0; padding: 0; }
.tm-main-nav a { display: block; padding: 10px 2px; font-size: .94rem; font-weight: 650; text-decoration: none; color: var(--tm-navy); }
.tm-main-nav a:hover, .tm-main-nav .current-menu-item > a { color: var(--tm-accent-dark); }

.tm-hero { padding: clamp(42px, 8vw, 90px) 0 36px; }
.tm-hero-card {
  background: linear-gradient(135deg, #0e2748, #17395f 68%, #2d5276);
  color: white;
  border-radius: 24px;
  padding: clamp(32px, 6vw, 66px);
  box-shadow: var(--tm-shadow);
  position: relative;
  overflow: hidden;
}
.tm-hero-card::after {
  content: "∫  ∑  ∞  √  π";
  position: absolute;
  right: 30px;
  bottom: -10px;
  font-family: Georgia, serif;
  font-size: clamp(42px, 7vw, 86px);
  letter-spacing: .12em;
  color: rgba(255,255,255,.06);
  white-space: nowrap;
}
.tm-kicker { color: #e4bf73; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: .75rem; }
.tm-hero h1 { margin: 10px 0 12px; max-width: 800px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 5vw, 4.3rem); line-height: 1.06; letter-spacing: -.035em; }
.tm-hero p { margin: 0; max-width: 700px; font-size: clamp(1rem, 2vw, 1.2rem); color: rgba(255,255,255,.82); }

.site-main { min-height: 55vh; }
.tm-section { padding: 32px 0 70px; }
.tm-section-title { margin: 0 0 22px; font-family: Georgia, serif; color: var(--tm-navy); font-size: clamp(1.7rem, 3vw, 2.5rem); }
.tm-archive-description { max-width: 760px; color: var(--tm-muted); margin: -10px 0 28px; }

.tm-post-list { display: grid; gap: 18px; }
.tm-post-card {
  display: grid;
  grid-template-columns: minmax(220px, 34%) 1fr;
  gap: 0;
  overflow: hidden;
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  box-shadow: 0 8px 26px rgba(15,39,71,.05);
  transition: transform .2s ease, box-shadow .2s ease;
}
.tm-post-card:hover { transform: translateY(-2px); box-shadow: var(--tm-shadow); }
.tm-post-thumb { position: relative; min-height: 220px; background: #e9e6df; overflow: hidden; }
.tm-post-thumb a { display: block; width: 100%; height: 100%; }
.tm-post-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transition: transform .35s ease; }
.tm-post-card:hover .tm-post-thumb img { transform: scale(1.025); }
.tm-post-placeholder { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg,#e8edf4,#f7f3ea); color: #8c94a2; font-family: Georgia, serif; font-size: 2.2rem; }
.tm-post-body { padding: clamp(22px, 3vw, 34px); display: flex; flex-direction: column; justify-content: center; }
.tm-cats { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.tm-cat { display: inline-flex; align-items: center; border: 1px solid #dbc69d; background: #fbf4e5; color: #7a571c; padding: 4px 9px; border-radius: 999px; font-size: .74rem; font-weight: 800; text-decoration: none; letter-spacing: .03em; text-transform: uppercase; }
.tm-cat:hover { background: #f2e3c3; color: #684812; }
.tm-post-title { margin: 0; font-family: Georgia, serif; font-size: clamp(1.35rem, 2.3vw, 2rem); line-height: 1.18; letter-spacing: -.015em; }
.tm-post-title a { color: var(--tm-navy); text-decoration: none; }
.tm-post-meta { margin: 10px 0 0; color: var(--tm-muted); font-size: .84rem; }
.tm-post-excerpt { margin: 12px 0 0; color: #4e586d; }

.tm-pagination { margin-top: 32px; }
.tm-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-pagination .page-numbers { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--tm-line); border-radius: 9px; background: #fff; text-decoration: none; }
.tm-pagination .current { background: var(--tm-navy); color: #fff; border-color: var(--tm-navy); }

.tm-article-wrap { padding: clamp(28px, 6vw, 64px) 0 80px; }
.tm-article {
  width: min(100%, 920px);
  margin: 0 auto;
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: 20px;
  box-shadow: var(--tm-shadow);
  overflow: hidden;
}
.tm-article-header { padding: clamp(28px, 5vw, 52px) clamp(22px, 6vw, 66px) 28px; }
.tm-article-title { margin: 10px 0 14px; font-family: Georgia, serif; color: var(--tm-navy); font-size: clamp(2rem, 5vw, 4rem); line-height: 1.07; letter-spacing: -.03em; }
.tm-featured-wrap { padding: 0 clamp(16px, 4vw, 42px); }
.tm-featured-link { display: block; position: relative; overflow: hidden; border-radius: 14px; cursor: zoom-in; background: #eef0f3; }
.tm-featured-link img { display: block; width: 100%; height: auto; }
.tm-featured-link::after { content: "🔍  Ampliar"; position: absolute; right: 14px; bottom: 14px; background: rgba(15,39,71,.86); color: #fff; padding: 8px 11px; border-radius: 9px; font-size: .78rem; font-weight: 700; opacity: .92; }
.tm-entry-content { padding: clamp(28px, 5vw, 54px) clamp(22px, 6vw, 66px) 58px; }
.tm-entry-content > *:first-child { margin-top: 0; }
.tm-entry-content h2, .tm-entry-content h3, .tm-entry-content h4 { color: var(--tm-navy); font-family: Georgia, serif; line-height: 1.2; margin-top: 1.65em; }
.tm-entry-content h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.tm-entry-content h3 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); }
.tm-entry-content blockquote { border-left: 4px solid var(--tm-accent); margin: 1.6em 0; padding: .3em 1.2em; color: #455065; background: #faf7f0; }
.tm-entry-content table { width: 100%; border-collapse: collapse; overflow-x: auto; display: block; }
.tm-entry-content th, .tm-entry-content td { border: 1px solid var(--tm-line); padding: 10px 12px; }
.tm-entry-content pre { overflow: auto; padding: 16px; background: #101827; color: #f5f7fb; border-radius: 12px; }
.tm-entry-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

.tm-page { width: min(100%, 920px); margin: 0 auto; background: white; border: 1px solid var(--tm-line); border-radius: 20px; padding: clamp(28px, 6vw, 64px); box-shadow: var(--tm-shadow); }
.tm-page h1 { font-family: Georgia, serif; color: var(--tm-navy); font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; }

.site-footer { border-top: 1px solid var(--tm-line); padding: 32px 0 44px; color: var(--tm-muted); }
.tm-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.tm-footer-brand { color: var(--tm-navy); font-family: Georgia, serif; font-weight: 700; }

/* Lightbox */
.tm-lightbox[hidden] { display: none !important; }
.tm-lightbox { position: fixed; inset: 0; z-index: 999999; background: rgba(5, 11, 20, .95); display: grid; grid-template-rows: auto 1fr; color: #fff; }
.tm-lightbox-toolbar { min-height: 58px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; padding: 8px 12px; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.12); }
.tm-lightbox-btn { display: inline-grid; place-items: center; min-width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; border-radius: 10px; cursor: pointer; font-size: 1.05rem; }
.tm-lightbox-btn:hover, .tm-lightbox-btn:focus-visible { background: rgba(255,255,255,.16); outline: 2px solid rgba(255,255,255,.55); outline-offset: 2px; }
.tm-lightbox-stage { position: relative; overflow: auto; display: grid; place-items: center; padding: 26px; }
.tm-lightbox-image { display: block; max-width: 94vw; max-height: calc(100vh - 112px); width: auto; height: auto; transform-origin: center center; transition: transform .16s ease; user-select: none; -webkit-user-drag: none; cursor: zoom-in; }
.tm-lightbox-caption { position: fixed; left: 18px; top: 18px; max-width: min(58vw, 720px); color: rgba(255,255,255,.82); font-size: .85rem; pointer-events: none; }
body.tm-lightbox-open { overflow: hidden; }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 840px) {
  .admin-bar .site-header { top: 46px; }
  .tm-nav-toggle { display: inline-flex; }
  .tm-main-nav { display: none; position: absolute; left: 16px; right: 16px; top: calc(100% + 8px); background: #fff; border: 1px solid var(--tm-line); border-radius: 14px; box-shadow: var(--tm-shadow); padding: 10px 16px; }
  .tm-main-nav.is-open { display: block; }
  .tm-main-nav ul { display: block; }
  .tm-main-nav a { padding: 11px 4px; border-bottom: 1px solid #efede7; }
  .tm-post-card { grid-template-columns: 1fr; }
  .tm-post-thumb { min-height: 0; aspect-ratio: 16 / 9; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .tm-container { width: min(calc(100% - 20px), var(--tm-max)); }
  .tm-header-inner { min-height: 68px; }
  .tm-tagline { display: none; }
  .tm-hero { padding-top: 24px; }
  .tm-hero-card { border-radius: 18px; }
  .tm-article { border-radius: 14px; }
  .tm-featured-link::after { content: "🔍"; padding: 8px 10px; }
  .tm-lightbox-stage { padding: 10px; }
  .tm-lightbox-caption { display: none; }
}
