/* =========================================================
   Neuroscience 7000 Years Ago — black & white modern academic
   ========================================================= */

:root {
  --ink: #111;
  --ink-soft: #444;
  --line: #e5e5e5;
  --line-strong: #111;
  --paper: #ffffff;
  --paper-soft: #f6f6f6;
  --paper-tint: #fafafa;
  --serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.08);
  --measure: 68ch;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover, a:focus-visible { text-decoration: underline; }

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

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.4em;
  font-weight: 600;
}

p { margin: 0 0 1em; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Site header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.brand__logo {
  height: 38px;
  width: auto;
  filter: grayscale(1);
}
.brand__name {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.site-nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.site-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  text-decoration: none;
}

/* Hamburger button — visible only on small screens */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--ink);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  transition: transform 200ms ease, opacity 200ms ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--line);
  padding: 64px 0 48px;
  background: var(--paper);
  text-align: center;
}
.hero__inner { max-width: 760px; margin: 0 auto; }
.hero__logo {
  height: 96px;
  width: auto;
  margin: 0 auto 24px;
  filter: grayscale(1);
}
.hero__title {
  font-size: clamp(2rem, 5vw, 3.4rem);
  margin-bottom: 18px;
}
.hero__intro {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 60ch;
}

/* ---------- Section blocks ---------- */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin: 56px 0 24px;
}
.section-title {
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  margin: 0;
}
.section-link {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.section-sub {
  color: var(--ink-soft);
  margin-top: -4px;
  margin-bottom: 24px;
}

/* ---------- Timeline (two-axis scatter) ---------- */
.timeline {
  margin: 64px 0 32px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.timeline > .section-title { text-align: center; }
.timeline > .section-sub  { text-align: center; }

.timeline__svg-wrap {
  margin-top: 24px;
  overflow: visible;
}
.timeline__svg {
  width: 100%;
  height: auto;
  display: block;
}

.timeline__axis { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.timeline__grid {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.timeline__lane {
  stroke: var(--line);
  stroke-width: 1;
  opacity: 0.9;
}
.timeline__axis-label {
  font-family: var(--sans);
  font-size: 14px;
  fill: var(--ink-soft);
  letter-spacing: 0.04em;
}
.timeline__name {
  font-family: var(--serif);
  font-size: 18px;
  fill: var(--ink);
}
.timeline__year-near {
  font-family: var(--sans);
  font-size: 13px;
  fill: var(--ink-soft);
  letter-spacing: 0.04em;
}
.timeline__hit {
  fill: transparent;
  pointer-events: all;
}
.timeline__dot {
  fill: var(--ink);
  transition: r 160ms ease;
}
.timeline__node { cursor: pointer; }
.timeline__node:hover .timeline__dot,
.timeline__node:focus-visible .timeline__dot { r: 13; }
.timeline__node:hover .timeline__name,
.timeline__node:focus-visible .timeline__name { font-weight: 700; }
.timeline__node:hover .timeline__year-near,
.timeline__node:focus-visible .timeline__year-near { fill: var(--ink); }

.timeline__list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 760px) {
  .timeline__svg-wrap { display: none; }
  .timeline__list {
    display: block;
    border-top: 1px solid var(--line);
    margin-top: 16px;
  }
  .timeline__list li { border-bottom: 1px solid var(--line); }
  .timeline__list a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 4px;
    text-decoration: none;
  }
  .timeline__list a:hover { background: var(--paper-soft); }
  .timeline__list-name {
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--ink);
  }
  .timeline__list-year {
    color: var(--ink-soft);
    font-size: 0.9rem;
  }
}

/* ---------- Cards (shared) ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease;
  overflow: hidden;
}
.card:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.card__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: var(--ink);
}
.card__link:hover { text-decoration: none; }

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--line);
  filter: grayscale(0.15);
}
.card-image--placeholder {
  height: 200px;
  background: var(--paper-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}
.card-image--placeholder span {
  font-family: var(--serif);
  font-size: 4rem;
  color: var(--ink-soft);
}

.card__body { padding: 18px 18px 20px; flex: 1; display: flex; flex-direction: column; }
.card__title {
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.card__excerpt {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin: 0 0 14px;
  flex: 1;
}
.card__more {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  align-self: flex-start;
}

/* ---------- Carousel ---------- */
.carousel-section { padding: 12px 0 8px; }
.carousel {
  position: relative;
  padding: 0 56px;          /* gutter on each side reserved for the arrows */
}
.carousel__track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 8px 4px 24px;
  -webkit-overflow-scrolling: touch;
}
.carousel__track::-webkit-scrollbar { height: 6px; }
.carousel__track::-webkit-scrollbar-thumb { background: var(--line); }
.carousel__card {
  flex: 0 0 calc(33.333% - 14px);
  min-width: 260px;
  scroll-snap-align: start;
}
@media (max-width: 900px) { .carousel__card { flex-basis: calc(50% - 10px); } }
@media (max-width: 560px) { .carousel__card { flex-basis: 80%; } }

