/* ============================================================
   NEFIN — Design System
   ============================================================ */

:root {
  --primary:       #003082;
  --primary-dark:  #00204f;
  --primary-light: #0044b3;
  --accent:        #C8963E;
  --white:         #ffffff;
  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-400:      #9ca3af;
  --gray-500:      #6b7280;
  --gray-700:      #374151;
  --gray-900:      #111827;
  --font-serif:    Georgia, 'Times New Roman', serif;
  --font-sans:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width:     1160px;
  --radius:        4px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-sans); color: var(--gray-900); background: var(--white); line-height: 1.65; }
img  { max-width: 100%; display: block; }
a    { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: normal; line-height: 1.2; }
ul { list-style: none; }

/* ── Layout ── */
.container    { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.section      { padding: 5rem 0; }
.section-sm   { padding: 3rem 0; }
.bg-light     { background: var(--gray-50); }
.section-heading      { margin-bottom: 3rem; }
.section-heading h2   { font-size: 1.9rem; color: var(--gray-900); margin-bottom: 0.4rem; padding-bottom: .6rem; border-bottom: 2px solid var(--gray-100); position: relative; }
.section-heading h2::after { content: ''; position: absolute; left: 0; bottom: -2px; width: 3rem; height: 2px; background: var(--accent); }
.section-heading p    { color: var(--gray-500); font-size: 1rem; }

/* ── Navigation ── */
.nav { background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 200; }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav__brand { font-family: var(--font-serif); font-size: 1.45rem; color: var(--primary); font-weight: bold; letter-spacing: -.02em; }
.nav__brand:hover { text-decoration: none; }
.nav__list  { display: flex; align-items: center; gap: .15rem; }
.nav__item  { position: relative; }
.nav__link  { display: block; padding: .45rem .85rem; color: var(--gray-700); font-size: .9rem; border-radius: var(--radius); transition: background .12s, color .12s; }
.nav__link:hover { color: var(--primary); background: var(--gray-50); text-decoration: none; }
.nav__link--cta { background: var(--primary); color: var(--white) !important; margin-left: .5rem; }
.nav__link--cta:hover { background: var(--primary-light); }

/* Dropdown */
.nav__dropdown { position: absolute; top: calc(100% + 6px); left: 0; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); min-width: 210px; box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s; pointer-events: none; }
.nav__item:hover .nav__dropdown { opacity: 1; visibility: visible; pointer-events: auto; }
.nav__dropdown a { display: block; padding: .55rem 1rem; color: var(--gray-700); font-size: .875rem; }
.nav__dropdown a:hover { color: var(--primary); background: var(--gray-50); text-decoration: none; }
.nav__dropdown-divider { height: 1px; background: var(--gray-200); margin: .35rem 0; }
.nav__toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; font-size: 1.4rem; color: var(--gray-700); line-height: 1; }

@media (max-width: 768px) {
  .nav__toggle { display: block; }
  .nav__list   { display: none; flex-direction: column; align-items: stretch; position: fixed; top: 64px; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--gray-200); padding: 1rem; gap: 0; max-height: calc(100vh - 64px); overflow-y: auto; }
  .nav__list.open { display: flex; }
  .nav__dropdown { position: static; box-shadow: none; border: none; opacity: 1; visibility: visible; pointer-events: auto; padding-left: 1rem; }
  .nav__link--cta { margin-left: 0; }
}

/* ── Buttons ── */
.btn { display: inline-block; padding: .7rem 1.6rem; border-radius: var(--radius); font-size: .9rem; font-weight: 500; cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s; border: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #b8852e; box-shadow: 0 4px 12px rgba(200,150,62,.4); }
.btn-ghost   { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.55); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }

