/* ==========================================================================
   Custom design layer.
   Loaded after main.min.css; overrides the legacy float grid with a
   container + CSS grid layout, a new type scale, and light/dark themes.
   Edit this file (not the LESS build) for design changes.
   ========================================================================== */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", "PT Serif", Georgia, serif;

  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --bg-card: #ffffff;
  --fg: #1b1b1c;
  --fg-muted: #5f6368;
  --fg-faint: #8a8f96;
  --border: #e4e4e1;
  --border-strong: #cfcfcb;
  --accent: #8c1515;          /* Stanford cardinal */
  --accent-soft: #f4e9e9;
  --accent-hover: #6f1010;

  --maxw: 1080px;
  --gutter: 1.5rem;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 22, 0.04), 0 8px 24px -12px rgba(16, 18, 22, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-soft: #1a1d22;
    --bg-card: #1a1d22;
    --fg: #e9eaec;
    --fg-muted: #a5abb4;
    --fg-faint: #7d848d;
    --border: #2b2f36;
    --border-strong: #3a3f47;
    --accent: #e88a8a;
    --accent-soft: #2a1e20;
    --accent-hover: #f2a5a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

/* The legacy theme predates border-box and never sets it, so padding is ADDED
   to any width we declare. That made `.navigation-wrapper { width: 100% }` plus
   its centering padding overflow the viewport and push the last nav links
   off-screen. Opt the whole document in. */
*,
*:before,
*:after {
  box-sizing: border-box;
}

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

body,
body.page {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.page article p,
body.page article li {
  font-size: 1rem;
  color: var(--fg);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--fg);
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-transform: none;
}

#main article h1 {
  font-size: 2rem;
  margin: 0 0 1.5rem;
  font-weight: 700;
}

#main article h2 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

#main article h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.75rem 0 0.5rem;
}

a,
a:visited {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 0 none;
}

a:hover,
a:focus {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-wrap p > a,
.article-wrap li > a {
  border-bottom: 0 none;
}

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

/* --------------------------------------------------------------------------
   Navigation (full-bleed sticky bar, centered content)
   -------------------------------------------------------------------------- */

.navigation-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0.85rem max(var(--gutter), calc((100% - var(--maxw)) / 2)) !important;
  float: none !important;
  font-family: var(--font-sans);
  font-weight: 500;
  text-transform: none;
  background-color: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}

@media (prefers-color-scheme: dark) {
  .navigation-wrapper {
    background-color: rgba(20, 22, 26, 0.82);
  }
}

.navigation-wrapper .site-name,
.navigation-wrapper .top-navigation {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  display: block;
}

.site-name a {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.site-name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.top-navigation ul {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.top-navigation li {
  display: block;
  margin: 0;
  border-bottom: 0 none;
  font-size: 0.94rem;
}

.top-navigation li a {
  display: inline-block;
  padding: 0.15rem 0;
  color: var(--fg-muted);
  border-bottom: 2px solid transparent;
}

.top-navigation li a:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* The theme's JS injects a hamburger button and collapses the mobile menu by
   clamping max-height. Three links fit on one line, so drop the button and
   keep the links visible, wrapping under the name on narrow screens. */
.js .nav ul,
.no-js .nav ul {
  max-height: none;
  overflow: visible;
}

.nav .navtoogle,
#menutoggle {
  display: none !important;
}

@media (max-width: 599px) {
  .navigation-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .top-navigation ul {
    gap: 1.1rem;
    flex-wrap: wrap;
  }
}

/* --------------------------------------------------------------------------
   Page shell: sidebar + article
   -------------------------------------------------------------------------- */

/* The theme clears floats with a `display: table` :before/:after on these
   containers. Once they become grid/flex containers those pseudo-elements turn
   into grid/flex ITEMS: the empty :before claimed the sidebar column and pushed
   the article into the next row (a ~210px-wide strip). Remove them. */
#main:before,
#main:after,
.navigation-wrapper:before,
.navigation-wrapper:after,
.footer-wrap footer:before,
.footer-wrap footer:after {
  display: none !important;
  content: none !important;
}

#main {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 3.5rem;
  width: auto !important;
  max-width: var(--maxw) !important;
  margin: 0 auto !important;
  padding: 3rem var(--gutter) 4rem !important;
  float: none !important;
}

#main article,
#main .article-author-side {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
}

#main article {
  min-width: 0;
}

/* Pages that render their own hero (the homepage) drop the sidebar. */
body.has-hero #main {
  grid-template-columns: minmax(0, 1fr);
}

body.has-hero #main .article-author-side {
  display: none !important;
}

@media (max-width: 820px) {
  #main {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding-top: 2rem !important;
  }
}

/* Feature banner. The theme rendered this full-bleed with an arrow notch cut
   out of the bottom edge; here it is a contained, rounded header strip. */
.image-wrap {
  position: relative;
  width: auto;
  max-width: var(--maxw);
  margin: 1.75rem auto 0;
  padding: 0 var(--gutter);
}

.image-wrap:after {
  display: none;
}

.image-wrap img {
  display: block;
  width: 100%;
  height: clamp(110px, 17vw, 185px);
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
  .image-wrap img {
    filter: brightness(0.82) saturate(0.9);
  }
}

.image-wrap .image-credit {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--fg-faint);
}

