/*
 * base.css — Design tokens, reset, typography, shared components
 * Desai Lab · Case Western Reserve University
 */

/* ===== DESIGN TOKENS ===== */

:root {
  /* Backgrounds */
  --bg:              #FBF6EC;
  --bg-alt:          #F3E8D4;
  --bg-card:         #FFFFFF;
  --bg-card-hover:   #FFFCF5;

  /* Borders */
  --border:          #E8DAC0;
  --border-mid:      #D9C4A0;
  --border-light:    rgba(43, 33, 24, 0.06);

  /* Accent: warm terracotta (echoes the red blood cell illustration) */
  --accent:          #BD5430;
  --accent-bright:   #D2682E;
  --accent-dim:      rgba(189, 84, 48, 0.08);
  --accent-glow:     rgba(189, 84, 48, 0.18);

  /* Secondary: dusty plum (echoes the stem cell illustration) */
  --plum:            #8C5870;
  --plum-dim:        rgba(140, 88, 112, 0.10);

  /* Text */
  --text:            #2B2117;
  --text-secondary:  #6B5D4B;
  --text-muted:      #9E8F76;
  --text-on-accent:  #FBF6EC;

  /* Typography */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Karla', system-ui, -apple-system, sans-serif;

  /* Spacing scale */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Layout */
  --nav-h:        76px;
  --max-w:        1180px;
  --max-w-narrow: 800px;
  --max-w-text:   680px;
  --side-pad:     clamp(1.25rem, 5vw, 3rem);

  /* Radii */
  --r-sm: 6px;
  --r:    14px;
  --r-lg: 26px;

  /* Transitions */
  --ease:      0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}


/* ===== CSS RESET ===== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

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

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}


/* ===== TYPOGRAPHY ===== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.18;
  color: var(--text);
  letter-spacing: -0.01em;
}

p {
  line-height: 1.75;
  color: var(--text-secondary);
}

strong {
  color: var(--text);
  font-weight: 700;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}


/* ===== LAYOUT ===== */

.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--side-pad);
}

.container--narrow {
  max-width: var(--max-w-narrow);
}

.container--text {
  max-width: var(--max-w-text);
}

.page-main {
  padding-top: var(--nav-h);
}

.section {
  padding: var(--sp-24) 0;
}

.section--sm {
  padding: var(--sp-16) 0;
}

.section--lg {
  padding: var(--sp-32) 0;
}

.section-head {
  margin-bottom: var(--sp-12);
}

.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  margin-bottom: var(--sp-4);
}

.section-head p {
  font-size: 1.08rem;
  max-width: var(--max-w-text);
}

.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
}


/* ===== SHARED COMPONENTS ===== */

/* Section label (small kicker, no shouting) */
.label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}

.label::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.7;
}

/* Numeric / word label kept simple, no leading zeros theatrics */
.num-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: var(--sp-2);
  opacity: 0.9;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.8em 1.7em;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 100px;
  transition: all var(--ease);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  box-shadow: 0 6px 16px -4px var(--accent-glow);
}

.btn--primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -6px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-mid);
}

.btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-8);
  transition: border-color var(--ease), background var(--ease), transform var(--ease), box-shadow var(--ease);
}

.card:hover {
  border-color: var(--border-mid);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -16px rgba(43, 33, 24, 0.18);
}

/* Technique / keyword tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.tag {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--plum);
  background: var(--plum-dim);
  border: 1px solid transparent;
  border-radius: 100px;
  padding: 0.35em 0.85em;
  white-space: nowrap;
}

/* Inline hyperlink style */
.link {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-glow);
  transition: color var(--ease), border-color var(--ease);
}

.link:hover {
  color: var(--accent-bright);
  border-color: var(--accent-bright);
}

/* External link icon */
.link-ext::after {
  content: ' ↗';
  font-size: 0.8em;
  opacity: 0.6;
}

/* Avatar component */
.avatar {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-card);
  border: 3px solid var(--bg-card);
  outline: 1px solid var(--border);
  flex-shrink: 0;
  transition: outline-color var(--ease), transform var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -10px rgba(43, 33, 24, 0.25);
}

.avatar:hover {
  outline-color: var(--accent);
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.avatar-fallback {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
  background: var(--accent-dim);
}

.avatar--sm  { width: 56px;  height: 56px;  }
.avatar--md  { width: 104px; height: 104px; }
.avatar--lg  { width: 140px; height: 140px; }
.avatar--xl  { width: 184px; height: 184px; }

/* The RBC illustration's natural canvas has generous padding around the
   cell shape; scale it up so it fills circular icon frames consistently
   with the other cell illustrations. */
img[src*="rbc_bioart"] {
  transform: scale(1.9);
}

.avatar--sm  .avatar-fallback { font-size: 1.1rem; }
.avatar--md  .avatar-fallback { font-size: 1.8rem; }
.avatar--lg  .avatar-fallback { font-size: 2.4rem; }
.avatar--xl  .avatar-fallback { font-size: 3rem;   }

/* Page inner header */
.page-header {
  padding: calc(var(--nav-h) + var(--sp-16)) 0 var(--sp-12);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-20);
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
}

.page-header .container {
  display: grid;
  grid-template-columns: 1fr minmax(0, 440px);
  column-gap: var(--sp-16);
  position: relative;
  z-index: 1;
}

.page-header .label {
  grid-column: 1 / -1;
}

.page-header h1 {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  margin-bottom: 0;
  align-self: end;
}

.page-header p {
  font-size: 1.1rem;
  max-width: none;
  align-self: end;
  padding-bottom: 0.2em;
}


/* ===== SCROLL REVEAL ===== */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--ease-slow), transform var(--ease-slow);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > *:nth-child(1) { transition-delay: 0.04s; }
.reveal-stagger > *:nth-child(2) { transition-delay: 0.10s; }
.reveal-stagger > *:nth-child(3) { transition-delay: 0.16s; }
.reveal-stagger > *:nth-child(4) { transition-delay: 0.22s; }
.reveal-stagger > *:nth-child(5) { transition-delay: 0.28s; }
.reveal-stagger > *:nth-child(6) { transition-delay: 0.34s; }


/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  :root {
    --sp-24: 4.5rem;
    --sp-32: 6rem;
  }

  .section {
    padding: var(--sp-16) 0;
  }

  .section--lg {
    padding: var(--sp-20) 0;
  }

  .page-header {
    padding: calc(var(--nav-h) + var(--sp-10)) 0 var(--sp-10);
    margin-bottom: var(--sp-12);
  }

  .page-header .container {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: clamp(2.2rem, 7vw, 3.2rem);
    margin-bottom: var(--sp-4);
    align-self: auto;
  }

  .page-header p {
    align-self: auto;
    padding-bottom: 0;
  }
}