/* ── Hero ── */
.hero { background: var(--primary); color: var(--white); padding: 6rem 0 5.5rem; position: relative; overflow: hidden; }
.hero__geo {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: linear-gradient(to bottom right, transparent 30%, rgba(0,0,0,.6) 100%);
}
.hero__content { position: relative; }
.hero__eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.6); margin-bottom: 1.25rem; }
.hero__title   { font-size: clamp(2.4rem, 5vw, 3.8rem); max-width: 680px; margin-bottom: 1.5rem; color: var(--white); }
.hero__lead    { font-size: 1.05rem; max-width: 560px; color: rgba(255,255,255,.82); margin-bottom: 2.5rem; line-height: 1.75; }
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Stats strip ── */
.stats-strip { background: var(--white); border-bottom: 1px solid var(--gray-200); }
.stats-strip__grid { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0; }
.stat-item { display: flex; flex-direction: column; align-items: center; padding: 1.5rem 3rem; text-align: center; }
.stat-item__number { font-family: var(--font-serif); font-size: 1.9rem; color: var(--primary); line-height: 1; margin-bottom: .2rem; }
.stat-item__label  { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-500); }
.stat-item__divider { width: 1px; height: 2.5rem; background: var(--gray-200); flex-shrink: 0; }
@media (max-width: 640px) {
  .stats-strip__grid { flex-direction: column; }
  .stat-item__divider { width: 40px; height: 1px; }
  .stat-item { padding: 1rem 1.5rem; }
}

/* ── Dataset grid ── */
.datasets-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 860px) { .datasets-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .datasets-grid { grid-template-columns: 1fr; } }

.dataset-card { display: block; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.4rem 1.5rem; color: var(--gray-900); transition: border-color .15s, box-shadow .15s, transform .15s; background: var(--white); }
.dataset-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.dataset-card__title { font-family: var(--font-serif); font-size: 1.05rem; color: var(--primary); margin-bottom: .35rem; }
.dataset-card__desc  { font-size: .83rem; color: var(--gray-500); line-height: 1.5; }
.dataset-card__badge { display: inline-block; font-size: .72rem; color: var(--accent); margin-top: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.dataset-card__badge--notice { color: var(--gray-500); text-transform: none; letter-spacing: 0; font-style: italic; }

/* ── Publications ── */
.pub-list { display: flex; flex-direction: column; gap: 1.5rem; }
.pub-item { border-left: 3px solid var(--gray-200); padding-left: 1.25rem; transition: border-color .15s; }
.pub-item:hover { border-color: var(--accent); }
.pub-item a { color: var(--gray-900); display: block; }
.pub-item a:hover { text-decoration: none; }
.pub-title   { font-family: var(--font-serif); font-size: 1rem; margin-bottom: .3rem; line-height: 1.35; }
.pub-journal { font-size: .83rem; color: var(--accent); font-style: italic; margin-bottom: .2rem; }
.pub-authors { font-size: .8rem; color: var(--gray-500); }

/* ── People grid ── */
.people-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem 1.5rem; }
@media (max-width: 900px) { .people-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .people-grid { grid-template-columns: repeat(2, 1fr); } }

.person-card { text-align: center; }
.person-card a { display: block; color: var(--gray-900); }
.person-card a:hover { text-decoration: none; }
.person-card a:hover .person-card__name { color: var(--primary); }
.person-card__photo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; margin: 0 auto 1rem; background: var(--gray-200); }
.person-card__name  { font-family: var(--font-serif); font-size: .97rem; margin-bottom: .2rem; transition: color .12s; }
.person-card__degree { font-size: .78rem; color: var(--gray-500); line-height: 1.4; }
.person-card__institution { font-size: .75rem; color: var(--accent); margin-top: .2rem; }

/* ── People subsection header ── */
.people-section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: .5rem; }
.people-section-title { font-size: 1.5rem; color: var(--primary); margin-bottom: 2rem; padding-bottom: .75rem; border-bottom: 2px solid var(--gray-100); font-family: var(--font-serif); }

