/* ============================================
   Francesco G. Barone — Design System
   Off-black / warm white / muted gray / teal
   Display: Fraunces · Body: Inter
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #0B0C0E;
  --surface: #14161A;
  --surface-hover: #1A1D22;
  --border: rgba(245, 241, 234, 0.09);
  --text-primary: #F5F1EA;
  --text-secondary: #9A9A9C;
  --text-secondary-bright: #B4B2AF;
  --accent: #3E7C74;
  --accent-bright: #45E0C7;
  --accent-soft: rgba(62, 124, 116, 0.16);

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --max-width: 1200px;
  --section-pad-y: clamp(64px, 10vw, 140px);
  --section-pad-x: clamp(24px, 6vw, 80px);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-pill: 999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--section-pad-x);
}

section {
  padding: var(--section-pad-y) 0;
  position: relative;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.divider {
  width: 56px;
  height: 1px;
  background: rgba(245, 241, 234, 0.35);
  border: none;
}

.divider--center { margin: 0 auto; }

/* Keeps "&" plain/typographic when it appears inside display-serif headings,
   instead of the serif face's stylized swash ampersand glyph */
.amp {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 400;
}

/* Focus visibility */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ============================================
   Navigation — floating glass pill
============================================ */

.nav-wrap {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.nav {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 40px);
  padding: 14px 28px;
  border-radius: var(--radius-pill);
  background: rgba(11, 12, 14, 0.55);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: background 0.3s var(--ease), border-radius 0.3s var(--ease);
  max-width: calc(100vw - 32px);
  overflow-x: auto;
}

.nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease);
}

.nav a:hover { opacity: 1; }

.nav a.active {
  color: var(--accent-bright);
  opacity: 1;
  text-shadow: 0 0 8px rgba(69, 224, 199, 0.3);
}

.nav a.nav-name {
  font-family: var(--font-display);
  font-size: 1rem;
  opacity: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 4px;
  cursor: pointer;
}

.nav-links { display: contents; }

/* Mobile nav simplification */
@media (max-width: 640px) {
  .nav {
    gap: 16px;
    padding: 12px 18px;
    max-width: calc(100vw - 32px);
    overflow: visible;
    flex-wrap: wrap;
    justify-content: space-between;
  }
  .nav a { font-size: 0.8125rem; }
  .nav a.nav-name { font-size: 0.9375rem; }
  .nav-mark { width: 18px; height: 18px; }

  .nav-toggle { display: flex; align-items: center; }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    order: 3;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
  }

  .nav-links.is-open { display: flex; }

  .nav.is-expanded { border-radius: 26px; }

  .nav-links a { padding: 8px 4px; width: 100%; }
}

/* ============================================
   Hero
============================================ */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 38%;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 640px) {
  .hero-bg { object-position: 68% 30%; }
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11,12,14,0.92) 0%, rgba(11,12,14,0.55) 45%, rgba(11,12,14,0.15) 75%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 860px;
  padding: 0 var(--section-pad-x);
}

.hero-name {
  font-size: clamp(2rem, 5vw, 3.6rem);
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  animation: heroFadeIn 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

.hero .divider {
  margin: 24px 0;
  width: 0;
  height: 3px;
  border: none;
  border-radius: 2px;
  background: var(--accent-bright);
  box-shadow: 0 0 4px rgba(69, 224, 199, 0.2);
  animation: heroLineGrow 1.3s cubic-bezier(0.65, 0, 0.35, 1) 1.05s forwards;
}

.hero-title {
  font-family: var(--font-body);
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  opacity: 0;
}

.hero-subtext {
  margin-top: 20px;
  color: var(--text-secondary-bright);
  font-size: 1rem;
  max-width: 480px;
  opacity: 0;
}

@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tw-active::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 2px;
  background: var(--accent-bright);
  vertical-align: text-bottom;
  animation: twBlink 0.8s step-end infinite;
}

@keyframes twBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes heroLineGrow {
  0% { width: 0; box-shadow: 0 0 4px rgba(69, 224, 199, 0.2); }
  70% { box-shadow: 0 0 16px rgba(69, 224, 199, 0.55); }
  100% { width: var(--line-target-width, 90px); box-shadow: 0 0 10px rgba(69, 224, 199, 0.35); }
}

