/* =====================================================================
   Ivan A. Valdez, PhD — shared styles for interior pages.
   Designed to match the Kimi LANDING PAGE exactly (nav, footer, type,
   color, rhythm). The landing page (index.html + assets/) is a separate
   compiled bundle and is never touched.
   ===================================================================== */

:root {
  --bg-dark: #0C1929;
  --bg-light: #F7F4EE;
  --fg-light: #F7F4EE;
  --fg-dark: #0C1929;
  --fg-accent: #E8775A;            /* coral */
  --accent: #E8775A;
  --accent-deep: #d4634a;

  --border-subtle: rgba(247, 244, 238, 0.12);
  --border-subtle-light: rgba(12, 25, 41, 0.10);
  --muted-on-light: rgba(12, 25, 41, 0.60);
  --muted-on-dark: rgba(247, 244, 238, 0.55);

  --page-padding-x: clamp(1.5rem, 5vw, 4rem);
  --section-padding-y: clamp(4rem, 10vh, 8rem);
  --content-max-width: 1200px;
  --prose-max-width: 720px;

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;

  --heading-xl: clamp(2.5rem, 7vw, 5.5rem);
  --heading-lg: clamp(2rem, 5vw, 3.5rem);
  --heading-md: clamp(1.5rem, 3vw, 2.25rem);
  --heading-sm: clamp(1.25rem, 2.2vw, 1.6rem);
  --body-lg: clamp(1.1rem, 1.8vw, 1.35rem);
  --body: 1.05rem;
  --body-sm: 0.875rem;
  --label: 0.7rem;
  --nav: 0.8rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Libre Franklin", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-size: var(--body);
  line-height: 1.65;
  color: var(--fg-light);
  background: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1.2rem; }
a { color: var(--fg-accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-deep); text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { line-height: 1.7; }
hr { border: none; border-top: 1px solid var(--border-subtle-light); margin: 2.5rem 0; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--fg-accent); color: #fff; padding: 0.6rem 1rem; border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }

.eyebrow {
  display: inline-block; font-size: var(--label); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--fg-accent);
  margin-bottom: 1.25rem;
}

/* =====================================================================
   NAV — flat, transparent over dark hero, dark-blur on scroll (Kimi)
   ===================================================================== */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: 70px;
  padding: 0 var(--page-padding-x);
  display: flex; align-items: center; justify-content: space-between;
  background: transparent;
  transition: background 0.4s ease, backdrop-filter 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}
