/* ============================================================
   Total Brain International Database — Shared Stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Variables ---- */
:root {
  --navy:       #1B3A5C;
  --navy-dark:  #122840;
  --blue:       #2471A3;
  --blue-light: #5DADE2;
  --blue-pale:  #EBF5FB;
  --text:       #1C2B3A;
  --text-muted: #5D6D7E;
  --border:     #D5E3EE;
  --border-dark:#B8CEDE;
  --bg:         #F5F8FB;
  --white:      #FFFFFF;
  --radius:     5px;
  --radius-lg:  8px;
  --shadow:     0 2px 14px rgba(27,58,92,0.10);
  --shadow-sm:  0 1px 4px rgba(27,58,92,0.07);
  --max-width:  1100px;
}

/* ---- Reset / Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; color: var(--navy); }

h1 { font-size: 2rem;   margin-bottom: 0.6rem; }
h2 { font-size: 1.45rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.4rem; font-weight: 600; }
h4 { font-size: 0.9rem;  margin-bottom: 0.3rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--blue); }

p { margin-bottom: 0.875rem; color: var(--text); }
p:last-child { margin-bottom: 0; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { padding-left: 1.35rem; margin-bottom: 0.875rem; }
li { margin-bottom: 0.3rem; line-height: 1.55; }

strong { font-weight: 600; }

hr { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ---- Header ---- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 6px rgba(27,58,92,0.08);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
  height: 72px;
}

.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-logo img {
  height: 46px;
  width: auto;
  display: block;
}

.logo-text-fallback {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

/* ---- Navigation ---- */
.site-nav {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  overflow-x: auto;
}

.site-nav::-webkit-scrollbar { display: none; }

.site-nav a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.01em;
}

.site-nav a:hover { color: var(--navy); background: var(--blue-pale); text-decoration: none; }

.site-nav a.active {
  color: var(--navy);
  background: var(--blue-pale);
  font-weight: 600;
  border-bottom: 2px solid var(--blue);
  border-radius: var(--radius) var(--radius) 0 0;
  padding-bottom: 0.36rem;
}

/* ---- Page Layout ---- */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.75rem 4rem;
}

/* ---- Page Hero ---- */
.page-hero {
  background: linear-gradient(140deg, var(--navy-dark) 0%, var(--navy) 55%, #1d5280 100%);
  color: white;
  padding: 2.5rem 1.75rem;
}

.page-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.page-hero-text { flex: 1; padding-left: 3rem; }

.page-hero h1 {
  color: white;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.page-hero p {
  color: rgba(255,255,255,0.80);
  font-size: 0.975rem;
  max-width: 580px;
  margin-bottom: 0;
  line-height: 1.6;
}

.page-hero-image { flex-shrink: 0; margin-right: 3rem; }

.page-hero-image img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  object-position: center;
  display: block;
  filter: drop-shadow(0 4px 18px rgba(0,0,0,0.25));
}

/* ---- Stat Bar ---- */
.stat-bar {
  background: var(--navy);
  padding: 1rem 1.75rem;
  border-bottom: 3px solid rgba(126,200,227,0.3);
}

.stat-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 0;
  flex-wrap: nowrap;
  justify-content: space-around;
  align-items: center;
  overflow: hidden;
}

.stat-item {
  text-align: center;
  color: white;
  padding: 0.35rem 0.6rem;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
}

.stat-item + .stat-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: rgba(255,255,255,0.15);
}

.stat-item .stat-number {
  font-size: 1.4rem;
  font-weight: 700;
  display: block;
  line-height: 1.1;
  color: #7EC8E3;
  letter-spacing: -0.02em;
}

.stat-item .stat-label {
  font-size: 0.72rem;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-top: 0.1rem;
}

/* ---- Sections ---- */
.section { margin-bottom: 2.25rem; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1.05rem;
  background: var(--blue);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Always 2-column card grids — fixes orphan 4th card */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Special: allow 3-column when there are 6 cards (iSPOT page) */
.card-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ---- Data Table ---- */
.data-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.815rem;
  background: var(--white);
}

.data-table thead tr {
  background: var(--navy);
  color: white;
}

.data-table thead th {
  padding: 0.6rem 0.85rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.data-table tbody tr:hover { background: #F0F7FC; }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 0.5rem 0.85rem;
  vertical-align: middle;
}

.data-table td.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 500;
  color: var(--navy);
}

.data-table tr.group-header td {
  background: #DEECf7;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.data-table tr.sub-row td:first-child {
  padding-left: 2rem;
  color: var(--text-muted);
}

.data-table tr.sub-row td.number { color: var(--text-muted); font-weight: 400; }

.data-table tr.total-row td {
  background: var(--navy);
  color: white;
  font-weight: 700;
}

.data-table tr.total-row td.number { color: #7EC8E3; }

/* ---- Publication List ---- */
.pub-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.pub-search {
  flex: 1;
  min-width: 200px;
  padding: 0.48rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pub-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,113,163,0.10); }