/* ── Alumni table-style list ── */
.alumni-list { border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.alumni-row  { display: grid; grid-template-columns: 2.2fr 1.2fr 2fr; gap: 1rem; padding: .85rem 1.25rem; font-size: .88rem; border-bottom: 1px solid var(--gray-100); align-items: center; }
.alumni-row:last-child { border-bottom: none; }
.alumni-row:nth-child(even) { background: var(--gray-50); }
.alumni-name    { font-weight: 500; }
.alumni-degree  { color: var(--accent); font-size: .82rem; }
.alumni-advisor { color: var(--gray-500); font-size: .82rem; }
.alumni-header  { background: var(--primary) !important; color: var(--white); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.alumni-header .alumni-name,
.alumni-header .alumni-degree,
.alumni-header .alumni-advisor { color: rgba(255,255,255,.85); font-weight: 500; }
@media (max-width: 640px) {
  .alumni-row { grid-template-columns: 1fr; }
  .alumni-header { display: none; }
}

/* ── Page header ── */
.page-header    { background: var(--primary); color: var(--white); padding: 3.5rem 0 3rem; }
.page-header h1 { font-size: 2.4rem; color: var(--white); }
.page-header p  { color: rgba(255,255,255,.72); margin-top: .5rem; font-size: 1rem; }

/* ── Dataset single page ── */
.data-page__desc { font-size: 1rem; color: var(--gray-700); line-height: 1.75; margin-bottom: 2rem; max-width: 740px; }
.data-table { width: 100%; border-collapse: collapse; margin-bottom: 2rem; font-size: .9rem; }
.data-table th { background: var(--primary); color: var(--white); padding: .7rem 1rem; text-align: left; font-weight: 500; }
.data-table td { padding: .65rem 1rem; border-bottom: 1px solid var(--gray-200); }
.data-table tr:hover td { background: var(--gray-50); }
.data-table caption { text-align: right; font-size: .78rem; color: var(--gray-500); padding: .4rem 0; }
.download-section h3 { font-size: 1.1rem; margin-bottom: 1rem; }
.download-links  { display: flex; flex-direction: column; gap: .6rem; }
.download-links a { display: inline-flex; align-items: center; gap: .5rem; color: var(--primary); font-size: .95rem; }
.download-links a::before { content: "↓"; font-size: 1rem; }
.download-links a:hover { text-decoration: underline; }

/* ── Research list ── */
.research-tabs { display: flex; gap: .5rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.research-tab  { padding: .4rem 1.1rem; border-radius: 20px; font-size: .875rem; border: 1.5px solid var(--gray-200); color: var(--gray-700); transition: background .12s, border-color .12s, color .12s; }
.research-tab:hover, .research-tab.active { background: var(--primary); color: var(--white); border-color: var(--primary); text-decoration: none; }

/* ── Sponsor ── */
.sponsor-section { padding: 2.5rem 0; border-top: 1px solid var(--gray-200); text-align: center; }
.sponsor-section p { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-400); margin-bottom: 1rem; }
.sponsor-logo { max-height: 48px; margin: 0 auto; filter: grayscale(100%); opacity: .55; transition: opacity .2s, filter .2s; }
.sponsor-logo:hover { filter: none; opacity: 1; }

/* ── Footer ── */
.footer { background: var(--primary-dark); color: rgba(255,255,255,.8); padding: 4rem 0 2rem; }
.footer__grid  { display: grid; grid-template-columns: 2fr 1fr; gap: 4rem; margin-bottom: 3rem; }
@media (max-width: 640px) { .footer__grid { grid-template-columns: 1fr; gap: 2rem; } }
.footer__brand { font-family: var(--font-serif); font-size: 1.5rem; color: var(--white); margin-bottom: .75rem; }
.footer__desc  { font-size: .875rem; line-height: 1.7; max-width: 380px; }
.footer__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.4); margin-bottom: .85rem; }
.footer__contact { display: flex; flex-direction: column; gap: .45rem; font-size: .875rem; }
.footer__contact a { color: rgba(255,255,255,.8); }
.footer__contact a:hover { color: var(--white); }
.footer__bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 1.5rem; display: flex; justify-content: space-between; font-size: .78rem; color: rgba(255,255,255,.35); flex-wrap: wrap; gap: .5rem; }

/* ── Dashboard ── */
.dashboard { margin-top: 3rem; padding-top: 2.5rem; border-top: 2px solid var(--gray-100); }