.site-nav.scrolled {
  background: rgba(12, 25, 41, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border-subtle);
}
.brand-text { font-size: var(--body-sm); font-weight: 600; color: var(--fg-light); letter-spacing: 0.01em; }
.brand-text:hover { color: var(--fg-light); text-decoration: none; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2rem; }
.nav-item > a {
  color: var(--fg-light); font-size: var(--nav); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.nav-item > a:hover { color: var(--fg-accent); text-decoration: none; }
.nav-book-cta {
  font-size: var(--nav); font-weight: 500; color: var(--fg-accent);
  text-transform: uppercase; letter-spacing: 0.08em;
  border: 1px solid var(--fg-accent); border-radius: 100px; padding: 0.4rem 1.2rem;
  transition: background 0.2s ease, color 0.2s ease;
}
.nav-book-cta:hover { background: var(--fg-accent); color: var(--bg-dark); text-decoration: none; }

/* ----- Nav dropdowns ----- */
.nav-item { position: relative; }
.nav-item > a { display: inline-flex; align-items: center; gap: 0.35rem; }
.dropdown-chevron { opacity: 0.7; transition: transform 0.2s ease; }
.nav-item-has-dropdown:hover .dropdown-chevron { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(8px);
  min-width: 200px; list-style: none; margin: 0; padding: 0.5rem;
  background: rgba(12, 25, 41, 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-item-has-dropdown:hover .dropdown-menu,
.nav-item-has-dropdown:focus-within .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(2px);
}
.dropdown-menu a {
  display: block; padding: 0.55rem 0.8rem; border-radius: var(--radius-sm);
  color: var(--fg-light); font-size: var(--body-sm); font-weight: 500;
  text-transform: none; letter-spacing: 0;
}
.dropdown-menu a:hover { background: rgba(247, 244, 238, 0.08); color: var(--fg-accent); text-decoration: none; }

.mobile-menu-toggle { display: none; }

/* =====================================================================
   PAGE STRUCTURE
   ===================================================================== */
main { display: block; }

/* Dark hero band that sits behind the transparent nav (like the landing) */
.page-hero {
  background: var(--bg-dark); color: var(--fg-light);
  padding: calc(70px + clamp(3rem, 8vh, 6rem)) var(--page-padding-x) clamp(3rem, 8vh, 6rem);
}
.page-hero-inner { max-width: var(--content-max-width); margin: 0 auto; }
.page-hero h1 { font-size: var(--heading-xl); margin-bottom: 0.4rem; }
.page-hero .subtitle { font-size: var(--body-lg); color: var(--muted-on-dark); max-width: var(--prose-max-width); margin: 0.8rem 0 0; }

.section { padding: var(--section-padding-y) var(--page-padding-x); }
.container { max-width: var(--content-max-width); margin: 0 auto; }
.prose { max-width: var(--prose-max-width); margin: 0 auto; }
.prose h2 { font-size: var(--heading-md); margin-top: 2.6rem; }
.prose h3 { font-size: var(--heading-sm); margin-top: 1.8rem; }
.prose p, .prose li { font-size: var(--body); }
.prose img { border-radius: var(--radius-md); margin: 2rem 0; }

/* Bands — alternate cream and dark like the landing */
.band-light { background: var(--bg-light); color: var(--fg-dark); }
.band-light a { color: var(--accent-deep); }
.band-light .muted { color: var(--muted-on-light); }
.band-dark { background: var(--bg-dark); color: var(--fg-light); }
.band-dark a { color: var(--fg-accent); }
.band-dark .muted { color: var(--muted-on-dark); }

/* ----- Buttons / arrow links (match landing) ----- */
.btn {
  display: inline-block; font-size: var(--nav); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.65rem 1.8rem; border-radius: 100px; cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary { background: var(--fg-accent); color: var(--bg-dark); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,119,90,0.3); text-decoration: none; color: var(--bg-dark); }
.btn-outline { color: var(--fg-accent); border-color: var(--fg-accent); }
.btn-outline:hover { background: var(--fg-accent); color: var(--bg-dark); text-decoration: none; }

/* Keep filled-button labels readable (dark on coral) even inside colored
   bands, where the generic `.band-* a` link color would otherwise win. */
.band-light a.btn-primary, .band-dark a.btn-primary,
.band-light a.btn-primary:hover, .band-dark a.btn-primary:hover,
a.btn-primary, a.btn-primary:hover { color: var(--bg-dark); }

.arrow-link {
  font-weight: 600; text-transform: uppercase; font-size: var(--nav);
  letter-spacing: 0.06em; color: var(--fg-accent);
  border-bottom: 1px solid transparent; padding-bottom: 2px;
}
.arrow-link:hover { border-bottom-color: var(--fg-accent); text-decoration: none; }

/* =====================================================================
   FORMS (contact) — on a cream band
   ===================================================================== */
form { max-width: var(--prose-max-width); }
label { display: block; font-size: var(--body-sm); font-weight: 600; margin: 1.1rem 0 0.4rem; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: var(--body); padding: 0.7rem 0.85rem;
  color: var(--fg-dark); background: #fff; border: 1px solid var(--border-subtle-light); border-radius: var(--radius-md);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg-accent); box-shadow: 0 0 0 3px rgba(232,119,90,0.18); }
textarea { resize: vertical; }
button[type="submit"] {
  margin-top: 1.5rem; background: var(--fg-accent); color: var(--bg-dark); border: none;
  font-family: inherit; font-size: var(--nav); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.8rem 2rem; border-radius: 100px; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
button[type="submit"]:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,119,90,0.3); }
button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
#form-result { margin-top: 1.2rem; font-size: var(--body); }
.form-success { color: #1b6b3a; }
.form-error { color: #b23b2e; }

/* =====================================================================
   BLOG
   ===================================================================== */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-card { padding: 1.8rem 0; border-bottom: 1px solid var(--border-subtle-light); }
.post-card a.post-title-link { color: var(--fg-dark); }
.post-card a.post-title-link:hover { color: var(--accent-deep); text-decoration: none; }
.post-card h2 { font-size: var(--heading-sm); margin-bottom: 0.3rem; }
.post-meta { font-size: var(--body-sm); color: var(--muted-on-light); margin-bottom: 0.5rem; letter-spacing: 0.02em; }
.post-excerpt { color: var(--muted-on-light); margin: 0; }
.post-article { max-width: var(--prose-max-width); margin: 0 auto; }
.post-article h2 { font-size: var(--heading-md); margin-top: 2.4rem; }
.post-article blockquote { margin: 1.8rem 0; padding: 0.4rem 0 0.4rem 1.4rem; border-left: 3px solid var(--fg-accent); color: var(--muted-on-light); font-style: italic; }
.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: var(--body-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* =====================================================================
   CARDS / SPLIT / STATS
   ===================================================================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.card { background: #fff; border: 1px solid var(--border-subtle-light); border-radius: var(--radius-lg); padding: 2rem; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 44px rgba(12,25,41,0.10); }
.card h3 { font-size: var(--heading-sm); }
.card p { color: var(--muted-on-light); margin-bottom: 1rem; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.split.photo-left > .split-photo { order: -1; }
.split-photo img { border-radius: var(--radius-md); width: 100%; }

.stats { display: flex; gap: 3rem; flex-wrap: wrap; }
.stat-num { font-family: "DM Serif Display", Georgia, serif; font-size: var(--heading-lg); color: var(--fg-accent); line-height: 1; }
.stat-label { font-size: var(--body-sm); margin-top: 0.25rem; }

/* Record lists — publications, CV entries */
.record-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.record { padding: 1.1rem 0; border-bottom: 1px solid var(--border-subtle-light); }
.record:last-child { border-bottom: none; }
.record-title { font-weight: 600; margin: 0 0 0.2rem; }
.record-sub { margin: 0 0 0.2rem; }
.record-meta { color: var(--muted-on-light); font-size: var(--body-sm); margin: 0; }
.eyebrow-inline { display: block; font-size: var(--label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em; color: var(--fg-accent); margin: 2.4rem 0 0.6rem; }

/* =====================================================================
   FOOTER (matches the Kimi landing footer exactly)
   ===================================================================== */
.site-footer { background: var(--bg-dark); border-top: 1px solid var(--border-subtle); padding: 0 var(--page-padding-x); }
.site-footer-inner { max-width: var(--content-max-width); margin: 0 auto; }
.footer-row1 { display: flex; align-items: center; justify-content: space-between; padding: 3rem 0; flex-wrap: wrap; gap: 1.5rem; }
.footer-name { font-size: var(--body-sm); font-weight: 600; color: var(--fg-light); }
.footer-nav { display: flex; gap: 2rem; flex-wrap: wrap; }
.footer-nav a, .footer-social a {
  font-size: var(--nav); font-weight: 500; color: var(--fg-light); opacity: 0.5;
  text-transform: uppercase; letter-spacing: 0.08em; transition: opacity 0.2s ease;
}
.footer-nav a:hover, .footer-social a:hover { opacity: 1; text-decoration: none; }
.footer-social { display: flex; gap: 1.5rem; padding-bottom: 1.5rem; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 0; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; gap: 1rem; }
.footer-bottom .copyright { font-size: var(--body-sm); color: var(--fg-light); opacity: 0.3; }
.footer-legal { display: flex; gap: 1.5rem; }
.footer-legal a { font-size: var(--body-sm); color: var(--fg-light); opacity: 0.3; transition: opacity 0.2s ease; }
.footer-legal a:hover { opacity: 0.6; text-decoration: none; }

/* =====================================================================
   SCROLL REVEAL
   ===================================================================== */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* Subtle left-to-right "writes itself in" wipe — headings only.
   Pure CSS load animation (no JS/observer), so it can't deadlock. */
.text-wipe {
  animation: textWipeIn 0.9s cubic-bezier(0.22, 0.7, 0.2, 1) both;
}
@keyframes textWipeIn {
  from { clip-path: inset(0 100% 0 0); opacity: 0; }
  to   { clip-path: inset(0 0 0 0);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .text-wipe { animation: none; }
  html { scroll-behavior: auto; }
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; gap: 2rem; }
  .split.photo-left > .split-photo { order: 0; }
  .footer-row1 { flex-direction: column; align-items: flex-start; }

  .mobile-menu-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; background: none; border: none; cursor: pointer; padding: 0; z-index: 110;
  }
  .mobile-menu-toggle .bar { display: block; width: 24px; height: 2px; background: var(--fg-light); }

  .nav-list {
    position: fixed; top: 70px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: rgba(12, 25, 41, 0.97); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem var(--page-padding-x) 2rem;
    transform: translateY(-130%); transition: transform 0.3s ease;
    max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .site-nav.mobile-open .nav-list { transform: translateY(0); }
  .nav-item { width: 100%; }
  .nav-item > a { padding: 0.9rem 0; display: block; }
  .nav-item-cta { margin-top: 0.8rem; }
  .nav-book-cta { display: inline-block; }
  .nav-item > a { justify-content: space-between; }
  .dropdown-menu {
    position: static; transform: none; opacity: 1; visibility: visible;
    min-width: 0; background: none; border: none; box-shadow: none;
    padding: 0 0 0.5rem 1rem; backdrop-filter: none;
  }
  .dropdown-menu a { padding: 0.5rem 0; }
  body.nav-open { overflow: hidden; }
}