.pub-filter {
  padding: 0.48rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.pub-filter:focus { border-color: var(--blue); }

.pub-count {
  font-size: 0.84rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-style: italic;
}

.pub-year-group { margin-bottom: 1.5rem; }

.pub-year-heading {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--navy);
  background: var(--blue-pale);
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pub-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin-bottom: 0.4rem;
  font-size: 0.855rem;
  line-height: 1.55;
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.pub-item:hover { border-color: var(--blue-light); box-shadow: var(--shadow-sm); }

/* ---- AGI Page ---- */
.agi-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.agi-section h2 {
  color: var(--navy);
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.9rem;
}

.agi-section h3 {
  color: var(--blue);
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.1rem;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agi-section p { font-size: 0.9rem; }

/* ---- Inline Figures ---- */
.figure-wrap {
  margin: 1.5rem 0;
  text-align: center;
}
.figure-wrap a {
  display: block;
  width: fit-content;
  margin: 0 auto;
  position: relative;
  text-decoration: none;
}
.figure-wrap a::after {
  content: 'click to enlarge';
  position: absolute;
  bottom: 0.45rem;
  right: 0.45rem;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 0.67rem;
  padding: 0.18rem 0.4rem;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  font-style: normal;
  letter-spacing: 0.02em;
}
.figure-wrap a:hover::after { opacity: 1; }
.figure-wrap a img {
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.figure-wrap a:hover img { opacity: 0.88; }
.figure-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: block;
  margin: 0 auto;
}
.figure-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  font-style: italic;
  line-height: 1.4;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
/* Default figure: medium width */
.figure-wrap img { max-width: 500px; }
/* Wide figures: larger but still constrained */
.figure-wrap.wide img { max-width: 620px; }
/* Constrained figures: smaller */
.figure-wrap.constrained img { max-width: 380px; }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #DC2626;
  color: white;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  font-size: 0.925rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 1;
  border: none;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.download-btn:hover { background: #B91C1C; transform: translateY(-1px); }

.coming-soon-badge {
  display: inline-block;
  background: #F4D03F;
  color: #7D6608;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.45rem;
  border-radius: 3px;
  vertical-align: middle;
}

.framework-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 0.855rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.framework-table thead tr { background: var(--navy); color: white; }

.framework-table th {
  padding: 0.6rem 0.85rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.framework-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.framework-table tbody tr:last-child td { border-bottom: none; }
.framework-table tbody tr:nth-child(even) { background: var(--blue-pale); }

.component-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--navy);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
}

/* ---- iSPOT Page ---- */
.ispot-layout {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 1.75rem;
  align-items: start;
  margin-bottom: 2rem;
}

.ispot-image-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 80px;
}

.ispot-image-wrap img { width: 100%; height: auto; display: block; }

.trial-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.trial-stat {
  background: var(--blue-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
}

.trial-stat .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  display: block;
  line-height: 1.1;
}

.trial-stat .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
  display: block;
}

/* ---- About Page ---- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.person-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.person-card-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.person-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.person-avatar img { width: 100%; height: 100%; object-fit: cover; }

.person-avatar-img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  object-fit: cover;
  object-position: center top;
  flex-shrink: 0;
}

.person-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.15rem; color: white; }
.person-title { font-size: 0.8rem; opacity: 0.8; line-height: 1.4; color: white; }

.person-card-body { padding: 1.25rem 1.5rem; }
.person-card-body p { font-size: 0.875rem; }

.contact-box {
  background: var(--blue-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.contact-box h2 { margin-bottom: 0.4rem; }
.contact-box > p { color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.9rem; }

.contact-methods { display: flex; flex-direction: column; gap: 0.65rem; }

.contact-method {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.contact-method .icon {
  width: 2rem;
  height: 2rem;
  background: var(--navy);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ---- Link List ---- */
.link-list { list-style: none; padding: 0; }

.link-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.875rem;
  line-height: 1.5;
}

.link-list li:last-child { border-bottom: none; }

/* ---- Notice / Alert ---- */
.notice {
  background: #FEF9E7;
  border: 1px solid #F9E79F;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.855rem;
  color: #7D6608;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.notice.blue {
  background: var(--blue-pale);
  border-color: var(--border);
  color: var(--navy);
}

/* ---- Footer ---- */
.site-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,0.65);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.82rem;
  margin-top: 3rem;
  border-top: 3px solid rgba(126,200,227,0.2);
}

.site-footer a { color: rgba(255,255,255,0.8); }
.site-footer a:hover { color: white; text-decoration: none; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .page-hero-inner { flex-direction: column; gap: 1.25rem; }
  .page-hero-image { display: none; }
  .ispot-layout { grid-template-columns: 1fr; }
  .ispot-image-wrap { position: static; }
  .about-grid { grid-template-columns: 1fr; }
  .trial-stat-grid { grid-template-columns: 1fr 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .header-inner { padding: 0 1rem; gap: 1rem; }
  .page-wrapper { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.65rem; }
  .stat-bar-inner { justify-content: center; gap: 0; }
  .stat-item { padding: 0.35rem 0.75rem; }
  .page-hero { padding: 2rem 1rem; }
}

@media (max-width: 540px) {
  .card-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .stat-item + .stat-item::before { display: none; }
}
