/* =============================================================================
   Tool Documentation Page Styles
   Technical brutalist documentation with clear hierarchy
   ============================================================================= */

/* --- Entrance Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Staggered section entrance */
.doc-section {
  animation: fadeInUp 0.4s ease-out both;
  scroll-margin-top: calc(72px + var(--space-lg));
}

.doc-section:nth-child(1) { animation-delay: 0.05s; }
.doc-section:nth-child(2) { animation-delay: 0.1s; }
.doc-section:nth-child(3) { animation-delay: 0.15s; }
.doc-section:nth-child(4) { animation-delay: 0.2s; }
.doc-section:nth-child(5) { animation-delay: 0.25s; }

/* Sidebar cards entrance */
.download-card,
.versions-card,
.info-card {
  animation: fadeInUp 0.4s ease-out both;
}

.download-card { animation-delay: 0.1s; }
.versions-card { animation-delay: 0.15s; }
.info-card { animation-delay: 0.2s; }

/* --- Hero Enhancements --- */
.tool-hero__header {
  margin-bottom: var(--space-lg);
}

.tool-hero__title-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.tool-hero__title-group h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

.tool-hero__version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--black-deep);
  background: var(--cyan-primary);
  padding: 6px 12px;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.tool-hero__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.tool-hero__meta {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
  margin-bottom: 0; /* Remove extra margin to balance with top spacing */
}

.tool-hero__meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-hero__meta-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.tool-hero__meta-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--white-secondary);
}

.tool-hero__meta-item--highlight .tool-hero__meta-value {
  color: var(--cyan-primary);
}

/* --- Content Grid --- */
/* Override the base .tool-content grid on the section to use container properly */
.tool-content {
  display: block;
  padding-top: var(--space-lg); /* Tighter spacing below hero */
}

.tool-content__grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-xl);
}

@media (max-width: 1024px) {
  .tool-content__grid {
    grid-template-columns: 1fr;
  }

  .tool-content__sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
  }
}

/* --- Doc Section Enhancements --- */
.doc-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--grey-border);
}

.doc-section__header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.doc-section__badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--cyan-primary);
  background: var(--cyan-subtle);
  border: 1px solid var(--cyan-dim);
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.doc-section__note {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Feature List --- */
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list__item {
  padding: var(--space-sm) 0;
  padding-left: var(--space-md);
  border-left: 2px solid var(--grey-border);
  margin-bottom: var(--space-sm);
  color: var(--grey-text);
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.feature-list__item:hover {
  border-color: var(--cyan-primary);
}

.feature-list__item strong {
  color: var(--white-secondary);
  display: block;
  margin-bottom: 2px;
}

/* --- Keybind Groups --- */
.keybind-group {
  margin-bottom: var(--space-lg);
}

.keybind-group:last-child {
  margin-bottom: 0;
}

.keybind-group__title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

/* --- Enhanced Keyboard Keys --- */
.keybind-table kbd {
  display: inline-block;
  min-width: 2em;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  color: var(--cyan-primary);
  background:
    linear-gradient(180deg, var(--black-elevated) 0%, var(--black-surface) 100%);
  border: 1px solid var(--grey-border);
  border-bottom-width: 3px;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}

.keybind-table tr:hover kbd {
  color: var(--white-primary);
  border-color: var(--cyan-dim);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 0 8px var(--cyan-glow);
}

/* --- Table Row Interactions --- */
.keybind-table tbody tr {
  transition: background-color 0.15s ease;
}

.keybind-table tbody tr:hover {
  background: var(--black-elevated);
}

.compat-table tbody tr:not(.compat-table__row--current) {
  transition: background-color 0.15s ease;
}

.compat-table tbody tr:not(.compat-table__row--current):hover {
  background: var(--black-elevated);
}

/* --- Notes --- */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.note-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--black-surface);
  border: 1px solid var(--grey-border);
  border-left: 3px solid var(--cyan-dim);
}

.note-item--info {
  border-left-color: var(--grey-muted);
}

.note-item__icon {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cyan-subtle);
  color: var(--cyan-primary);
  flex-shrink: 0;
}

.note-item--info .note-item__icon {
  background: var(--black-elevated);
  color: var(--grey-text);
}

.note-item p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--grey-text);
  line-height: 1.5;
  max-width: none;
}

/* --- Compatibility Table --- */
.compat-table {
  width: 100%;
  border-collapse: collapse;
}

.compat-table th,
.compat-table td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--grey-border);
}

.compat-table th {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey-muted);
  background: var(--black-surface);
}

.compat-table td {
  font-size: 0.875rem;
  color: var(--grey-text);
}

.compat-table__row--current {
  background: var(--cyan-subtle);
}

.compat-table__row--current td {
  color: var(--white-secondary);
}

.compat-table__version {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--white-secondary);
}

.compat-table__status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
}

.compat-table__status--current {
  background: var(--cyan-primary);
  color: var(--black-deep);
}

.compat-table__status--supported {
  background: var(--black-elevated);
  color: var(--grey-text);
  border: 1px solid var(--grey-border);
}

.compat-table__status--legacy {
  background: transparent;
  color: var(--grey-muted);
  border: 1px solid var(--grey-border);
}

/* --- Changelog --- */
.changelog {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.changelog__entry {
  padding: var(--space-md);
  background: var(--black-surface);
  border: 1px solid var(--grey-border);
  border-left: 3px solid var(--grey-border);
  transition: border-color 0.2s ease;
}

.changelog__entry:hover {
  border-left-color: var(--grey-muted);
}

.changelog__entry--latest {
  border-left-color: var(--cyan-primary);
  background: linear-gradient(90deg, var(--cyan-subtle) 0%, var(--black-surface) 100%);
}

.changelog__entry--latest:hover {
  border-left-color: var(--cyan-primary);
}

.changelog__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
  flex-wrap: wrap;
}

