/* Shared interaction safeguards for every published surface. */
.skip-link {
  position: fixed;
  top: 0;
  left: 16px;
  z-index: 2147483647;
  padding: 10px 14px;
  border-radius: 0 0 6px 6px;
  background: #111c22;
  color: #fff;
  font: 700 14px/1.2 system-ui, sans-serif;
  text-decoration: none;
  transform: translateY(-120%);
  transition: none;
}

.skip-link:focus-visible {
  color: #fff;
  outline-color: #fff;
  transform: translateY(0);
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--accent, #b64e35);
  outline-offset: 3px;
}

.nav a[aria-current] {
  font-weight: 800;
}

.nav a:not(.brand)[aria-current] {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* Opt-in disclosure motion shared by CV, project, and teaching pages. */
details[data-details-motion="ready"] > .details-motion-content {
  opacity: 0;
  transform: translateY(-4px);
  transition-property: opacity, transform;
  transition-duration: 160ms;
  transition-timing-function: var(
    --ease-out,
    cubic-bezier(0.23, 1, 0.32, 1)
  );
}

details[data-details-state="open"] > .details-motion-content {
  opacity: 1;
  transform: translateY(0);
  transition-duration: 180ms;
}

details[data-details-motion-instant="true"] > .details-motion-content {
  transition: none !important;
}

:where(.button, .case-card, .course-card[href], .project-card[href], .featured-project, .project-row, .teaching-row[href], .featured-course, .material-card[href], .back-link, .deck-archive-link, button, summary):active {
  transform: scale(0.98);
}

:is(.featured-project, .project-row, .teaching-row[href], .featured-course, .material-card[href]):active {
  transition: transform 120ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}

@media (hover: none), (pointer: coarse) {
  :where(.button, .case-card, .course-card[href], .project-card, .featured-project, .project-row, .teaching-row[href], .featured-course, .news-item, .back-link, .deck-archive-link, button, summary):not(:active):hover {
    transform: none !important;
  }

  .material-card:not(:active):hover {
    border-color: var(--line, #d7d2c8) !important;
    border-left-color: var(--accent, #b64e35) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    color: inherit !important;
    box-shadow: 0 12px 28px rgba(17, 24, 33, 0.06) !important;
  }

  .toc a:not(:active):hover {
    background: transparent !important;
    color: var(--muted) !important;
  }

  .overview-card:not(:focus-visible):not(:active):hover {
    outline: 0 !important;
  }

  .back-link:not(:active):hover {
    border-color: var(--line-strong, #c6bfb3) !important;
    color: var(--ink-strong, #201e1b) !important;
  }

  .deck-archive-link:not(:active):hover {
    border-color: rgba(255, 255, 255, 0.32) !important;
    background: rgba(32, 30, 29, 0.88) !important;
    color: #f3f2f2 !important;
  }

  :where(.archive-link, .copy-button, .reset-button):not(:focus-visible):not(:active):hover {
    background: var(--touch-resting-background) !important;
  }

  .btn-primary:not(:active):hover {
    background: var(--color-accent) !important;
  }

  :where(.btn-secondary, .btn-ghost):not(:active):hover,
  .seg-opt:not(:has(input:checked)):not(:active):hover {
    background: transparent !important;
  }

  .input:not(:focus-visible):not(:active):hover {
    border-color: var(--color-divider) !important;
  }

  .radio:not(:has(input:checked)):not(:active):hover .dot {
    border-color: var(--color-divider) !important;
  }

  .nav a:not([aria-current]):not(:active):hover {
    color: inherit !important;
  }

  .table tbody tr:not(:active):hover {
    background: transparent !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  details[data-details-motion="ready"] > .details-motion-content {
    transform: none !important;
    transition: opacity 200ms ease !important;
  }

  :is(.featured-project, .project-row, .teaching-row[href], .featured-course, .material-card[href]) {
    transition: opacity 100ms linear !important;
  }

  :is(.featured-project, .project-row, .teaching-row[href], .featured-course, .material-card[href]):active {
    opacity: 0.86;
    transform: none;
  }
}
