/* ============================================
   Enrique Fernández-Macías — Academic Website
   Warm, informal, research-oriented aesthetic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --slate: #3b4252;
  --slate-light: #4c566a;
  --slate-dark: #2e3440;
  --rust: #bf616a;
  --rust-light: #d08770;
  --rust-subtle: #faf0eb;
  --teal: #5e8b7e;
  --teal-light: #8fbcbb;
  --text: #3b4252;
  --text-light: #5c6370;
  --text-muted: #9199a5;
  --bg: #fdfcfa;
  --bg-white: #ffffff;
  --bg-warm: #f7f3ee;
  --bg-sand: #f0ebe3;
  --border: #e5dfd7;
  --border-light: #eeebe6;
  --serif: 'Lora', Georgia, serif;
  --sans: 'IBM Plex Sans', -apple-system, sans-serif;
  --max-width: 960px;
  --nav-height: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.72;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--rust); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.3; color: var(--slate); }
h1 { font-size: 2.2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin-bottom: 0.7rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
p { margin-bottom: 1rem; }

.lead {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--text-light);
  font-style: italic;
}

.label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rust);
  display: block;
  margin-bottom: 0.4rem;
}

/* --- Navigation --- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(253, 252, 250, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  height: var(--nav-height);
}
.nav-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 2rem;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: var(--serif); font-size: 1rem; font-weight: 600;
  color: var(--slate); white-space: nowrap;
}
.nav-logo:hover { color: var(--rust); }
.nav-links { display: flex; gap: 0.15rem; list-style: none; }
.nav-links a {
  display: block; padding: 0.4rem 0.7rem; font-size: 0.8rem; font-weight: 500;
  color: var(--text-light); border-radius: 5px; transition: all 0.2s;
}
.nav-links a:hover { color: var(--slate); background: var(--bg-warm); }
.nav-links a.active { color: var(--rust); background: var(--rust-subtle); }

.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0.5rem; color: var(--slate); }
.nav-toggle svg { width: 22px; height: 22px; }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }
.section { padding: 3.5rem 0; }

/* --- Hero --- */
.hero { padding: 3.5rem 0 3rem; }
.hero-grid { display: grid; grid-template-columns: 1fr 280px; gap: 3rem; align-items: start; }
.hero-text h1 { margin-bottom: 1rem; }
.hero-text .lead { margin-bottom: 1rem; font-style: normal; }

.hero-photo {
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid var(--bg-sand);
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.hero-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.hero-photo-placeholder {
  width: 100%; aspect-ratio: 4/5;
  background: linear-gradient(145deg, var(--bg-sand) 0%, var(--border) 100%);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.82rem; text-align: center; padding: 1.5rem; line-height: 1.5;
}

.hero-links {
  display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.2rem; padding-top: 1.2rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.85rem;
}
.hero-links a { font-weight: 500; }

/* --- Warm banner --- */
.banner {
  background: var(--slate);
  color: rgba(255,255,255,0.85);
  padding: 3rem 0;
}
.banner h2 { color: #fff; font-size: 1.4rem; }
.banner p { font-size: 0.92rem; line-height: 1.65; }
.banner-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 1.5rem; }
.banner-col { padding: 1.2rem; background: rgba(255,255,255,0.06); border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); }
.banner-col h3 { color: var(--rust-light); font-size: 1rem; margin-bottom: 0.4rem; }
.banner-col p { font-size: 0.85rem; color: rgba(255,255,255,0.65); margin: 0; }

/* --- Cards --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.card {
  background: var(--bg-white); border: 1px solid var(--border-light); border-radius: 8px;
  padding: 1.5rem; transition: all 0.3s;
}
.card:hover { border-color: var(--border); box-shadow: 0 3px 15px rgba(0,0,0,0.04); }
.card h3 { font-size: 1.05rem; }
.card h3 a { color: var(--slate); }
.card h3 a:hover { color: var(--rust); }
.card p { font-size: 0.88rem; color: var(--text-light); line-height: 1.6; }
.card .tag {
  display: inline-block; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--teal); background: #eef5f2; padding: 0.2rem 0.5rem;
  border-radius: 3px; margin-bottom: 0.6rem;
}

/* --- Page header --- */
.page-header { padding: 3rem 0 2rem; border-bottom: 1px solid var(--border); }
.page-header .lead { max-width: 640px; }

/* --- Research themes --- */
.theme-block { padding: 2.5rem 0; border-bottom: 1px solid var(--border-light); }
.theme-block:last-child { border-bottom: none; }
.theme-header { margin-bottom: 1rem; }
.theme-body { max-width: 720px; }
.theme-body p { font-size: 0.93rem; color: var(--text-light); }

.theme-pubs { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--border-light); }
.theme-pubs h4 {
  font-family: var(--sans); font-size: 0.73rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.6rem;
}