.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, color 160ms ease;
}
.carousel__btn:hover { background: var(--ink); color: var(--paper); }
.carousel__btn:disabled { opacity: 0.25; cursor: default; }
.carousel__btn--prev { left: 4px; }
.carousel__btn--next { right: 4px; }
@media (max-width: 600px) {
  .carousel { padding: 0 44px; }
  .carousel__btn { width: 36px; height: 36px; }
  .carousel__btn--prev { left: 2px; }
  .carousel__btn--next { right: 2px; }
}

/* ---------- Grids ---------- */
.grid {
  display: grid;
  gap: 24px;
}
.grid--cards {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin: 16px 0 64px;
}
.grid--civs {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  margin: 16px 0 64px;
}

.civ-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--paper);
  transition: all 200ms ease;
  overflow: hidden;
}
.civ-card:hover {
  border-color: var(--ink);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
}
.civ-card__img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  filter: grayscale(0.15);
}
.civ-card__img--placeholder {
  height: 180px;
  background: var(--paper-soft);
}
.civ-card__body { padding: 18px; }
.civ-card__name { font-size: 1.4rem; margin-bottom: 6px; }
.civ-card__year { color: var(--ink-soft); margin: 0 0 4px; font-size: 0.95rem; letter-spacing: 0.04em; }
.civ-card__count { color: var(--ink-soft); margin: 0; font-size: 0.85rem; }

/* ---------- Page meta ---------- */
.breadcrumbs {
  margin: 32px 0 8px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.breadcrumbs span { margin: 0 6px; opacity: 0.5; }

.page-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 6px 0 8px;
}
/* About page section headings */
.about-page h2 {
  margin-top: 2.2em;
  font-size: 1.5rem;
}
.about-page h2:first-of-type { margin-top: 0.6em; }

.about-logo {
  margin: 2em 0;
  text-align: left;
}
.about-logo img {
  display: block;
  margin: 0;
  max-width: 220px;
  height: auto;
  filter: grayscale(1);
  opacity: 0.92;
  transition: filter 200ms ease, opacity 200ms ease;
}
.about-logo:hover img {
  filter: none;
  opacity: 1;
}
.about-logo figcaption {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.about-logo--street-doctor img { max-width: 180px; }
.page-sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
}