.scroll-cue {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 22px;
  height: 34px;
  border: 1.5px solid rgba(245,241,234,0.4);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.scroll-cue::before {
  content: '';
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--text-secondary);
  animation: scrollcue 1.8s ease-in-out infinite;
}

@keyframes scrollcue {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 0; transform: translateY(0); }
}

/* ============================================
   Editorial statement / autobiography
============================================ */

.statement {
  text-align: center;
}

.statement-lead {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 720px;
  margin: 0 auto 40px;
}

.statement-body {
  max-width: 620px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

/* ============================================
   Reveal-on-scroll (JS toggles .is-visible)
============================================ */

.reveal {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 2.2s var(--ease), transform 2.2s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   Destination cards
============================================ */

.cards-intro {
  text-align: center;
  max-width: 620px;
  margin: 0 auto 56px;
}

.cards-intro-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.375rem, 2.5vw, 1.875rem);
  color: var(--text-primary);
  margin-bottom: 12px;
}

.cards-intro-sub {
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

.card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: border-color 0.3s var(--ease);
}

.card:hover { border-color: rgba(62, 124, 116, 0.45); }

.card-media { aspect-ratio: 4 / 3; overflow: hidden; }

.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }

.card:hover .card-media img { transform: scale(1.03); }

.card-body { padding: 28px; display: flex; flex-direction: column; flex: 1; }

.card-body h3 { font-size: 1.375rem; margin-bottom: 12px; }

.card-body p { color: var(--text-secondary-bright); font-size: 0.9375rem; }

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

.card-cta svg { transition: transform 0.3s var(--ease); }

.card:hover .card-cta svg { transform: translateX(4px); }

/* ============================================
   Section headings (used across previews)
============================================ */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.section-head h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); max-width: 560px; }

.section-head p { color: var(--text-secondary); max-width: 420px; }

.section-foot {
  margin-top: 48px;
  text-align: center;
}

.text-link {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   Preview repeater grids (Sci Comm / Publications)
============================================ */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

.preview-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-media { aspect-ratio: 16 / 10; overflow: hidden; }

.preview-media img { width: 100%; height: 100%; object-fit: cover; }

.preview-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }

#pub-featured {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#pub-featured .preview-item {
  flex-direction: row;
  align-items: stretch;
}

#pub-featured .preview-media {
  width: 280px;
  flex-shrink: 0;
  aspect-ratio: auto;
}

#pub-featured .preview-body { justify-content: center; }

@media (max-width: 700px) {
  #pub-featured .preview-item { flex-direction: column; }
  #pub-featured .preview-media { width: 100%; aspect-ratio: 16 / 10; }
}

.preview-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}

.preview-body h3 { font-size: 1.0625rem; margin-bottom: 8px; font-family: var(--font-body); font-weight: 600; }

.preview-body p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 16px; }

.preview-links { display: flex; gap: 16px; font-size: 0.8125rem; font-weight: 600; margin-top: auto; padding-top: 4px; }

.preview-links a { color: var(--accent); }

.preview-links a.muted { color: var(--text-secondary); }

/* ============================================
   Resources preview — static category cards
============================================ */

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.resource-card {
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.resource-card h3 { font-size: 1.125rem; margin-bottom: 12px; font-family: var(--font-body); font-weight: 600; }

.resource-card p { color: var(--text-secondary); font-size: 0.9375rem; margin-bottom: 18px; }

/* ============================================
   Contact + footer
============================================ */

.contact { text-align: center; }

.contact h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); margin-bottom: 20px; }

.contact p { color: var(--text-secondary); max-width: 520px; margin: 0 auto 32px; }

.contact-email {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--accent);
  display: inline-block;
  margin-bottom: 32px;
}

.contact-form {
  max-width: 560px;
  margin: 40px auto 32px;
  text-align: left;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field { margin-bottom: 18px; }

.form-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary-bright);
  margin-bottom: 8px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.form-field textarea { resize: vertical; min-height: 110px; }

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-secondary); }

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(69, 224, 199, 0.15);
}

