/*
 * warm.css — a warmer palette (and a few quiet touches) on top of LaTeX.css.
 * The only motion is a short fade-in on page load (skipped when the visitor
 * prefers reduced motion).
 *
 * Everything here is additive: style.css is untouched. To revert, remove the
 *   <link rel="stylesheet" href="warm.css" />
 * line from the pages (or just don't merge the `warm-theme` branch).
 */

/* ------------------------------------------------------------------ */
/* 1. Palette: ivory paper, warm ink, brick-red hyperref links          */
/* ------------------------------------------------------------------ */

:root {
  --body-color: hsl(25, 18%, 12%);
  --body-bg-color: hsl(40, 45%, 97%);
  --link-visited: hsl(6, 72%, 36%);
  --link-focus-outline: hsl(28, 85%, 48%);
  --pre-bg-color: hsl(38, 35%, 92%);

  --warm-accent: hsl(28, 85%, 48%);
  --warm-muted: hsl(28, 10%, 36%);
  --warm-rule: hsla(30, 30%, 35%, 0.2);
  --warm-soft: hsl(40, 50%, 94.5%);
  --warm-card: hsl(42, 60%, 98.5%);
  --warm-highlight: hsla(42, 100%, 55%, 0.38);
  --warm-shadow: 0 0.35rem 1.1rem hsla(25, 40%, 25%, 0.1);

  /* blog.css variables, warmed */
  --blog-muted: var(--warm-muted);
  --blog-rule: var(--warm-rule);
  --blog-soft-bg: var(--warm-soft);
}

@media (prefers-color-scheme: dark) {
  .latex-dark-auto {
    --body-color: hsl(38, 22%, 86%);
    --body-bg-color: hsl(30, 9%, 12%);
    --link-visited: hsl(24, 85%, 72%);
    --link-focus-outline: hsl(36, 90%, 62%);
    --pre-bg-color: hsl(30, 8%, 18%);

    --warm-accent: hsl(36, 90%, 62%);
    --warm-muted: hsl(35, 12%, 68%);
    --warm-rule: hsla(35, 25%, 80%, 0.16);
    --warm-soft: hsl(30, 9%, 15.5%);
    --warm-card: hsl(30, 9%, 15%);
    --warm-highlight: hsla(36, 90%, 55%, 0.32);
    --warm-shadow: 0 0.35rem 1.1rem hsla(0, 0%, 0%, 0.35);

    --blog-muted: var(--warm-muted);
    --blog-rule: var(--warm-rule);
    --blog-soft-bg: var(--warm-soft);
  }
}

::selection {
  background: var(--warm-highlight);
}

/* Muted greys → warm greys */
.latex-dark-auto header .author,
.latex-dark-auto .course-meta,
.latex-dark-auto .post-list time,
.latex-dark-auto .member-role {
  color: var(--warm-muted);
}

@media (max-width: 640px) {
  .latex-dark-auto .mobile-nav,
  .latex-dark-auto .mobile-nav summary::before {
    color: var(--warm-muted);
  }
  .mobile-menu-links {
    border-color: var(--warm-rule);
    box-shadow: var(--warm-shadow);
  }
}

.activities {
  --activity-muted: var(--warm-muted);
  --activity-rule: var(--warm-rule);
}

.course,
.course:last-child,
.section-header {
  border-color: var(--warm-rule);
}

/* ------------------------------------------------------------------ */
/* 2. Focus rings and social icons                                      */
/* ------------------------------------------------------------------ */

:focus-visible {
  outline: 2px solid var(--link-focus-outline);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Social icons: no jump on hover, just the link colour
   (overrides the inline translateY(-10px)) */
nav.socials a,
nav.socials a:hover {
  transform: none;
  transition: none;
}

nav.socials a:hover,
nav.socials a:focus-visible {
  color: var(--link-visited);
}

/* ------------------------------------------------------------------ */
/* 3. A gentle fade-in when a page loads                                */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  main {
    animation: warm-rise 0.55s ease-out backwards;
  }
  nav.socials {
    animation: warm-rise 0.55s 0.12s ease-out backwards;
  }
}

@keyframes warm-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ------------------------------------------------------------------ */
/* 4. Homepage                                                          */
/* ------------------------------------------------------------------ */

img.portrait {
  box-shadow: 0 0 0 5px var(--body-bg-color), 0 0 0 6px var(--warm-rule),
    var(--warm-shadow);
}

p.news {
  padding-left: 0.9rem;
  border-left: 2px solid var(--warm-accent);
}

/* ------------------------------------------------------------------ */
/* 5. Papers: a thin margin bar marks the entry under the cursor        */
/* ------------------------------------------------------------------ */

main.papers li {
  position: relative;
  margin-bottom: 0.3rem;
}

main.papers li:hover::before {
  content: "";
  position: absolute;
  left: -2.15rem;
  top: 0.4em;
  bottom: 0.4em;
  width: 2px;
  background: var(--warm-accent);
}

/* ------------------------------------------------------------------ */
/* 6. Cards (group, teaching, news feed)                                */
/* ------------------------------------------------------------------ */

.latex-dark-auto .member-card,
.latex-dark-auto .news-feed {
  border-color: var(--warm-rule);
  background: var(--warm-card);
}

.latex-dark-auto .news-feed > ul > li + li {
  border-color: var(--warm-rule);
}

.member-photo {
  background: var(--warm-soft);
}