/* The banner already separates the nav from the content. */
.image-wrap + #main {
  padding-top: 2rem !important;
}

/* --------------------------------------------------------------------------
   Profile card (sidebar)
   -------------------------------------------------------------------------- */

.article-author-side {
  display: block !important;
  align-self: start;
  position: sticky;
  top: 5.5rem;
  font-family: var(--font-sans);
}

.article-author-side .bio-photo {
  max-width: 150px !important;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 28%;   /* keep the face centered in the square crop */
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.article-author-side h3 {
  max-width: none !important;
  margin: 0.9rem 0 0.25rem !important;
  font-size: 1.05rem;
  font-weight: 700;
}

.article-author-side p {
  max-width: none !important;
  margin-bottom: 1rem !important;
  font-size: 0.85rem;
  font-style: normal;
  line-height: 1.5;
  color: var(--fg-muted);
}

.author-social {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  max-width: none !important;
  margin-bottom: 0.35rem !important;
  padding: 0.15rem 0;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--fg-muted) !important;
}

.author-social:hover {
  color: var(--accent) !important;
  text-decoration: none;
  transform: none;
}

.author-social .fa,
.author-social .ai {
  width: 1rem;
  margin-right: 0 !important;
  text-align: center;
  color: var(--fg-faint);
}

.author-social:hover .fa,
.author-social:hover .ai {
  color: var(--accent);
}

@media (max-width: 820px) {
  .article-author-side {
    position: static;
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 0 1.1rem;
    align-items: center;
    padding: 1rem !important;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .article-author-side .bio-photo {
    grid-row: span 3;
    max-width: 92px !important;
  }
  .article-author-side h3 {
    margin-top: 0 !important;
  }
  .article-author-side p {
    margin-bottom: 0.5rem !important;
  }
  .author-social {
    display: inline-flex !important;
    margin-right: 0.9rem;
  }
}

/* --------------------------------------------------------------------------
   Hero (homepage)
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 3rem;
}

.hero-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: 50% 28%;   /* keep the face centered in the square crop */
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-name {
  font-family: var(--font-sans);
  font-size: 2.4rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}

.hero-role {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  color: var(--fg-muted);
  margin: 0 0 0.5rem;
}

.hero-tagline {
  font-size: 1rem;
  color: var(--fg-muted);
  margin: 0 0 1.1rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--font-sans);
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.hero-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    text-align: left;
  }
  .hero-photo {
    max-width: 140px;
  }
  .hero-name {
    font-size: 2rem;
  }
}

/* --------------------------------------------------------------------------
   News list
   -------------------------------------------------------------------------- */

.news {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 20rem;
  overflow-y: auto;
}

.news li {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--border);
  list-style: none;
  font-size: 0.95rem;
}

.news li:last-child {
  border-bottom: 0;
}

.news .date {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-faint);
  padding-top: 0.22rem;
}

@media (max-width: 640px) {
  .news li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }
}

/* --------------------------------------------------------------------------
   Research thread cards
   -------------------------------------------------------------------------- */

.threads {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.threads li {
  list-style: none;
  margin: 0;
  padding: 1.1rem 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.threads li:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.threads h3 {
  margin: 0 0 0.4rem !important;
  font-size: 0.95rem;
  font-weight: 650;
}

.threads p {
  margin: 0;
  font-size: 0.9rem !important;
  line-height: 1.55;
  color: var(--fg-muted) !important;
}

/* --------------------------------------------------------------------------
   Publication list
   -------------------------------------------------------------------------- */

.pub-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
}

.pub-list li.pub {
  list-style: none;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0 1.25rem;
  margin: 0 0 0.75rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pub-list li.pub:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.venue {
  display: inline-block;
  align-self: start;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.venue.venue-preprint {
  color: var(--fg-muted);
  background: var(--bg-soft);
}

.pub-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  color: var(--fg);
}

.pub-authors {
  display: block;
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}

.pub-authors .me {
  color: var(--fg);
  font-weight: 600;
}

.pub-note {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-faint);
  margin-bottom: 0.4rem;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-sans);
}

.pub-links a {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 550;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.pub-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

@media (max-width: 640px) {
  .pub-list li.pub {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }
  .venue {
    justify-self: start;
  }
}

/* --------------------------------------------------------------------------
   Photos
   -------------------------------------------------------------------------- */

figure.photo {
  margin: 0 0 1.75rem;
}

figure.photo a {
  display: block;
  border-bottom: 0 none;
}

figure.photo img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transition: transform 0.18s ease;
}

figure.photo img:hover {
  transform: translateY(-2px);
}

figure.photo figcaption {
  margin-top: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* --------------------------------------------------------------------------
   Buttons and callouts
   -------------------------------------------------------------------------- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.05rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff !important;
  background: var(--accent);
  border-radius: 8px;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  .btn-primary {
    color: #16181c !important;
  }
}

.note {
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer-wrap {
  width: auto !important;
  max-width: var(--maxw) !important;
  margin: 0 auto !important;
  padding: 1.5rem var(--gutter) 3rem !important;
  border-top: 1px solid var(--border);
}

.footer-wrap footer {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: var(--font-sans);
}

.footer-wrap footer span,
.footer-wrap footer a {
  font-size: 0.82rem !important;
  color: var(--fg-faint);
}

.footer-wrap footer a:hover {
  color: var(--accent);
}