.pub-item {
  padding: 0.5rem 0; border-bottom: 1px solid var(--border-light);
  font-size: 0.86rem; line-height: 1.55; color: var(--text-light);
}
.pub-item:last-child { border-bottom: none; }
.pub-item a { font-weight: 500; }
.pub-item .pub-year { display: inline-block; font-size: 0.73rem; font-weight: 600; color: var(--text-muted); min-width: 3rem; }

/* --- Publications page --- */
.pub-section { padding: 2rem 0; border-bottom: 1px solid var(--border-light); }
.pub-section:last-child { border-bottom: none; }
.pub-section h2 {
  font-size: 1.25rem; margin-bottom: 1rem; padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--rust); display: inline-block;
}
.pub-list { list-style: none; }
.pub-list li {
  padding: 0.55rem 0; border-bottom: 1px solid var(--border-light);
  font-size: 0.86rem; line-height: 1.6; color: var(--text-light);
}
.pub-list li:last-child { border-bottom: none; }
.pub-list li a { font-weight: 500; }

.pub-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border-light); }
.pub-filter a {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; padding: 0.35rem 0.75rem;
  border-radius: 16px; border: 1px solid var(--border); color: var(--text-light); transition: all 0.2s;
}
.pub-filter a:hover, .pub-filter a.active { background: var(--slate); color: #fff; border-color: var(--slate); }

/* --- Data & Tools --- */
.dataset-card {
  background: var(--bg-white); border: 1px solid var(--border-light); border-radius: 8px;
  padding: 1.5rem; margin-bottom: 1.2rem; transition: border-color 0.3s;
}
.dataset-card:hover { border-color: var(--border); }
.dataset-card h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.dataset-card p { font-size: 0.88rem; color: var(--text-light); margin-bottom: 0.5rem; }
.dataset-links { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.dataset-links a { font-size: 0.78rem; font-weight: 600; color: var(--teal); }
.dataset-links a:hover { color: var(--rust); }

/* --- Media items --- */
.media-item {
  display: grid; grid-template-columns: 90px 1fr; gap: 1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--border-light); align-items: start;
}
.media-item:last-child { border-bottom: none; }
.media-date { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; padding-top: 0.1rem; }
.media-outlet { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--rust); margin-bottom: 0.15rem; display: block; }
.media-title { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--slate); line-height: 1.3; margin-bottom: 0.2rem; }
.media-title a { color: var(--slate); }
.media-title a:hover { color: var(--rust); }
.media-desc { font-size: 0.83rem; color: var(--text-light); line-height: 1.5; margin: 0; }

/* --- Video/podcast embeds --- */
.media-embed {
  background: var(--bg-warm); border: 1px solid var(--border); border-radius: 8px;
  padding: 1.2rem; margin-bottom: 1rem;
}
.media-embed h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.media-embed p { font-size: 0.83rem; color: var(--text-light); margin-bottom: 0.5rem; }
.media-embed .embed-type {
  display: inline-block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.15rem 0.45rem; border-radius: 3px; margin-bottom: 0.5rem;
}
.embed-podcast { background: #e8f0ed; color: var(--teal); }
.embed-video { background: #fce8e6; color: var(--rust); }
.embed-talk { background: #e8ecf0; color: var(--slate-light); }

/* --- Figure / chart references --- */
.figure-box {
  background: var(--bg-warm); border: 1px solid var(--border); border-radius: 8px;
  padding: 1rem; margin: 1.5rem 0; text-align: center;
}
.figure-box img { border-radius: 4px; margin: 0 auto; max-height: 320px; }
.figure-box .caption {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 0.5rem;
  font-style: italic; line-height: 1.5;
}

/* --- Footer --- */
.footer {
  margin-top: auto; background: var(--slate-dark); color: rgba(255,255,255,0.45);
  padding: 2rem 0; font-size: 0.8rem;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer a { color: rgba(255,255,255,0.6); }
.footer a:hover { color: #fff; }
.footer-links { display: flex; gap: 1.2rem; list-style: none; }

/* --- Utility --- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* --- Animations --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeUp 0.5s ease forwards; }
.fade-in-d1 { animation-delay: 0.1s; opacity: 0; }
.fade-in-d2 { animation-delay: 0.2s; opacity: 0; }

/* --- Responsive --- */
@media (max-width: 860px) {
  html { font-size: 16px; }
  h1 { font-size: 1.8rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero-photo { max-width: 220px; }
  .banner-cols { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .container { padding: 0 1.2rem; }
  .section { padding: 2.5rem 0; }
  .hero { padding: 2.5rem 0 2rem; }
  .page-header { padding: 2rem 0 1.5rem; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 0.5rem 1.2rem 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .media-item { grid-template-columns: 1fr; gap: 0.2rem; }
}