.form-submit {
  width: 100%;
  background: var(--accent-bright);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s var(--ease);
}

.form-submit:hover { opacity: 0.88; }

.form-status {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-secondary-bright);
  min-height: 1.2em;
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.social-row a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.social-row a:hover { color: var(--text-primary); border-color: var(--accent); }

footer {
  border-top: 1px solid var(--border);
  padding: 40px var(--section-pad-x);
  text-align: center;
}

footer p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ============================================
   Inner page header (non-hero pages)
============================================ */

.page-head {
  padding: calc(var(--section-pad-y) + 40px) 0 var(--section-pad-y);
}

.page-head-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 56px;
  align-items: center;
}

.page-head-media {
  max-width: 75%;
  margin-left: auto;
}

.page-head-media img {
  width: 100%;
  aspect-ratio: 1286 / 1741;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  display: block;
}

@media (max-width: 900px) {
  .page-head-grid { grid-template-columns: 1fr; gap: 40px; }
  .page-head-media { max-width: 360px; margin: 0 auto; }
}

.page-head h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); max-width: 700px; }

.page-head p {
  margin-top: 24px;
  color: var(--text-secondary);
  max-width: 620px;
  font-size: 1.0625rem;
}

.category-group { margin-bottom: 64px; }

.category-group h2 {
  font-size: 1.5rem;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* Scientific Databases & Tools cards */
.db-tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.db-tools-grid .db-card:not(.db-card--featured) { min-height: 290px; }

@media (max-width: 640px) {
  .db-tools-grid .db-card:not(.db-card--featured) { min-height: 0; }
}

.db-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.3s var(--ease);
}

.db-card:hover { border-color: rgba(62, 124, 116, 0.4); }

.db-card--featured {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  padding: 32px;
}

.db-card--featured .db-card-icon { flex-shrink: 0; }

.db-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.db-card--featured .db-icon { width: 48px; height: 48px; }

.db-card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.db-card h3 { font-size: 1.125rem; font-family: var(--font-body); font-weight: 600; margin: 4px 0 2px; }

.db-card p { color: var(--text-secondary-bright); font-size: 0.9375rem; }

.db-card-bestfor { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 2px; }

.db-card-bestfor strong { color: var(--text-secondary-bright); font-weight: 600; }

.db-card-level { font-size: 0.8125rem; color: var(--text-secondary); margin: 2px 0 10px; }

.db-card-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-bright);
  border: 1px solid rgba(69, 224, 199, 0.4);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  margin-left: 8px;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.learning-grid .db-card:not(.db-card--featured) { min-height: 290px; }

@media (max-width: 640px) {
  .learning-grid { grid-template-columns: 1fr; }
  .learning-grid .db-card { min-height: 0; }
}

.db-card-cta {
  margin-top: auto;
  padding-top: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

@media (max-width: 640px) {
  .db-tools-grid { grid-template-columns: 1fr; }
  .db-card--featured { flex-direction: column; }
}

.empty-note {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-style: italic;
  padding: 24px 0;
}

.archive-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.archive-row h3 { font-size: 1.0625rem; font-family: var(--font-body); font-weight: 600; max-width: 640px; }

.archive-row .archive-meta { color: var(--text-secondary); font-size: 0.875rem; white-space: nowrap; }

.area-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 32px;
  margin: 32px 0 8px;
  list-style: none;
}

.area-list li {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  padding-left: 20px;
  position: relative;
}

.area-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

@media (max-width: 640px) {
  .area-list { grid-template-columns: 1fr; }
  .archive-row { flex-direction: column; gap: 6px; }
}

/* ============================================
   Responsive — tablet & mobile
============================================ */

@media (max-width: 900px) {
  .cards-grid, .preview-grid, .resource-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .cards-grid, .preview-grid, .resource-grid {
    grid-template-columns: 1fr;
  }

  .hero { min-height: 92vh; }
  .hero-content { max-width: 100%; }
  .hero-name { white-space: normal; }

  .section-head { flex-direction: column; align-items: flex-start; }

  section { padding: var(--section-pad-y) 0; }

  .social-row { gap: 18px 24px; }
}