/* Tabs */
.dash-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 1.5rem; overflow-x: auto; }
.dash-tab { padding: .65rem 1.3rem; font-size: .85rem; font-family: var(--font-sans); color: var(--gray-500); background: transparent; border: 0; outline: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; line-height: 1; transition: color .12s, border-color .12s; -webkit-appearance: none; appearance: none; }
.dash-tab:hover { color: var(--gray-900); }
.dash-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* Controls */
.dash-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.period-btns { display: flex; gap: .35rem; }
.period-btn { padding: .3rem .9rem; border: 1.5px solid var(--gray-200); border-radius: 20px; font-size: .8rem; font-family: var(--font-sans); color: var(--gray-700); background: transparent; cursor: pointer; line-height: 1; -webkit-appearance: none; appearance: none; outline: none; transition: background .12s, color .12s, border-color .12s; }
.period-btn:hover, .period-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.factor-toggles { display: flex; flex-wrap: wrap; gap: .5rem; }
.factor-toggle { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .85rem; border-radius: 20px; font-size: .8rem; cursor: pointer; border: 1.5px solid; background: transparent; font-family: var(--font-sans); line-height: 1; -webkit-appearance: none; appearance: none; outline: none; transition: opacity .15s; }
.factor-toggle:hover { opacity: .8; }
.factor-toggle.off { opacity: .28; }
.factor-toggle__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.factor-select-wrap { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--gray-700); }
.factor-select { padding: .35rem .8rem; border: 1.5px solid var(--gray-200); border-radius: var(--radius); font-size: .85rem; font-family: var(--font-sans); color: var(--gray-900); background: var(--white); cursor: pointer; outline: none; transition: border-color .12s; }
.factor-select:focus { border-color: var(--primary); }

/* Chart area */
.chart-wrap { position: relative; height: 380px; }
.chart-loading { display: flex; align-items: center; justify-content: center; height: 100px; color: var(--gray-400); font-size: .9rem; margin: 0; }
@media (max-width: 600px) { .chart-wrap { height: 260px; } }

/* Heatmap */
.heatmap-scroll { overflow-x: auto; }
.heatmap-table { border-collapse: collapse; font-size: .72rem; white-space: nowrap; }
.heatmap-table thead th { padding: .3rem .5rem; color: var(--gray-500); font-weight: 500; text-align: center; }
.heatmap-year { padding: .3rem .6rem .3rem 0; color: var(--gray-500); font-size: .72rem; text-align: right; font-weight: 500; min-width: 2.5rem; }
.heatmap-cell { padding: .3rem .4rem; text-align: center; min-width: 3.8rem; border: 1px solid rgba(255,255,255,.4); cursor: default; transition: filter .1s; }
.heatmap-cell:hover { filter: brightness(.9); }

/* ── Books grid ── */
.books-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
@media (max-width: 960px) { .books-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .books-grid { grid-template-columns: repeat(2, 1fr); } }

.book-card { display: flex; flex-direction: column; }
.book-card__cover-link { display: block; }
.book-card__cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow-md); transition: box-shadow .2s, transform .2s; }
.book-card__cover:hover { box-shadow: 0 8px 24px rgba(0,0,0,.18); transform: translateY(-3px); }
.book-card__cover--placeholder { background: var(--gray-100); aspect-ratio: 2/3; border-radius: var(--radius); }
.book-card__body { padding: .9rem 0 0; flex: 1; }
.book-card__title { font-family: var(--font-serif); font-size: .9rem; color: var(--gray-900); line-height: 1.35; margin-bottom: .3rem; }
.book-card__authors { font-size: .78rem; color: var(--gray-500); margin-bottom: .5rem; }
.book-card__buy { font-size: .78rem; color: var(--accent); }
.book-card__buy:hover { text-decoration: underline; color: var(--accent); }

/* ── Contact section ── */
.contact-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; }
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; gap: 2rem; } }
.contact-block__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin-bottom: .6rem; font-weight: 500; }
.contact-block p, .contact-block span, .contact-block a { font-size: .9rem; color: var(--gray-700); line-height: 1.7; }
.contact-block a:hover { color: var(--primary); }

/* ── Utilities ── */
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }
.text-muted { color: var(--gray-500); }
