/* ===============================
   Gabriel Michelena — Personal Site
   Palette: navy / teal / gold
   =============================== */

:root {
  /* Colors */
  --navy: #0e2a47;
  --navy-deep: #081a2e;
  --navy-soft: #1a3b5c;
  --teal: #2a9d8f;
  --teal-dark: #1f7a70;
  --gold: #d4a24c;
  --gold-soft: #e8c989;
  --cream: #faf7f2;
  --paper: #fdfcf9;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #7a7a7a;
  --rule: #e5e0d6;

  /* Type */
  --display: "Fraunces", "Times New Roman", serif;
  --body: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  /* Layout */
  --max: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 2px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* Subtle paper texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(212, 162, 76, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(42, 157, 143, 0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* ============ HEADER ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(253, 252, 249, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.brand {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--navy);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.brand-mark {
  color: var(--gold);
  font-style: italic;
  font-weight: 400;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav a {
  padding: 0.5rem 0.9rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  position: relative;
  transition: color 180ms ease;
}
.nav a:hover { color: var(--navy); }
.nav a.active {
  color: var(--navy);
  font-weight: 500;
}
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.25rem;
  height: 2px;
  background: var(--gold);
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  margin-left: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  color: var(--ink-muted);
  font-family: var(--body);
  font-weight: 600;
  transition: all 160ms ease;
}
.lang-toggle button.active {
  background: var(--navy);
  color: var(--cream);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--navy);
}

/* ============ LAYOUT ============ */
main { position: relative; z-index: 1; }
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ============ HERO (Home) ============ */
.hero {
  padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--gold);
}
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.5vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--navy);
  margin-bottom: 1.5rem;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  color: var(--gold);
}
.hero-lead {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 36rem;
  margin-bottom: 2rem;
  line-height: 1.65;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  font-size: 0.88rem;
  color: var(--ink-muted);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.hero-meta strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.hero-portrait {
  position: relative;
  aspect-ratio: 4/5;
  max-width: 380px;
  justify-self: end;
}
.hero-portrait::before {
  content: "";
  position: absolute;
  inset: 1rem -1rem -1rem 1rem;
  background: linear-gradient(135deg, var(--teal) 0%, var(--navy) 100%);
  z-index: 0;
}
.hero-portrait svg,
.hero-portrait-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  background: var(--cream);
  border: 1px solid var(--rule);
  display: block;
}
.hero-portrait-badge {
  position: absolute;
  bottom: -1rem;
  left: -1rem;
  z-index: 2;
  background: var(--gold);
  color: var(--navy-deep);
  padding: 0.6rem 1rem;
  font-family: var(--display);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

/* ============ SECTION ============ */
.section {
  padding: clamp(3rem, 7vw, 5.5rem) 0;
  border-top: 1px solid var(--rule);
}
.section-header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 3fr;
  gap: clamp(1rem, 4vw, 3rem);
  margin-bottom: 3rem;
  align-items: baseline;
}
.section-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-dark);
  padding-top: 0.5rem;
  border-top: 2px solid var(--gold);
  display: inline-block;
}
.section-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.section-title em {
  font-style: italic;
  color: var(--gold);
  font-weight: 300;
}

/* ============ RESEARCH AREAS (cards) ============ */
.areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.area-card {
  padding: 1.75rem 1.5rem;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  position: relative;
  transition: transform 240ms ease, border-color 240ms ease;
}
.area-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2rem;
  height: 2px;
  background: var(--gold);
  transition: width 280ms ease;
}
.area-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
}
.area-card:hover::before { width: 100%; }
.area-card-num {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
  display: block;
}
.area-card h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.area-card p {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ============ HIGHLIGHTS (selected work) ============ */
.highlights {
  display: grid;
  gap: 0;
}
.highlight {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  transition: padding-left 240ms ease;
}
.highlight:last-child { border-bottom: 1px solid var(--rule); }
.highlight:hover { padding-left: 0.5rem; }
.highlight-year {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--teal-dark);
  font-weight: 500;
}
.highlight-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--navy);
  letter-spacing: -0.005em;
}
.highlight-venue {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-style: italic;
  white-space: nowrap;
}

/* ============ CTA ============ */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: var(--radius);
  transition: all 200ms ease;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--body);
}
.btn-primary {
  background: var(--navy);
  color: var(--cream);
}
.btn-primary:hover {
  background: var(--navy-deep);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -8px rgba(14, 42, 71, 0.5);
}
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-ghost:hover {
  background: var(--navy);
  color: var(--cream);
}
.btn-arrow::after {
  content: "→";
  transition: transform 200ms ease;
}
.btn-arrow:hover::after { transform: translateX(3px); }