.changelog__version {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--white-primary);
}

.changelog__date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
}

.changelog__game {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--grey-text);
  background: var(--black-elevated);
  border: 1px solid var(--grey-border);
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.changelog__list {
  margin: 0;
  padding-left: var(--space-lg);
  color: var(--grey-text);
  font-size: 0.875rem;
}

.changelog__list li {
  margin-bottom: 4px;
}

.changelog__list li:last-child {
  margin-bottom: 0;
}

/* --- Download Card (Sidebar) --- */
.download-card {
  background: var(--black-surface);
  border: 1px solid var(--grey-border);
  padding: var(--space-lg);
}

.download-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--grey-border);
}

.download-card__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.download-card__game-version {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--cyan-primary);
}

.download-card__btn {
  width: 100%;
  justify-content: center;
  margin-bottom: var(--space-sm);
}

.download-card__btn:last-child {
  margin-bottom: 0;
}

.download-card__btn svg {
  flex-shrink: 0;
}

/* Enhanced primary download button */
.download-card .btn--primary {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.download-card .btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.download-card .btn--primary:hover {
  box-shadow:
    0 0 20px var(--cyan-glow),
    0 0 40px rgba(0, 212, 212, 0.1);
  transform: translateY(-1px);
}

.download-card .btn--primary:hover::before {
  transform: translateX(100%);
}

.download-card .btn--primary:active {
  transform: translateY(0);
}

/* --- Versions Card (Sidebar) --- */
.versions-card {
  background: var(--black-surface);
  border: 1px solid var(--grey-border);
  padding: var(--space-lg);
}

.versions-card__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--grey-border);
}

.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--grey-border);
  text-decoration: none;
  transition: all 0.2s ease;
}

.version-item:last-child {
  border-bottom: none;
}

.version-item:hover {
  padding-left: var(--space-sm);
}

.version-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.version-item__version {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--white-secondary);
  transition: color 0.2s ease;
}

.version-item:hover .version-item__version {
  color: var(--cyan-primary);
}

.version-item__game {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.version-item__icon {
  color: var(--grey-muted);
  transition: color 0.2s ease;
}

.version-item:hover .version-item__icon {
  color: var(--cyan-primary);
}

/* --- Info Card (Sidebar) --- */
.info-card {
  background: var(--black-surface);
  border: 1px solid var(--grey-border);
  padding: var(--space-lg);
}

.info-card__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--grey-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.info-card__text {
  font-size: 0.85rem;
  color: var(--grey-text);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.5;
}

.info-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: gap 0.2s ease;
}

.info-card__link:hover {
  gap: var(--space-sm);
}

.info-card__link svg {
  transition: transform 0.2s ease;
}

.info-card__link:hover svg {
  transform: translateX(2px);
}

/* --- Focus States (Accessibility) --- */
.btn:focus-visible,
.version-item:focus-visible,
.info-card__link:focus-visible {
  outline: 2px solid var(--cyan-primary);
  outline-offset: 2px;
}

.keybind-table:focus-within tbody tr:focus-within {
  background: var(--black-elevated);
}

/* --- Version Badge Enhancement --- */
.tool-hero__version {
  position: relative;
}

.tool-hero__version::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--cyan-primary);
  opacity: 0;
  filter: blur(8px);
  z-index: -1;
  animation: versionPulse 3s ease-in-out infinite;
}

@keyframes versionPulse {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.3; }
}

/* --- Feature List Enhancement --- */
.feature-list__item {
  position: relative;
}

.feature-list__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--cyan-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.2s ease;
}

.feature-list__item:hover::before {
  transform: scaleY(1);
}

/* --- Changelog Entry Enhancement --- */
.changelog__entry {
  position: relative;
}

.changelog__entry::before {
  content: '';
  position: absolute;
  left: -3px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cyan-primary);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.25s ease;
}

.changelog__entry:hover::before {
  transform: scaleY(1);
}

.changelog__entry--latest::before {
  transform: scaleY(1);
}

/* --- Note Item Enhancement --- */
.note-item {
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.note-item:hover {
  background: var(--black-elevated);
}

.note-item:hover:not(.note-item--info) {
  border-left-color: var(--cyan-primary);
}

/* --- Sidebar Card Hover Enhancement --- */
.download-card,
.versions-card,
.info-card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.download-card:hover,
.versions-card:hover,
.info-card:hover {
  border-color: var(--grey-muted);
}

/* --- Minimum Font Size Accessibility --- */
.tool-hero__meta-label,
.doc-section__badge,
.changelog__game,
.version-item__game {
  font-size: 0.65rem; /* Bumped from 0.6rem */
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  .tool-hero__meta {
    flex-direction: column;
    gap: var(--space-md);
  }

  .tool-hero__meta-item {
    flex-direction: row;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--grey-border);
  }

  .doc-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .changelog__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .compat-table {
    font-size: 0.8rem;
  }

  .compat-table th,
  .compat-table td {
    padding: var(--space-sm);
  }
}

/* --- Reduced Motion Accessibility --- */
@media (prefers-reduced-motion: reduce) {
  .doc-section,
  .download-card,
  .versions-card,
  .info-card {
    animation: none;
  }

  .tool-hero__version::after {
    animation: none;
    opacity: 0;
  }

  .feature-list__item::before,
  .changelog__entry::before,
  .download-card .btn--primary::before {
    transition: none;
  }

  .keybind-table tr:hover kbd {
    transform: none;
  }

  .download-card .btn--primary:hover {
    transform: none;
  }
}