/* ---------- Article body ---------- */
.article__head { padding-top: 8px; }
.article__title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 8px 0 24px;
  max-width: 22ch;
}
.article__hero {
  background: var(--paper-soft);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 8px 0 24px;
}
.article__hero-img {
  display: block;
  margin: 0 auto;
  max-height: 520px;
  width: auto;
  max-width: 100%;
  filter: grayscale(0.1);
}
.article__body {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 16px;
  padding-bottom: 80px;
  /* horizontal padding inherited from .wrap, so text never hugs the screen edge on mobile */
  font-size: 1.05rem;
}
.article__body p { margin: 0 0 1.2em; }
.article__body h2,
.article__body h3,
.article__body h4 { margin-top: 1.6em; }
.article__body h2 { font-size: 1.6rem; }
.article__body h3 { font-size: 1.3rem; }
.article__body img {
  display: block;
  margin: 1.6em auto;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  filter: grayscale(0.1);
}
.article__body ul, .article__body ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.article__body li { margin-bottom: 0.4em; }
.article__body strong { font-weight: 700; color: var(--ink); }
.article__body blockquote {
  border-left: 3px solid var(--ink);
  margin: 1.6em 0;
  padding: 4px 0 4px 18px;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-style: italic;
}
.article__body figure {
  margin: 1.6em 0;
}
.article__body figcaption {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 8px;
}

/* ---------- Funding strip (home page) ---------- */
.funding {
  border-top: 1px solid var(--line);
  margin-top: 64px;
  padding: 28px 0;
  background: var(--paper-tint);
}
.funding__inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.funding__logo {
  flex: 0 0 auto;
  width: 120px;
  height: auto;
  filter: grayscale(1);
  opacity: 0.85;
}
.funding__text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
@media (max-width: 600px) {
  .funding__inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .funding__logo { width: 96px; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-tint);
  padding: 32px 0;
  margin-top: 48px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.site-footer__inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer p { margin: 0; }
.site-footer__tag { font-style: italic; }

/* ---------- Utilities ---------- */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* =========================================================
   Responsive breakpoints
   ========================================================= */

/* Tablet: 900px and below */
@media (max-width: 900px) {
  .wrap { padding: 0 20px; }
  .hero { padding: 48px 0 36px; }
  .hero__logo { height: 80px; }
  .section-header {
    margin: 40px 0 18px;
  }
  .grid--cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
  .grid--civs  { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
}

/* Tablet/large mobile: 768px and below — collapse the header nav */
@media (max-width: 768px) {
  .site-header__inner {
    flex-wrap: wrap;
    padding: 12px 20px;
  }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 12px 0 4px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a {
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a:last-child { border-bottom: none; }
  .site-nav a:hover { border-bottom-color: var(--line); }

  .brand__name { display: none; }     /* logo + hamburger only on mobile */
  .brand__logo { height: 56px; }      /* larger logo since the brand text is gone */
}

/* Mobile: 600px and below */
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 40px 0 28px; }
  .hero__logo { height: 64px; margin-bottom: 18px; }

  .section-header {
    flex-wrap: wrap;
    gap: 8px;
    margin: 32px 0 14px;
  }
  .section-link { font-size: 0.8rem; }

  .grid { gap: 16px; }
  .grid--cards { grid-template-columns: 1fr; }
  .grid--civs  { grid-template-columns: 1fr; }

  .card-image, .card-image--placeholder { height: 180px; }
  .civ-card__img, .civ-card__img--placeholder { height: 160px; }

  .breadcrumbs { margin: 24px 0 8px; font-size: 0.85rem; }
  .page-title  { font-size: clamp(1.5rem, 7vw, 2rem); }
  .page-sub    { font-size: 0.9rem; }

  .article__title { margin: 6px 0 18px; max-width: none; }
  .article__hero-img { max-height: 360px; }
  .article__body {
    font-size: 1rem;
    padding-top: 12px;
    padding-bottom: 56px;     /* horizontal padding handled by .wrap */
  }
  .article__body h2 { font-size: 1.4rem; }
  .article__body h3 { font-size: 1.15rem; }

  .about-logo img            { max-width: 180px; }
  .about-logo--street-doctor img { max-width: 150px; }

  .site-footer { padding: 24px 0; margin-top: 32px; }
  .site-footer__inner { flex-direction: column; gap: 6px; }
}

/* Small mobile: 380px and below */
@media (max-width: 380px) {
  .hero__title { font-size: 1.6rem; }
}
