/* =========================================================================
   Kamyar Hasanzadeh — academic site theme
   Layered on top of Furo. Furo's own color/font variables are set in
   conf.py (light_css_variables / dark_css_variables); this file covers
   layout, components, and the bits Furo doesn't expose as variables.
   ========================================================================= */

:root {
  --kh-radius: 16px;
  --kh-radius-sm: 10px;
  --kh-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px -12px rgba(20, 20, 20, 0.16);
  --kh-shadow-hover: 0 4px 10px -2px rgba(20, 20, 20, 0.10), 0 16px 32px -12px rgba(20, 20, 20, 0.22);
}

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

article.bd-article,
.content,
article {
  line-height: 1.7;
}

h1, h2, h3, h4, h5 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

article h1 {
  font-size: 2.3rem;
  margin-bottom: 0.6em;
}

article h2 {
  font-size: 1.55rem;
  margin-top: 2.4em;
  padding-top: 0.2em;
}

article h2::before {
  content: "";
  display: block;
  width: 42px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-brand-primary);
  margin-bottom: 0.7em;
  opacity: 0.85;
}

article h3 {
  font-size: 1.2rem;
  margin-top: 1.8em;
}

article p {
  max-width: 68ch;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* =========================================================================
   Replace Furo's docs-sidebar chrome with our own persistent left
   sidebar (profile photo, contact links, nav) + main content column.
   Furo's own sidebar/toc drawers and mobile header are unused — hidden
   outright, and .content reclaims the width they used to reserve.
   ========================================================================= */

.sidebar-drawer,
.toc-drawer,
.mobile-header,
.sidebar-toggle,
.sidebar-overlay,
.toc-overlay,
.content-icon-container {
  display: none !important;
}

.main {
  display: block !important;
}

.content {
  width: 100% !important;
  max-width: 1040px !important;
  margin: 0 auto !important;
  padding: 2.5rem 2rem 0 2rem !important;
}

@media (max-width: 40em) {
  .content {
    padding: 1.75rem 1.25rem 0 1.25rem !important;
  }
}

/* ---------- Site shell: sidebar + main column ---------- */

.kh-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.75rem;
}

/* .kh-sidebar (the grid cell) stretches to match the height of the main
   content column (grid default align-items:stretch) so that the sticky
   card inside has room to stay pinned for the full scroll of a long
   page — a plain sticky div on a start-aligned cell only stays stuck
   for the height of its own content, then scrolls away. */
.kh-sidebar {
  height: 100%;
}

.kh-sidebar__card {
  position: sticky;
  top: 2rem;
  padding: 1.6rem 1.4rem;
  border: 1px solid var(--color-foreground-border);
  border-radius: var(--kh-radius);
  background: var(--color-background-secondary);
  text-align: center;
}

.kh-sidebar__brand {
  display: block;
  text-decoration: none !important;
}

.kh-sidebar__photo {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  margin: 0 auto 0.9rem auto;
  box-shadow: 0 0 0 3px var(--color-background-secondary), 0 0 0 4px var(--color-foreground-border);
}

.kh-sidebar__name {
  font-family: var(--font-stack--headings);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-foreground-primary) !important;
}

.kh-sidebar__lines {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-foreground-secondary);
}

.kh-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-foreground-border);
}

.kh-sidebar__nav a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--kh-radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-foreground-secondary) !important;
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.kh-sidebar__nav a:hover {
  background: var(--color-background-hover);
  color: var(--color-foreground-primary) !important;
}

.kh-sidebar__nav a.is-current {
  background: var(--color-background-hover);
  color: var(--color-brand-primary) !important;
  font-weight: 700;
}

.kh-sidebar__contact {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-foreground-border);
  text-align: left;
}

.kh-sidebar__contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--color-foreground-secondary) !important;
  text-decoration: none !important;
}

.kh-sidebar__contact-item:hover {
  color: var(--color-brand-primary) !important;
}

.kh-sidebar__contact-item .kh-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.kh-sidebar__contact-item .kh-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.kh-sidebar__toggle {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-foreground-border);
  display: flex !important;
  justify-content: center;
}

.kh-sidebar__toggle .theme-toggle {
  color: var(--color-foreground-secondary);
}

/* ---------- CV page — resume-style timeline lists ---------- */

.kh-page--cv ul {
  list-style: none !important;
  margin: 0.8em 0 1.7em 0 !important;
  padding: 0 !important;
}

