/* anchor targets should not hide under the sticky header */
/* scroll-margin-top adds invisible space *above* the anchor target,
   so when the browser jumps to #papers or #top it stops below the sticky header. */
#papers,
#top {
  scroll-margin-top: var(--header-h);
}

/* Base button — shared by every .btn-* variant below. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;          /* pill shape */
  border: 1.5px solid transparent;
  background: transparent;
  font-weight: 600;
  font-size: 14.5px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease, opacity .15s ease;
}

/* Small "press down" effect on click for tactile feedback. */
.btn:active {
  transform: translateY(1px);
}

/* Disabled buttons look inert and shouldn't respond to hover/active. */
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-gold {
  background: var(--gold);
  color: var(--maroon-950);
}

/* :not(:disabled) so hover styles don't fire on disabled buttons. */
.btn-gold:hover:not(:disabled) {
  background: var(--gold-light);
  box-shadow: 0 10px 24px -10px rgba(212, 169, 55, .55);
}

/* Outline style used over dark hero backgrounds. */
.btn-outline-light {
  border-color: rgba(249, 241, 228, .5);
  color: var(--cream);
}

.btn-outline-light:hover {
  background: rgba(249, 241, 228, .1);
  border-color: var(--cream);
}

.btn-maroon {
  background: var(--maroon-800);
  color: var(--cream);
}

.btn-maroon:hover:not(:disabled) {
  background: var(--maroon-900);
}

/* Minimal bordered button — used for secondary actions. */
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--maroon-700);
  color: var(--maroon-800);
}

/* Active state for toggle-style ghost buttons (e.g. when a filter is on). */
.btn-ghost.is-active {
  background: var(--maroon-800);
  border-color: var(--maroon-800);
  color: var(--cream);
}

/* Compact variant — same look, smaller padding and font size. */
.btn-sm {
  padding: 9px 16px;
  font-size: 13px;
}

/* Round icon-only button (theme toggle, close, etc.). */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: border-color .15s, color .15s;
  flex: none;
}

.icon-btn:hover {
  border-color: var(--maroon-700);
  color: var(--maroon-800);
}

/* The desktop and mobile theme buttons use the same styles. */
/* position: relative anchors the absolutely-positioned sun/moon icons below. */
.theme-toggle {
  position: relative;
}

.mobile-theme-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: none;
  border: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--maroon-900);
  flex: none;
}

/* Both icons occupy the same box; only opacity + transform change between themes
   so switching from moon to sun is a smooth cross-fade + rotate. */
.theme-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .25s ease, transform .35s ease;
}

/* Default (light) theme shows the moon icon. */
.theme-icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(.4);
}

.theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Dark theme flips the two — sun becomes visible. */
html[data-theme="dark"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

html[data-theme="dark"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(.4);
}

/* Generic page section with generous vertical breathing room. */
.section {
  padding: 88px 0;
}

/* Centered heading block above a grid or list. */
.section-head {
  max-width: 640px;
  margin: 0 auto 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Fluid heading: 28px on small screens, growing to 38px on wide ones. */
.section-head h2 {
  font-size: clamp(28px, 3.4vw, 38px);
  color: var(--maroon-900);
  font-weight: 700;
}

.section-head p {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.6;
}

/* Tighter vertical padding on phones. */
@media (max-width:640px) {
  .section {
    padding: 56px 0;
  }
}