/* Custom styling for TorchEBM documentation */

/* Animated elements */
.animate__animated {
  animation-duration: 1s;
  animation-fill-mode: both;
}

.animate__fadeIn {
  animation-name: fadeIn;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Lead text */
.lead {
  font-size: 1.2rem;
  font-weight: 300;
  line-height: 1.5;
  margin-bottom: 2rem;
  text-align: center;
}

/* Cards */
.md-typeset .grid.cards > :is(ul, ol) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  grid-gap: 0.75rem;
  margin: 0.75rem 0 !important;
}

.md-typeset .grid.cards > :is(ul, ol) > li {
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 1rem;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
  position: relative;
}

.md-typeset .grid.cards > :is(ul, ol) > li:hover {
  border-color: var(--md-accent-fg-color);
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Make whole card clickable with overlay anchor */
.md-typeset .grid.cards > :is(ul, ol) > li.card-clickable { cursor: pointer; }
.md-typeset .grid.cards > :is(ul, ol) > li > a.card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  text-decoration: none;
  color: inherit;
}

.md-typeset .grid.cards > :is(ul, ol) > li > hr {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.md-typeset .grid.cards > :is(ul, ol) > li > :first-child {
  margin-top: 0;
}

.md-typeset .grid.cards > :is(ul, ol) > li > :last-child {
  margin-bottom: 0;
}

/* Custom figures */
figure {
  margin: 1em 0;
  text-align: center;
}

figcaption {
  font-size: 0.9rem;
  color: var(--md-default-fg-color--light);
  margin-top: 0.5rem;
}

/* Code blocks */
.md-typeset pre > code {
  border-radius: 0.5rem;
}

/* Code block header (macOS window style) */
.md-typeset .highlight { position: relative; border-radius: 10px; overflow: hidden; }
.md-typeset .highlight > pre { margin: 0; padding-top: 2.75rem; }

[data-md-color-scheme="slate"] .md-typeset .highlight::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 36px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
[data-md-color-scheme="default"] .md-typeset .highlight::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 36px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.05), rgba(0,0,0,0.02));
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.md-typeset .highlight::after {
  content: ""; position: absolute; top: 11px; left: 12px; width: 10px; height: 10px; border-radius: 50%; background: #ff5f56;
  box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #27c93f;
}

/* Buttons */
.md-button {
  border-radius: 0.25rem;
}

/* Spotlight effect for highlighted images */
.spotlight {
  border: 3px solid var(--md-accent-fg-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1.02);
  transition: all 0.2s ease-in-out;
}

.spotlight:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Energy function display layout */
.energy-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
  align-items: center;
}

.energy-main {
  text-align: center;
}

.energy-main img {
  max-width: 100%;
  height: auto;
  width: 320px;
}

.energy-caption {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background-color: var(--md-code-bg-color);
  display: inline-block;
  text-align: center;
  border-left: 3px solid var(--md-accent-fg-color);
  max-width: 95%;
  font-size: 0.9rem;
  margin: 0 auto;
}

.energy-caption.energy-caption-top {
  margin-bottom: 0.75rem;
}

.energy-caption.energy-caption-bottom {
  margin-top: 0.75rem;
}

.energy-caption p {
  margin: 0.25rem 0;
}

.energy-caption .arithmatex {
  overflow-x: auto;
  margin: 0.5rem 0;
  padding: 0.25rem 0;
  font-size: 0.95rem;
  display: block;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  padding: 0.5rem;
}

/* Adjust mobile responsiveness for energy captions */
@media screen and (max-width: 768px) {
  .energy-caption {
    max-width: 95%;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.85rem;
  }
  
  .energy-caption .arithmatex {
    font-size: 0.9rem;
  }
}

.energy-others {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 0.75rem;
}

.energy-others img {
  max-width: 100%;
  height: auto;
  width: 150px;
  opacity: 0.7;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
  transition: all 0.2s ease-in-out;
}

.energy-others img:hover {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile responsiveness for energy function display */
@media screen and (max-width: 768px) {
  .energy-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .energy-others {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
  }
  
  .energy-main img {
    width: 280px;
  }
  
  .energy-others img {
    width: 100px;
  }
}

@media screen and (max-width: 480px) {
  .energy-others {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  
  .energy-main img {
    width: 240px;
  }
  
  .energy-others img {
    width: 80px;
  }
}

/* Grid layout for energy function displays - old version */
.grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.grid-item.grid-small {
  flex: 1;
}

.grid-item.grid-small .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
}

.grid-item.grid-small .grid > div {
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid-item.grid-small img {
  opacity: 0.7;
  transition: opacity 0.2s ease-in-out;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 4px;
}

.grid-item.grid-small img:hover {
  opacity: 1;
} 