.kh-page--cv ul li {
  position: relative;
  padding-left: 1.4rem !important;
  margin: 0.75em 0 !important;
  line-height: 1.55;
}

.kh-page--cv ul li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.6em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-brand-primary);
}

@media (max-width: 55em) {
  .kh-shell {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .kh-sidebar__card {
    position: static;
    text-align: left;
  }
  .kh-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
  }
  .kh-sidebar__photo {
    margin: 0;
    flex: 0 0 auto;
  }
  .kh-sidebar__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .kh-sidebar__nav a {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* =========================================================================
   Homepage hero
   ========================================================================= */

.kh-hero {
  position: relative;
  margin: 0 -1px 2.6em -1px;
  border-radius: var(--kh-radius);
  overflow: hidden;
  isolation: isolate;
  color: #fdfbf7;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
}

.kh-hero__bg {
  position: absolute;
  inset: 0;
  background-image: var(--kh-hero-image, none);
  background-size: cover;
  background-position: center 62%;
  z-index: -2;
}

.kh-hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 20, 0.05) 0%, rgba(10, 14, 20, 0.25) 45%, rgba(8, 11, 16, 0.88) 100%);
}

.kh-hero__content {
  position: relative;
  z-index: 1;
  padding: 3.2rem 2.4rem 2rem 2.4rem;
}

.kh-hero__eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 0.6em 0;
}

.kh-hero__title {
  font-family: var(--font-stack--headings);
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.4em 0;
  color: #fff;
}

.kh-hero__tagline {
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 58ch;
  opacity: 0.92;
  margin: 0;
}

@media (max-width: 67em) {
  .kh-hero {
    margin: -1.6em -1px 2.2em -1px;
  }
  .kh-hero__content {
    padding: 2.2rem 1.5rem 1.6rem 1.5rem;
  }
}

/* ---------- Explore card grid ---------- */

.kh-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.6em 0 2.4em 0;
  list-style: none;
  padding: 0;
}

.kh-card {
  display: block;
  padding: 1.3rem 1.4rem;
  border-radius: var(--kh-radius-sm);
  border: 1px solid var(--color-foreground-border);
  background: var(--color-background-secondary);
  text-decoration: none !important;
  color: var(--color-foreground-primary) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.kh-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--kh-shadow-hover);
  border-color: var(--color-brand-primary);
}

.kh-card__icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.kh-card__title {
  font-family: var(--font-stack--headings);
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.3em 0;
}

.kh-card__desc {
  font-size: 0.86rem;
  color: var(--color-foreground-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ---------- Research focus chips (about section) ---------- */

.kh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1.2em 0 2em 0;
}

.kh-chips li {
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--color-background-secondary);
  border: 1px solid var(--color-foreground-border);
  color: var(--color-foreground-secondary);
}

/* =========================================================================
   Publications list (rendered by publications.ipynb via nbsphinx)
   ========================================================================= */

.rendered_html ol {
  list-style: none;
  padding: 0 !important;
  margin: 1.4em 0 !important;
  counter-reset: kh-pub;
}

.rendered_html ol > li {
  counter-increment: kh-pub;
  position: relative;
  padding: 0.95rem 1.1rem 0.95rem 3.2rem !important;
  margin: 0.55em 0 !important;
  border: 1px solid var(--color-foreground-border);
  border-radius: var(--kh-radius-sm);
  background: var(--color-background-secondary);
  line-height: 1.6;
  font-size: 0.95rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.rendered_html ol > li:hover {
  box-shadow: var(--kh-shadow);
  border-color: var(--color-brand-primary);
}

.rendered_html ol > li::before {
  content: counter(kh-pub);
  position: absolute;
  left: 0.9rem;
  top: 0.95rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  background: var(--color-brand-primary);
  color: #fdfbf7;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rendered_html ol > li a {
  color: var(--color-brand-primary);
}

/* =========================================================================
   Notebook (nbsphinx) output cleanup — keep code cells subtle
   ========================================================================= */

.nboutput .prompt,
.nbinput .prompt {
  display: none !important;
}

div.nbinput,
div.nboutput {
  margin: 0 !important;
}

div.nbinput.container {
  display: none;
}

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

.related-pages .next-page,
.related-pages .prev-page {
  border-radius: var(--kh-radius-sm);
}

footer .icons a {
  color: var(--color-foreground-secondary);
}

footer .icons a:hover {
  color: var(--color-brand-primary);
}