/* ============ PAGE HEADER (non-home pages) ============ */
.page-header {
  padding: clamp(3rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}
.page-header .hero-eyebrow { margin-bottom: 1rem; }
.page-header h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--navy);
  margin-bottom: 1rem;
}
.page-header h1 em {
  font-style: italic;
  color: var(--gold);
  font-weight: 300;
}
.page-header p {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 44rem;
}

/* ============ PUBLICATIONS ============ */
.pub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.pub-filter {
  padding: 0.45rem 0.95rem;
  background: transparent;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 999px;
  transition: all 180ms ease;
}
.pub-filter:hover { color: var(--navy); border-color: var(--navy); }
.pub-filter.active {
  background: var(--navy);
  color: var(--cream);
  border-color: var(--navy);
}

.pub-year {
  margin-bottom: 3rem;
}
.pub-year-label {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 300;
  font-style: italic;
  color: var(--gold);
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
}
.pub-year-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
.pub-list { list-style: none; }
.pub-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.pub-item:first-child { border-top: 0; }
.pub-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal-dark);
  font-weight: 500;
  padding-top: 0.25rem;
}
.pub-title {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.4;
  margin-bottom: 0.35rem;
  letter-spacing: -0.005em;
}
.pub-meta {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-style: italic;
}
.pub-title a {
  color: var(--navy);
  border-bottom: 1px solid var(--rule);
  transition: border-color 180ms ease, color 180ms ease;
}
.pub-title a:hover {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}
.pub-meta a {
  color: var(--teal-dark);
  border-bottom: 1px solid var(--teal);
  font-style: normal;
}

/* ============ TEACHING ============ */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}
.course-card {
  padding: 2rem 1.75rem;
  background: var(--cream);
  border-left: 3px solid var(--gold);
  position: relative;
}
.course-inst {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal-dark);
  margin-bottom: 0.75rem;
}
.course-name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.course-program {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}
.course-years {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
}
.course-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--rule);
  font-style: italic;
}

/* ============ CV PAGE ============ */
.cv-section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 3fr;
  gap: clamp(1rem, 4vw, 3rem);
}
.cv-section-title {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal-dark);
  padding-top: 0.5rem;
}
.cv-entry {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--rule);
}
.cv-entry:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.cv-role {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: 0.2rem;
  letter-spacing: -0.005em;
}
.cv-org {
  font-size: 0.98rem;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.cv-dates {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}
.cv-desc {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ============ CONTACT ============ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.contact-lead {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.3;
  font-weight: 400;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.contact-lead em {
  font-style: italic;
  color: var(--gold);
  font-weight: 300;
}
.contact-list { list-style: none; }
.contact-item {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: padding-left 200ms ease;
}
.contact-item:last-child { border-bottom: 1px solid var(--rule); }
.contact-item:hover { padding-left: 0.5rem; }
.contact-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--teal-dark);
  font-weight: 500;
}
.contact-value {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--navy);
  text-align: right;
}
.contact-value a { border-bottom: 1px solid var(--gold); transition: color 180ms ease; }
.contact-value a:hover { color: var(--gold); }

/* ============ FOOTER ============ */
.site-footer {
  margin-top: clamp(3rem, 7vw, 5rem);
  padding: 2.5rem 0;
  background: var(--navy-deep);
  color: rgba(250, 247, 242, 0.75);
  position: relative;
  z-index: 1;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.88rem;
}
.footer-inner a { color: var(--gold-soft); }
.footer-brand {
  font-family: var(--display);
  font-weight: 500;
  color: var(--cream);
  font-size: 1rem;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 700ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }

/* ============ LANG TOGGLE visibility ============ */
[data-lang="es"] .en { display: none; }
[data-lang="en"] .es { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { justify-self: start; max-width: 280px; }
  .section-header { grid-template-columns: 1fr; gap: 1rem; }
  .cv-section { grid-template-columns: 1fr; gap: 0.75rem; }
  .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .highlight { grid-template-columns: 70px 1fr; }
  .highlight-venue { grid-column: 2; white-space: normal; }
  .pub-item { grid-template-columns: 1fr; gap: 0.5rem; }
  .menu-toggle { display: block; }
  .nav {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    width: min(280px, 80vw);
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    gap: 0;
    border-left: 1px solid var(--rule);
    transform: translateX(100%);
    transition: transform 280ms ease;
  }
  .nav.open { transform: translateX(0); }
  .nav a { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
  .nav a.active::after { display: none; }
  .nav a.active { color: var(--gold); }
  .lang-toggle { margin: 1rem 0 0 0; align-self: flex-start; }
}

@media (max-width: 500px) {
  .contact-item { flex-direction: column; align-items: flex-start; gap: 0.35rem; }
  .contact-value { text-align: left; }
}

/* ============ PRINT ============ */
@media print {
  .site-header, .site-footer, .lang-toggle, .cta-row { display: none; }
  body { background: white; }
}
